diff mbox series

rtc: stm32: remove incorrect #ifdef check

Message ID 20230801105932.3738430-1-arnd@kernel.org (mailing list archive)
State New, archived
Headers show
Series rtc: stm32: remove incorrect #ifdef check | expand

Commit Message

Arnd Bergmann Aug. 1, 2023, 10:59 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

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 <arnd@arndb.de>
---
 drivers/rtc/rtc-stm32.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Valentin Caron Aug. 1, 2023, 1:55 p.m. UTC | #1
Hi Arnd,

Thanks for your patch !

On 8/1/23 12:59, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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 <arnd@arndb.de>
Reviewed-by: Valentin Caron <valentin.caron@foss.st.com>
> ---
>   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)
kernel test robot Aug. 9, 2023, 4:36 p.m. UTC | #2
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/202308100045.WeVD1ttk-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230810/202308100045.WeVD1ttk-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308100045.WeVD1ttk-lkp@intel.com/

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
Arnd Bergmann Aug. 9, 2023, 6:24 p.m. UTC | #3
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 <lkp@intel.com>
> | Closes: 
> https://lore.kernel.org/oe-kbuild-all/202308100045.WeVD1ttk-lkp@intel.com/
>
> 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
Alexandre Belloni Aug. 10, 2023, 7:22 a.m. UTC | #4
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,
Geert Uytterhoeven Aug. 16, 2023, 11:35 a.m. UTC | #5
Hi Arnd,

On Wed, Aug 9, 2023 at 8:26 PM Arnd Bergmann <arnd@arndb.de> 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 <lkp@intel.com>
> > | Closes:
> > https://lore.kernel.org/oe-kbuild-all/202308100045.WeVD1ttk-lkp@intel.com/
> >
> > 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/20230816113326.1468435-1-geert@linux-m68k.org

Gr{oetje,eeting}s,

                        Geert
diff mbox series

Patch

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)