diff mbox series

[6/6] spi: st: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()

Message ID 20241229-update_pm_macro-v1-6-c7d4c4856336@gmail.com (mailing list archive)
State New
Headers show
Series Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() | expand

Commit Message

Raphael Gallais-Pou Dec. 28, 2024, 11:32 p.m. UTC
Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Link: https://lore.kernel.org/all/20240716180010.126987-1-rgallaispou@gmail.com
Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
 drivers/spi/spi-st-ssc4.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

kernel test robot Dec. 29, 2024, 1:28 a.m. UTC | #1
Hi Raphael,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 8155b4ef3466f0e289e8fcc9e6e62f3f4dceeac2]

url:    https://github.com/intel-lab-lkp/linux/commits/Raphael-Gallais-Pou/usb-dwc3-st-Switch-from-CONFIG_PM_SLEEP-guards-to-pm_sleep_ptr/20241229-073700
base:   8155b4ef3466f0e289e8fcc9e6e62f3f4dceeac2
patch link:    https://lore.kernel.org/r/20241229-update_pm_macro-v1-6-c7d4c4856336%40gmail.com
patch subject: [PATCH 6/6] spi: st: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
config: arm-randconfig-002-20241229 (https://download.01.org/0day-ci/archive/20241229/202412290921.tY3nJMjm-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241229/202412290921.tY3nJMjm-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/202412290921.tY3nJMjm-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/spi/spi-st-ssc4.c:418:12: warning: 'spi_st_resume' defined but not used [-Wunused-function]
     418 | static int spi_st_resume(struct device *dev)
         |            ^~~~~~~~~~~~~
>> drivers/spi/spi-st-ssc4.c:406:12: warning: 'spi_st_suspend' defined but not used [-Wunused-function]
     406 | static int spi_st_suspend(struct device *dev)
         |            ^~~~~~~~~~~~~~


vim +/spi_st_resume +418 drivers/spi/spi-st-ssc4.c

9e862375c5420a Lee Jones      2014-12-09  405  
9e862375c5420a Lee Jones      2014-12-09 @406  static int spi_st_suspend(struct device *dev)
9e862375c5420a Lee Jones      2014-12-09  407  {
e6b7e64cb11966 Yang Yingliang 2023-11-28  408  	struct spi_controller *host = dev_get_drvdata(dev);
9e862375c5420a Lee Jones      2014-12-09  409  	int ret;
9e862375c5420a Lee Jones      2014-12-09  410  
e6b7e64cb11966 Yang Yingliang 2023-11-28  411  	ret = spi_controller_suspend(host);
9e862375c5420a Lee Jones      2014-12-09  412  	if (ret)
9e862375c5420a Lee Jones      2014-12-09  413  		return ret;
9e862375c5420a Lee Jones      2014-12-09  414  
9e862375c5420a Lee Jones      2014-12-09  415  	return pm_runtime_force_suspend(dev);
9e862375c5420a Lee Jones      2014-12-09  416  }
9e862375c5420a Lee Jones      2014-12-09  417  
9e862375c5420a Lee Jones      2014-12-09 @418  static int spi_st_resume(struct device *dev)
9e862375c5420a Lee Jones      2014-12-09  419  {
e6b7e64cb11966 Yang Yingliang 2023-11-28  420  	struct spi_controller *host = dev_get_drvdata(dev);
9e862375c5420a Lee Jones      2014-12-09  421  	int ret;
9e862375c5420a Lee Jones      2014-12-09  422  
e6b7e64cb11966 Yang Yingliang 2023-11-28  423  	ret = spi_controller_resume(host);
9e862375c5420a Lee Jones      2014-12-09  424  	if (ret)
9e862375c5420a Lee Jones      2014-12-09  425  		return ret;
9e862375c5420a Lee Jones      2014-12-09  426  
9e862375c5420a Lee Jones      2014-12-09  427  	return pm_runtime_force_resume(dev);
9e862375c5420a Lee Jones      2014-12-09  428  }
9e862375c5420a Lee Jones      2014-12-09  429
diff mbox series

Patch

diff --git a/drivers/spi/spi-st-ssc4.c b/drivers/spi/spi-st-ssc4.c
index 4cff976ab16fbdf3708ab870176a04f2628b501b..5cc452447410bedf3c12893d94bc959892ac827d 100644
--- a/drivers/spi/spi-st-ssc4.c
+++ b/drivers/spi/spi-st-ssc4.c
@@ -378,7 +378,6 @@  static void spi_st_remove(struct platform_device *pdev)
 	pinctrl_pm_select_sleep_state(&pdev->dev);
 }
 
-#ifdef CONFIG_PM
 static int spi_st_runtime_suspend(struct device *dev)
 {
 	struct spi_controller *host = dev_get_drvdata(dev);
@@ -403,9 +402,7 @@  static int spi_st_runtime_resume(struct device *dev)
 
 	return ret;
 }
-#endif
 
-#ifdef CONFIG_PM_SLEEP
 static int spi_st_suspend(struct device *dev)
 {
 	struct spi_controller *host = dev_get_drvdata(dev);
@@ -429,7 +426,6 @@  static int spi_st_resume(struct device *dev)
 
 	return pm_runtime_force_resume(dev);
 }
-#endif
 
 static const struct dev_pm_ops spi_st_pm = {
 	SET_SYSTEM_SLEEP_PM_OPS(spi_st_suspend, spi_st_resume)
@@ -445,7 +441,7 @@  MODULE_DEVICE_TABLE(of, stm_spi_match);
 static struct platform_driver spi_st_driver = {
 	.driver = {
 		.name = "spi-st",
-		.pm = &spi_st_pm,
+		.pm = pm_sleep_ptr(&spi_st_pm),
 		.of_match_table = of_match_ptr(stm_spi_match),
 	},
 	.probe = spi_st_probe,