Skip to contentSkip to conversation

pinctrl: samsung: mark PM functions as __maybe_unused

PATCH In review Arnd Bergmann 3 participants 3 messages Feb 1, 2017 – Feb 6, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: samsung: mark PM functions as __maybe_unused

The rework of the suspend/resume handling uses the wrong #ifdef check, leading to a build warning without CONFIG_PM_SLEEP:

drivers/pinctrl/samsung/pinctrl-samsung.c:1142:12: error: 'samsung_pinctrl_resume' defined but not used [-Werror=unused-function] drivers/pinctrl/samsung/pinctrl-samsung.c:1092:12: error: 'samsung_pinctrl_suspend' defined but not used [-Werror=unused-function]

Using a __maybe_unused annotation instead of the #ifdef is a simple way to avoid this problem class.

Fixes 2b24efa8e5c5 ("pinctrl: samsung: Replace syscore ops with standard platform device pm_ops")
---
 drivers/pinctrl/samsung/pinctrl-samsung.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/pinctrl/samsung/pinctrl-samsung.c +2 -4
index d79eadad6c5f..d601b5303e73 100644
@@ -1083,13 +1083,12 @@ static int samsung_pinctrl_probe(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM
 /**
  * samsung_pinctrl_suspend - save pinctrl state for suspend
  *
  * Save data for all banks handled by this device.
  */
-static int samsung_pinctrl_suspend(struct device *dev)
+static int __maybe_unused samsung_pinctrl_suspend(struct device *dev)
 {
 	struct samsung_pinctrl_drv_data *drvdata = dev_get_drvdata(dev);
 	int i;
@@ -1139,7 +1138,7 @@ static int samsung_pinctrl_suspend(struct device *dev)
  * We don't bother doing anything complicated to avoid glitching lines since
  * we're called before pad retention is turned off.
  */
-static int samsung_pinctrl_resume(struct device *dev)
+static int __maybe_unused samsung_pinctrl_resume(struct device *dev)
 {
 	struct samsung_pinctrl_drv_data *drvdata = dev_get_drvdata(dev);
 	int i;
@@ -1183,7 +1182,6 @@ static int samsung_pinctrl_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
 static const struct of_device_id samsung_pinctrl_dt_match[] = {
 #ifdef CONFIG_PINCTRL_EXYNOS
Signature · 1 line
2.9.0
Acked-by on v1 1/1
#1 lore raw

Hi Arnd,

Quoted 11 lines · Arnd Bergmann

The rework of the suspend/resume handling uses the wrong #ifdef check, leading to a build warning without CONFIG_PM_SLEEP:

drivers/pinctrl/samsung/pinctrl-samsung.c:1142:12: error: 'samsung_pinctrl_resume' defined but not used [-Werror=unused-function] drivers/pinctrl/samsung/pinctrl-samsung.c:1092:12: error: 'samsung_pinctrl_suspend' defined but not used [-Werror=unused-function]

Using a __maybe_unused annotation instead of the #ifdef is a simple way to avoid this problem class.

Fixes 2b24efa8e5c5 ("pinctrl: samsung: Replace syscore ops with standard platform device pm_ops")

Thanks for the fix!

Quoted 33 lines
---
  drivers/pinctrl/samsung/pinctrl-samsung.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
drivers/pinctrl/samsung/pinctrl-samsung.c +2 -3
index d79eadad6c5f..d601b5303e73 100644
@@ -1083,13 +1083,12 @@ static int samsung_pinctrl_probe(struct platform_device *pdev)
  	return 0;
  }
 
-#ifdef CONFIG_PM
  /**
   * samsung_pinctrl_suspend - save pinctrl state for suspend
   *
   * Save data for all banks handled by this device.
   */
-static int samsung_pinctrl_suspend(struct device *dev)
+static int __maybe_unused samsung_pinctrl_suspend(struct device *dev)
  {
  	struct samsung_pinctrl_drv_data *drvdata = dev_get_drvdata(dev);
  	int i;
@@ -1139,7 +1138,7 @@ static int samsung_pinctrl_suspend(struct device *dev)
   * We don't bother doing anything complicated to avoid glitching lines since
   * we're called before pad retention is turned off.
   */
-static int samsung_pinctrl_resume(struct device *dev)
+static int __maybe_unused samsung_pinctrl_resume(struct device *dev)
  {
  	struct samsung_pinctrl_drv_data *drvdata = dev_get_drvdata(dev);
  	int i;

drivers/pinctrl/samsung/pinctrl-samsung.c static int samsung_pinctrl_resume(struct device *dev) · line 1187

Quoted 7 lines
drivers/pinctrl/samsung/pinctrl-samsung.c +0 -1
@@ -1183,7 +1182,6 @@ static int samsung_pinctrl_resume(struct device *dev)
 
  	return 0;
  }
-#endif
 
  static const struct of_device_id samsung_pinctrl_dt_match[] = {
  #ifdef CONFIG_PINCTRL_EXYNOS

Best regards

Signature · 2 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland
#2 lore raw
In reply to Arnd Bergmann
Quoted 11 lines · Arnd Bergmann

The rework of the suspend/resume handling uses the wrong #ifdef check, leading to a build warning without CONFIG_PM_SLEEP:

drivers/pinctrl/samsung/pinctrl-samsung.c:1142:12: error: 'samsung_pinctrl_resume' defined but not used [-Werror=unused-function] drivers/pinctrl/samsung/pinctrl-samsung.c:1092:12: error: 'samsung_pinctrl_suspend' defined but not used [-Werror=unused-function]

Using a __maybe_unused annotation instead of the #ifdef is a simple way to avoid this problem class.

Fixes 2b24efa8e5c5 ("pinctrl: samsung: Replace syscore ops with standard platform device pm_ops")

Patch applied with Marek's ACK.

Yours,
Linus Walleij