linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: mxc: fix unused function warnings
@ 2023-07-18 19:39 Arnd Bergmann
  2023-07-18 19:54 ` Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Arnd Bergmann @ 2023-07-18 19:39 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko, Shenwei Wang
  Cc: Arnd Bergmann, Andy Shevchenko, Marek Vasut, Marc Zyngier,
	Dan Carpenter, linux-gpio, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpio/gpio-mxc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index a9fb6bd9aa6f9..e03fc8d375fe1 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] gpio: mxc: fix unused function warnings
  2023-07-18 19:39 [PATCH] gpio: mxc: fix unused function warnings Arnd Bergmann
@ 2023-07-18 19:54 ` Andy Shevchenko
  2023-07-19  9:44 ` Dan Carpenter
  2023-07-20 15:23 ` Bartosz Golaszewski
  2 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2023-07-18 19:54 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Linus Walleij, Bartosz Golaszewski, Shenwei Wang, Arnd Bergmann,
	Andy Shevchenko, Marek Vasut, Marc Zyngier, Dan Carpenter,
	linux-gpio, linux-kernel

On Tue, Jul 18, 2023 at 10:39 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Fixes: 3283d820dce64 ("gpio: mxc: add runtime pm support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/gpio/gpio-mxc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> index a9fb6bd9aa6f9..e03fc8d375fe1 100644
> --- a/drivers/gpio/gpio-mxc.c
> +++ b/drivers/gpio/gpio-mxc.c
> @@ -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
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gpio: mxc: fix unused function warnings
  2023-07-18 19:39 [PATCH] gpio: mxc: fix unused function warnings Arnd Bergmann
  2023-07-18 19:54 ` Andy Shevchenko
@ 2023-07-19  9:44 ` Dan Carpenter
  2023-07-19 11:26   ` Arnd Bergmann
  2023-07-20 15:23 ` Bartosz Golaszewski
  2 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2023-07-19  9:44 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko, Shenwei Wang,
	Arnd Bergmann, Andy Shevchenko, Marek Vasut, Marc Zyngier,
	Dan Carpenter, linux-gpio, linux-kernel

On Tue, Jul 18, 2023 at 09:39:08PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

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

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gpio: mxc: fix unused function warnings
  2023-07-19  9:44 ` Dan Carpenter
@ 2023-07-19 11:26   ` Arnd Bergmann
  2023-07-19 11:30     ` Dan Carpenter
  0 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2023-07-19 11:26 UTC (permalink / raw)
  To: Dan Carpenter, Arnd Bergmann
  Cc: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko, Shenwei Wang,
	Andy Shevchenko, Marek Vasut, Marc Zyngier, Dan Carpenter,
	open list:GPIO SUBSYSTEM, linux-kernel

On Wed, Jul 19, 2023, at 11:44, Dan Carpenter wrote:
> On Tue, Jul 18, 2023 at 09:39:08PM +0200, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> 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")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gpio: mxc: fix unused function warnings
  2023-07-19 11:26   ` Arnd Bergmann
@ 2023-07-19 11:30     ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2023-07-19 11:30 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Arnd Bergmann, Linus Walleij, Bartosz Golaszewski,
	Andy Shevchenko, Shenwei Wang, Andy Shevchenko, Marek Vasut,
	Marc Zyngier, Dan Carpenter, open list:GPIO SUBSYSTEM,
	linux-kernel

On Wed, Jul 19, 2023 at 01:26:06PM +0200, Arnd Bergmann wrote:
> 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gpio: mxc: fix unused function warnings
  2023-07-18 19:39 [PATCH] gpio: mxc: fix unused function warnings Arnd Bergmann
  2023-07-18 19:54 ` Andy Shevchenko
  2023-07-19  9:44 ` Dan Carpenter
@ 2023-07-20 15:23 ` Bartosz Golaszewski
  2 siblings, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2023-07-20 15:23 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Linus Walleij, Andy Shevchenko, Shenwei Wang, Arnd Bergmann,
	Andy Shevchenko, Marek Vasut, Marc Zyngier, Dan Carpenter,
	linux-gpio, linux-kernel

On Tue, Jul 18, 2023 at 9:39 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/gpio/gpio-mxc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> index a9fb6bd9aa6f9..e03fc8d375fe1 100644
> --- a/drivers/gpio/gpio-mxc.c
> +++ b/drivers/gpio/gpio-mxc.c
> @@ -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
>

Applied, thanks!

Bart

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-07-20 15:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-18 19:39 [PATCH] gpio: mxc: fix unused function warnings Arnd Bergmann
2023-07-18 19:54 ` Andy Shevchenko
2023-07-19  9:44 ` Dan Carpenter
2023-07-19 11:26   ` Arnd Bergmann
2023-07-19 11:30     ` Dan Carpenter
2023-07-20 15:23 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).