linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtc: sh: mark PM functions as unused
@ 2017-04-19 17:52 Arnd Bergmann
  2017-04-22 16:02 ` Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2017-04-19 17:52 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni
  Cc: Arnd Bergmann, Uwe Kleine-König, Geert Uytterhoeven,
	Chris Brandt, rtc-linux, linux-kernel

The sh_rtc_set_irq_wake() function is only called from the suspend/resume handlers
that may be hidden, causing a harmless warning:

drivers/rtc/rtc-sh.c:724:13: error: 'sh_rtc_set_irq_wake' defined but not used [-Werror=unused-function]
 static void sh_rtc_set_irq_wake(struct device *dev, int enabled)

The most reliable way to avoid the warning is to remove the existing #ifdef
and mark the two functions as __maybe_unused so the compiler can silently
drop all three when there is no reference.

Fixes: dab5aec64bf5 ("rtc: sh: add support for rza series")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/rtc/rtc-sh.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c
index 00b396e96cbe..6c2d3989f967 100644
--- a/drivers/rtc/rtc-sh.c
+++ b/drivers/rtc/rtc-sh.c
@@ -734,8 +734,7 @@ static void sh_rtc_set_irq_wake(struct device *dev, int enabled)
 	}
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int sh_rtc_suspend(struct device *dev)
+static int __maybe_unused sh_rtc_suspend(struct device *dev)
 {
 	if (device_may_wakeup(dev))
 		sh_rtc_set_irq_wake(dev, 1);
@@ -743,14 +742,13 @@ static int sh_rtc_suspend(struct device *dev)
 	return 0;
 }
 
-static int sh_rtc_resume(struct device *dev)
+static int __maybe_unused sh_rtc_resume(struct device *dev)
 {
 	if (device_may_wakeup(dev))
 		sh_rtc_set_irq_wake(dev, 0);
 
 	return 0;
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(sh_rtc_pm_ops, sh_rtc_suspend, sh_rtc_resume);
 
-- 
2.9.0

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

* Re: [PATCH] rtc: sh: mark PM functions as unused
  2017-04-19 17:52 [PATCH] rtc: sh: mark PM functions as unused Arnd Bergmann
@ 2017-04-22 16:02 ` Alexandre Belloni
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2017-04-22 16:02 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Alessandro Zummo, Uwe Kleine-König, Geert Uytterhoeven,
	Chris Brandt, rtc-linux, linux-kernel

On 19/04/2017 at 19:52:43 +0200, Arnd Bergmann wrote:
> The sh_rtc_set_irq_wake() function is only called from the suspend/resume handlers
> that may be hidden, causing a harmless warning:
> 
> drivers/rtc/rtc-sh.c:724:13: error: 'sh_rtc_set_irq_wake' defined but not used [-Werror=unused-function]
>  static void sh_rtc_set_irq_wake(struct device *dev, int enabled)
> 
> The most reliable way to avoid the warning is to remove the existing #ifdef
> and mark the two functions as __maybe_unused so the compiler can silently
> drop all three when there is no reference.
> 
> Fixes: dab5aec64bf5 ("rtc: sh: add support for rza series")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/rtc/rtc-sh.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
Applied, thanks.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

end of thread, other threads:[~2017-04-22 16:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-19 17:52 [PATCH] rtc: sh: mark PM functions as unused Arnd Bergmann
2017-04-22 16:02 ` Alexandre Belloni

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).