On Wed, Aug 16, 2023, at 00:16, Nathan Chancellor wrote: > After the switch to SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() and a subsequent > fix, stm32_rtc_{suspend,resume}() are unused when CONFIG_PM_SLEEP is not > set because SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() is a no-op in that > configuration: > > drivers/rtc/rtc-stm32.c:904:12: error: 'stm32_rtc_resume' defined but > not used [-Werror=unused-function] > 904 | static int stm32_rtc_resume(struct device *dev) > | ^~~~~~~~~~~~~~~~ > drivers/rtc/rtc-stm32.c:894:12: error: 'stm32_rtc_suspend' defined > but not used [-Werror=unused-function] > 894 | static int stm32_rtc_suspend(struct device *dev) > | ^~~~~~~~~~~~~~~~~ > cc1: all warnings being treated as errors > > The non-"SET_" version of this macro, NOIRQ_SYSTEM_SLEEP_PM_OPS(), is > designed to handle this situation by only assigning the callbacks when > CONFIG_PM_SLEEP is set while allowing the functions to appear used to > the compiler. Switch to that macro to resolve the warnings. There is no > functional change with this, as SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() is > defined using NOIRQ_SYSTEM_SLEEP_PM_OPS() when CONFIG_PM_SLEEP is set. > > Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx> Reviewed-by: Arnd Bergmann <arnd@xxxxxxxx> > --- > I am not sure what to do about a Fixes: tag for this change. I am not > sure how Arnd triggered the error/warning in commit a69c610e13e2 ("rtc: > stm32: remove incorrect #ifdef check"), since from what I can tell, > SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() is only defined in terms of > NOIRQ_SYSTEM_SLEEP_PM_OPS() when CONFIG_PM_SLEEP is set, so I am not > sure how those functions could be absent in the source file but used in > NOIRQ_SYSTEM_SLEEP_PM_OPS() when CONFIG_PM_SLEEP is unset... I could be > missing something though. It was a mistake on my end: my randconfig tree has an experimental patch to clean up all 13 users of SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() that actually rely on the old behavior and changing the definition to be the same as NOIRQ_SYSTEM_SLEEP_PM_OPS. I should get back to that series and actually send out patches towards removing the deprecated helpers. Arnd