Skip to contentSkip to conversation

gpio: mxc: fix unused function warnings

PATCH Applied Arnd Bergmann 5 participants 6 messages Jul 18, 2023 – Jul 20, 2023

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

PATCH 1/1 gpio: mxc: fix unused function warnings

From: Arnd Bergmann <[email protected]>

The new runtime PM support causes a harmless warning about unused functions when runtime PM is disabled:

drivers/gpio/gpio-mxc.c:612:12: error: 'mxc_gpio_runtime_resume' defined but not used [-Werror=unused-function] drivers/gpio/gpio-mxc.c:602:12: error: 'mxc_gpio_runtime_suspend' defined but not used [-Werror=unused-function]

Change the driver to use the more modern helper macros that avoid these warnings, and remove the now unnecessary __maybe_unused annotations

Fixes 3283d820dce64 ("gpio: mxc: add runtime pm support")
---
 drivers/gpio/gpio-mxc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpio/gpio-mxc.c +4 -4
index a9fb6bd9aa6f9..e03fc8d375fe1 100644
@@ -623,7 +623,7 @@ static int mxc_gpio_runtime_resume(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev)
+static int mxc_gpio_noirq_suspend(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct mxc_gpio_port *port = platform_get_drvdata(pdev);
@@ -634,7 +634,7 @@ static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
+static int mxc_gpio_noirq_resume(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct mxc_gpio_port *port = platform_get_drvdata(pdev);
@@ -647,8 +647,8 @@ static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops mxc_gpio_dev_pm_ops = {
-	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume)
-	SET_RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL)
+	NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume)
+	RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL)
 };
 
 static int mxc_gpio_syscore_suspend(void)
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The new runtime PM support causes a harmless warning about unused functions when runtime PM is disabled:

drivers/gpio/gpio-mxc.c:612:12: error: 'mxc_gpio_runtime_resume' defined but not used [-Werror=unused-function] drivers/gpio/gpio-mxc.c:602:12: error: 'mxc_gpio_runtime_suspend' defined but not used [-Werror=unused-function]

Change the driver to use the more modern helper macros that avoid these warnings, and remove the now unnecessary __maybe_unused annotations

Quoted 42 lines
Fixes 3283d820dce64 ("gpio: mxc: add runtime pm support")
---
 drivers/gpio/gpio-mxc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpio/gpio-mxc.c +4 -5
index a9fb6bd9aa6f9..e03fc8d375fe1 100644
@@ -623,7 +623,7 @@ static int mxc_gpio_runtime_resume(struct device *dev)
        return 0;
 }
 
-static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev)
+static int mxc_gpio_noirq_suspend(struct device *dev)
 {
        struct platform_device *pdev = to_platform_device(dev);
        struct mxc_gpio_port *port = platform_get_drvdata(pdev);
@@ -634,7 +634,7 @@ static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev)
        return 0;
 }
 
-static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
+static int mxc_gpio_noirq_resume(struct device *dev)
 {
        struct platform_device *pdev = to_platform_device(dev);
        struct mxc_gpio_port *port = platform_get_drvdata(pdev);
@@ -647,8 +647,8 @@ static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops mxc_gpio_dev_pm_ops = {
-       SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume)
-       SET_RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL)
+       NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume)
+       RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL)
 };
 
 static int mxc_gpio_syscore_suspend(void)
--

2.39.2

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
In reply to Arnd Bergmann
Quoted 8 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The new runtime PM support causes a harmless warning about unused functions when runtime PM is disabled:

drivers/gpio/gpio-mxc.c:612:12: error: 'mxc_gpio_runtime_resume' defined but not used [-Werror=unused-function] drivers/gpio/gpio-mxc.c:602:12: error: 'mxc_gpio_runtime_suspend' defined but not used [-Werror=unused-function]

Quoted 6 lines

Change the driver to use the more modern helper macros that avoid these warnings, and remove the now unnecessary __maybe_unused annotations

Fixes 3283d820dce64 ("gpio: mxc: add runtime pm support")

---

The patch is nice, but I don't understand why __maybe_unused doesn't work?

regards,
dan carpenter

#3 lore raw
Quoted 12 lines · Dan Carpenter
Quoted 11 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The new runtime PM support causes a harmless warning about unused functions when runtime PM is disabled:

drivers/gpio/gpio-mxc.c:612:12: error: 'mxc_gpio_runtime_resume' defined but not used [-Werror=unused-function] drivers/gpio/gpio-mxc.c:602:12: error: 'mxc_gpio_runtime_suspend' defined but not used [-Werror=unused-function]

Change the driver to use the more modern helper macros that avoid these warnings, and remove the now unnecessary __maybe_unused annotations

Quoted 6 lines
Quoted 3 lines
Fixes 3283d820dce64 ("gpio: mxc: add runtime pm support")

---

The patch is nice, but I don't understand why __maybe_unused doesn't work?

Adding __maybe_unused to both mxc_gpio_runtime_resume and mxc_gpio_runtime_suspend would avoid the warning, and that is what we used to do in the past before we had the new macros, including for the mxc_gpio_noirq_suspend/mxc_gpio_noirq_resume functions in this driver.

Since I'm moving the driver to the new method, it's best to do it for both pairs of PM functions at the same time, so the __maybe_unused annotation becomes redundant.

Arnd

#4 lore raw
Quoted 9 lines · Arnd Bergmann

Adding __maybe_unused to both mxc_gpio_runtime_resume and mxc_gpio_runtime_suspend would avoid the warning, and that is what we used to do in the past before we had the new macros, including for the mxc_gpio_noirq_suspend/mxc_gpio_noirq_resume functions in this driver.

Since I'm moving the driver to the new method, it's best to do it for both pairs of PM functions at the same time, so the __maybe_unused annotation becomes redundant.

Ah, sorry. I misread the patch.

regards,
dan carpenter

#5 lore raw
In reply to Arnd Bergmann
Quoted 52 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The new runtime PM support causes a harmless warning about unused functions when runtime PM is disabled:

drivers/gpio/gpio-mxc.c:612:12: error: 'mxc_gpio_runtime_resume' defined but not used [-Werror=unused-function] drivers/gpio/gpio-mxc.c:602:12: error: 'mxc_gpio_runtime_suspend' defined but not used [-Werror=unused-function]

Change the driver to use the more modern helper macros that avoid these warnings, and remove the now unnecessary __maybe_unused annotations

Fixes 3283d820dce64 ("gpio: mxc: add runtime pm support")
---
 drivers/gpio/gpio-mxc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpio/gpio-mxc.c +4 -5
index a9fb6bd9aa6f9..e03fc8d375fe1 100644
@@ -623,7 +623,7 @@ static int mxc_gpio_runtime_resume(struct device *dev)
        return 0;
 }
 
-static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev)
+static int mxc_gpio_noirq_suspend(struct device *dev)
 {
        struct platform_device *pdev = to_platform_device(dev);
        struct mxc_gpio_port *port = platform_get_drvdata(pdev);
@@ -634,7 +634,7 @@ static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev)
        return 0;
 }
 
-static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
+static int mxc_gpio_noirq_resume(struct device *dev)
 {
        struct platform_device *pdev = to_platform_device(dev);
        struct mxc_gpio_port *port = platform_get_drvdata(pdev);
@@ -647,8 +647,8 @@ static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops mxc_gpio_dev_pm_ops = {
-       SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume)
-       SET_RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL)
+       NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume)
+       RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL)
 };
 
 static int mxc_gpio_syscore_suspend(void)
--
Quoted 2 lines

2.39.2

Applied, thanks!

Bart