2023-08-01 11:51:10

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH] rtc: stm32: remove incorrect #ifdef check

From: Arnd Bergmann <[email protected]>

After a previous commit changed the driver over to
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(), the suspend/resume
functions must no longer be hidden behind an #ifdef:

In file included from include/linux/clk.h:13,
from drivers/rtc/rtc-stm32.c:8:
drivers/rtc/rtc-stm32.c:927:39: error: 'stm32_rtc_suspend' undeclared here (not in a function); did you mean 'stm32_rtc_probe'?
927 | SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(stm32_rtc_suspend, stm32_rtc_resume)
| ^~~~~~~~~~~~~~~~~
include/linux/kernel.h:58:44: note: in definition of macro 'PTR_IF'
58 | #define PTR_IF(cond, ptr) ((cond) ? (ptr) : NULL)
| ^~~
include/linux/pm.h:329:26: note: in expansion of macro 'pm_sleep_ptr'
329 | .suspend_noirq = pm_sleep_ptr(suspend_fn), \
| ^~~~~~~~~~~~

Fixes: fb9a7e5360dc8 ("rtc: stm32: change PM callbacks to "_noirq()"")
Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/rtc/rtc-stm32.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c
index 85689192fa7ae..c296e7af0700c 100644
--- a/drivers/rtc/rtc-stm32.c
+++ b/drivers/rtc/rtc-stm32.c
@@ -890,7 +890,6 @@ static void stm32_rtc_remove(struct platform_device *pdev)
device_init_wakeup(&pdev->dev, false);
}

-#ifdef CONFIG_PM_SLEEP
static int stm32_rtc_suspend(struct device *dev)
{
struct stm32_rtc *rtc = dev_get_drvdata(dev);
@@ -921,7 +920,6 @@ static int stm32_rtc_resume(struct device *dev)

return ret;
}
-#endif

static const struct dev_pm_ops stm32_rtc_pm_ops = {
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(stm32_rtc_suspend, stm32_rtc_resume)
--
2.39.2



2023-08-01 15:21:24

by Valentin Caron

[permalink] [raw]
Subject: Re: [PATCH] rtc: stm32: remove incorrect #ifdef check

Hi Arnd,

Thanks for your patch !

On 8/1/23 12:59, Arnd Bergmann wrote:
> From: Arnd Bergmann <[email protected]>
>
> After a previous commit changed the driver over to
> SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(), the suspend/resume
> functions must no longer be hidden behind an #ifdef:
>
> In file included from include/linux/clk.h:13,
> from drivers/rtc/rtc-stm32.c:8:
> drivers/rtc/rtc-stm32.c:927:39: error: 'stm32_rtc_suspend' undeclared here (not in a function); did you mean 'stm32_rtc_probe'?
> 927 | SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(stm32_rtc_suspend, stm32_rtc_resume)
> | ^~~~~~~~~~~~~~~~~
> include/linux/kernel.h:58:44: note: in definition of macro 'PTR_IF'
> 58 | #define PTR_IF(cond, ptr) ((cond) ? (ptr) : NULL)
> | ^~~
> include/linux/pm.h:329:26: note: in expansion of macro 'pm_sleep_ptr'
> 329 | .suspend_noirq = pm_sleep_ptr(suspend_fn), \
> | ^~~~~~~~~~~~
>
> Fixes: fb9a7e5360dc8 ("rtc: stm32: change PM callbacks to "_noirq()"")
> Signed-off-by: Arnd Bergmann <[email protected]>
Reviewed-by: Valentin Caron <[email protected]>
> ---
> drivers/rtc/rtc-stm32.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c
> index 85689192fa7ae..c296e7af0700c 100644
> --- a/drivers/rtc/rtc-stm32.c
> +++ b/drivers/rtc/rtc-stm32.c
> @@ -890,7 +890,6 @@ static void stm32_rtc_remove(struct platform_device *pdev)
> device_init_wakeup(&pdev->dev, false);
> }
>
> -#ifdef CONFIG_PM_SLEEP
> static int stm32_rtc_suspend(struct device *dev)
> {
> struct stm32_rtc *rtc = dev_get_drvdata(dev);
> @@ -921,7 +920,6 @@ static int stm32_rtc_resume(struct device *dev)
>
> return ret;
> }
> -#endif
>
> static const struct dev_pm_ops stm32_rtc_pm_ops = {
> SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(stm32_rtc_suspend, stm32_rtc_resume)

2023-08-09 18:09:50

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] rtc: stm32: remove incorrect #ifdef check

Hi Arnd,

kernel test robot noticed the following build warnings:

[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on atorgue-stm32/stm32-next soc/for-next linus/master v6.5-rc5 next-20230809]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Arnd-Bergmann/rtc-stm32-remove-incorrect-ifdef-check/20230801-190951
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
patch link: https://lore.kernel.org/r/20230801105932.3738430-1-arnd%40kernel.org
patch subject: [PATCH] rtc: stm32: remove incorrect #ifdef check
config: x86_64-buildonly-randconfig-r003-20230809 (https://download.01.org/0day-ci/archive/20230810/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230810/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> drivers/rtc/rtc-stm32.c:903:12: warning: 'stm32_rtc_resume' defined but not used [-Wunused-function]
903 | static int stm32_rtc_resume(struct device *dev)
| ^~~~~~~~~~~~~~~~
>> drivers/rtc/rtc-stm32.c:893:12: warning: 'stm32_rtc_suspend' defined but not used [-Wunused-function]
893 | static int stm32_rtc_suspend(struct device *dev)
| ^~~~~~~~~~~~~~~~~


vim +/stm32_rtc_resume +903 drivers/rtc/rtc-stm32.c

4e64350f42e2ce Amelie Delaunay 2017-01-11 892
4e64350f42e2ce Amelie Delaunay 2017-01-11 @893 static int stm32_rtc_suspend(struct device *dev)
4e64350f42e2ce Amelie Delaunay 2017-01-11 894 {
4e64350f42e2ce Amelie Delaunay 2017-01-11 895 struct stm32_rtc *rtc = dev_get_drvdata(dev);
4e64350f42e2ce Amelie Delaunay 2017-01-11 896
9a6757eadc14f0 Amelie Delaunay 2017-07-06 897 if (rtc->data->has_pclk)
9a6757eadc14f0 Amelie Delaunay 2017-07-06 898 clk_disable_unprepare(rtc->pclk);
9a6757eadc14f0 Amelie Delaunay 2017-07-06 899
4e64350f42e2ce Amelie Delaunay 2017-01-11 900 return 0;
4e64350f42e2ce Amelie Delaunay 2017-01-11 901 }
4e64350f42e2ce Amelie Delaunay 2017-01-11 902
4e64350f42e2ce Amelie Delaunay 2017-01-11 @903 static int stm32_rtc_resume(struct device *dev)
4e64350f42e2ce Amelie Delaunay 2017-01-11 904 {
4e64350f42e2ce Amelie Delaunay 2017-01-11 905 struct stm32_rtc *rtc = dev_get_drvdata(dev);
4e64350f42e2ce Amelie Delaunay 2017-01-11 906 int ret = 0;
4e64350f42e2ce Amelie Delaunay 2017-01-11 907
9a6757eadc14f0 Amelie Delaunay 2017-07-06 908 if (rtc->data->has_pclk) {
9a6757eadc14f0 Amelie Delaunay 2017-07-06 909 ret = clk_prepare_enable(rtc->pclk);
9a6757eadc14f0 Amelie Delaunay 2017-07-06 910 if (ret)
9a6757eadc14f0 Amelie Delaunay 2017-07-06 911 return ret;
9a6757eadc14f0 Amelie Delaunay 2017-07-06 912 }
9a6757eadc14f0 Amelie Delaunay 2017-07-06 913
4e64350f42e2ce Amelie Delaunay 2017-01-11 914 ret = stm32_rtc_wait_sync(rtc);
cf33e911f500f6 Chuhong Yuan 2019-12-06 915 if (ret < 0) {
cf33e911f500f6 Chuhong Yuan 2019-12-06 916 if (rtc->data->has_pclk)
cf33e911f500f6 Chuhong Yuan 2019-12-06 917 clk_disable_unprepare(rtc->pclk);
4e64350f42e2ce Amelie Delaunay 2017-01-11 918 return ret;
cf33e911f500f6 Chuhong Yuan 2019-12-06 919 }
4e64350f42e2ce Amelie Delaunay 2017-01-11 920
4e64350f42e2ce Amelie Delaunay 2017-01-11 921 return ret;
4e64350f42e2ce Amelie Delaunay 2017-01-11 922 }
4e64350f42e2ce Amelie Delaunay 2017-01-11 923

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2023-08-09 18:43:47

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] rtc: stm32: remove incorrect #ifdef check

On Wed, Aug 9, 2023, at 18:36, kernel test robot wrote:
>
>
> If you fix the issue in a separate patch/commit (i.e. not just a new
> version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <[email protected]>
> | Closes:
> https://lore.kernel.org/oe-kbuild-all/[email protected]/
>
> All warnings (new ones prefixed by >>):
>
>>> drivers/rtc/rtc-stm32.c:903:12: warning: 'stm32_rtc_resume' defined but not used [-Wunused-function]
> 903 | static int stm32_rtc_resume(struct device *dev)
> | ^~~~~~~~~~~~~~~~
>>> drivers/rtc/rtc-stm32.c:893:12: warning: 'stm32_rtc_suspend' defined but not used [-Wunused-function]
> 893 | static int stm32_rtc_suspend(struct device *dev)
> | ^~~~~~~~~~~~~~~~~

This is the warning you get if my patch is applied but the
fb9a7e5360dc8 ("rtc: stm32: change PM callbacks to "_noirq()"")
commit is not. If that patch is applied, mine is needed to address
the other warning.

Arnd

2023-08-10 08:10:22

by Alexandre Belloni

[permalink] [raw]
Subject: Re: [PATCH] rtc: stm32: remove incorrect #ifdef check


On Tue, 01 Aug 2023 12:59:15 +0200, Arnd Bergmann wrote:
> After a previous commit changed the driver over to
> SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(), the suspend/resume
> functions must no longer be hidden behind an #ifdef:
>
> In file included from include/linux/clk.h:13,
> from drivers/rtc/rtc-stm32.c:8:
> drivers/rtc/rtc-stm32.c:927:39: error: 'stm32_rtc_suspend' undeclared here (not in a function); did you mean 'stm32_rtc_probe'?
> 927 | SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(stm32_rtc_suspend, stm32_rtc_resume)
> | ^~~~~~~~~~~~~~~~~
> include/linux/kernel.h:58:44: note: in definition of macro 'PTR_IF'
> 58 | #define PTR_IF(cond, ptr) ((cond) ? (ptr) : NULL)
> | ^~~
> include/linux/pm.h:329:26: note: in expansion of macro 'pm_sleep_ptr'
> 329 | .suspend_noirq = pm_sleep_ptr(suspend_fn), \
> | ^~~~~~~~~~~~
>
> [...]

Applied, thanks!

[1/1] rtc: stm32: remove incorrect #ifdef check
commit: a69c610e13e2b2de8a1ed2683f13e21b3200bd7a

Best regards,

--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

2023-08-17 00:18:54

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] rtc: stm32: remove incorrect #ifdef check

Hi Arnd,

On Wed, Aug 9, 2023 at 8:26 PM Arnd Bergmann <[email protected]> wrote:
> On Wed, Aug 9, 2023, at 18:36, kernel test robot wrote:
> > If you fix the issue in a separate patch/commit (i.e. not just a new
> > version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <[email protected]>
> > | Closes:
> > https://lore.kernel.org/oe-kbuild-all/[email protected]/
> >
> > All warnings (new ones prefixed by >>):
> >
> >>> drivers/rtc/rtc-stm32.c:903:12: warning: 'stm32_rtc_resume' defined but not used [-Wunused-function]
> > 903 | static int stm32_rtc_resume(struct device *dev)
> > | ^~~~~~~~~~~~~~~~
> >>> drivers/rtc/rtc-stm32.c:893:12: warning: 'stm32_rtc_suspend' defined but not used [-Wunused-function]
> > 893 | static int stm32_rtc_suspend(struct device *dev)
> > | ^~~~~~~~~~~~~~~~~
>
> This is the warning you get if my patch is applied but the
> fb9a7e5360dc8 ("rtc: stm32: change PM callbacks to "_noirq()"")
> commit is not. If that patch is applied, mine is needed to address
> the other warning.

Although both are now in linux-next, kisskb reported for m68k/allmodconfig:

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)
| ^~~~~~~~~~~~~~~~~

Seems like you missed that the driver uses the old
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() instead of the new
NOIRQ_SYSTEM_SLEEP_PM_OPS().

Patch sent.
https://lore.kernel.org/r/[email protected]

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds