Skip to contentSkip to conversation

rtc: stm32: remove incorrect #ifdef check

PATCH Applied Arnd Bergmann 6 participants 6 messages Aug 1, 2023 – Aug 16, 2023

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

PATCH 1/1 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()"")
---
 drivers/rtc/rtc-stm32.c | 2 --
 1 file changed, 2 deletions(-)
drivers/rtc/rtc-stm32.c +0 -2
index 85689192fa7ae..c296e7af0700c 100644
@@ -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)
Signature · 7 lines
2.39.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Reviewed-by on v1 1/1
#1 lore raw

Hi Arnd,

Thanks for your patch !

Quoted 18 lines · Arnd Bergmann

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), \
       |                          ^~~~~~~~~~~~
Quoted 2 lines
Fixes fb9a7e5360dc8 ("rtc: stm32: change PM callbacks to "_noirq()"")
Quoted 24 lines
---
  drivers/rtc/rtc-stm32.c | 2 --
  1 file changed, 2 deletions(-)
drivers/rtc/rtc-stm32.c +0 -2
index 85689192fa7ae..c296e7af0700c 100644
@@ -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 lore raw
In reply to Arnd Bergmann
kernel test robot noticed the following build warnings:

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  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#3 lore raw
Quoted 9 lines · kernel test robot

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]/

Quoted 8 lines

All warnings (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

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

Quoted 1 line
Quoted 1 line

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

#4 lore raw

Hi Arnd,

Quoted 13 lines · Arnd Bergmann
Quoted 12 lines · kernel test robot

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

Quoted 1 line
Quoted 1 line

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

Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

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

Signature · 5 lines
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
maintainer Applied
#5 lore raw
In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

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)
      |                                       ^~~~~~~~~~~~~~~~~
Quoted 8 lines

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,

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