diff mbox series

[v1] PM: Discard runtime_xx() handles using pm_ptr()

Message ID 20250220080318.2660840-1-raag.jadav@intel.com (mailing list archive)
State Not Applicable, archived
Headers show
Series [v1] PM: Discard runtime_xx() handles using pm_ptr() | expand

Commit Message

Raag Jadav Feb. 20, 2025, 8:03 a.m. UTC
Discard runtime_xx() handles in RUNTIME_PM_OPS() using pm_ptr() macro
and drop unnecessary CONFIG_PM ifdeffery.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
---
PS: I'm not very confident about this but thought I'd give it a try.

 include/linux/pm.h | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

kernel test robot Feb. 20, 2025, 10:35 a.m. UTC | #1
Hi Raag,

kernel test robot noticed the following build errors:

[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on rafael-pm/bleeding-edge linus/master v6.14-rc3 next-20250220]
[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/Raag-Jadav/PM-Discard-runtime_xx-handles-using-pm_ptr/20250220-160636
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20250220080318.2660840-1-raag.jadav%40intel.com
patch subject: [PATCH v1] PM: Discard runtime_xx() handles using pm_ptr()
config: s390-randconfig-002-20250220 (https://download.01.org/0day-ci/archive/20250220/202502201807.2UYZnMAp-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250220/202502201807.2UYZnMAp-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/202502201807.2UYZnMAp-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from include/linux/cpumask.h:11,
                    from arch/s390/include/asm/processor.h:31,
                    from include/linux/sched.h:13,
                    from include/linux/delay.h:13,
                    from drivers/greybus/interface.c:9:
>> drivers/greybus/interface.c:764:28: error: 'gb_interface_suspend' undeclared here (not in a function); did you mean 'gb_interface_type'?
     764 |         SET_RUNTIME_PM_OPS(gb_interface_suspend, gb_interface_resume,
         |                            ^~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:337:28: note: in expansion of macro 'pm_ptr'
     337 |         .runtime_suspend = pm_ptr(suspend_fn), \
         |                            ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/greybus/interface.c:764:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     764 |         SET_RUNTIME_PM_OPS(gb_interface_suspend, gb_interface_resume,
         |         ^~~~~~~~~~~~~~~~~~
>> drivers/greybus/interface.c:764:50: error: 'gb_interface_resume' undeclared here (not in a function); did you mean 'gb_interface_release'?
     764 |         SET_RUNTIME_PM_OPS(gb_interface_suspend, gb_interface_resume,
         |                                                  ^~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:338:27: note: in expansion of macro 'pm_ptr'
     338 |         .runtime_resume = pm_ptr(resume_fn), \
         |                           ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/greybus/interface.c:764:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     764 |         SET_RUNTIME_PM_OPS(gb_interface_suspend, gb_interface_resume,
         |         ^~~~~~~~~~~~~~~~~~
>> drivers/greybus/interface.c:765:28: error: 'gb_interface_runtime_idle' undeclared here (not in a function); did you mean 'gb_interface_read_dme'?
     765 |                            gb_interface_runtime_idle)
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:339:25: note: in expansion of macro 'pm_ptr'
     339 |         .runtime_idle = pm_ptr(idle_fn),
         |                         ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/greybus/interface.c:764:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     764 |         SET_RUNTIME_PM_OPS(gb_interface_suspend, gb_interface_resume,
         |         ^~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/greybus.h:14,
                    from drivers/greybus/bundle.c:9:
>> drivers/greybus/bundle.c:166:28: error: 'gb_bundle_suspend' undeclared here (not in a function); did you mean 'gb_bundle_find'?
     166 |         SET_RUNTIME_PM_OPS(gb_bundle_suspend, gb_bundle_resume, gb_bundle_idle)
         |                            ^~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:337:28: note: in expansion of macro 'pm_ptr'
     337 |         .runtime_suspend = pm_ptr(suspend_fn), \
         |                            ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/greybus/bundle.c:166:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     166 |         SET_RUNTIME_PM_OPS(gb_bundle_suspend, gb_bundle_resume, gb_bundle_idle)
         |         ^~~~~~~~~~~~~~~~~~
>> drivers/greybus/bundle.c:166:47: error: 'gb_bundle_resume' undeclared here (not in a function); did you mean 'gb_bundle_release'?
     166 |         SET_RUNTIME_PM_OPS(gb_bundle_suspend, gb_bundle_resume, gb_bundle_idle)
         |                                               ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:338:27: note: in expansion of macro 'pm_ptr'
     338 |         .runtime_resume = pm_ptr(resume_fn), \
         |                           ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/greybus/bundle.c:166:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     166 |         SET_RUNTIME_PM_OPS(gb_bundle_suspend, gb_bundle_resume, gb_bundle_idle)
         |         ^~~~~~~~~~~~~~~~~~
>> drivers/greybus/bundle.c:166:65: error: 'gb_bundle_idle' undeclared here (not in a function); did you mean 'gb_bundle_add'?
     166 |         SET_RUNTIME_PM_OPS(gb_bundle_suspend, gb_bundle_resume, gb_bundle_idle)
         |                                                                 ^~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:339:25: note: in expansion of macro 'pm_ptr'
     339 |         .runtime_idle = pm_ptr(idle_fn),
         |                         ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/greybus/bundle.c:166:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     166 |         SET_RUNTIME_PM_OPS(gb_bundle_suspend, gb_bundle_resume, gb_bundle_idle)
         |         ^~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/cpumask.h:11,
                    from include/linux/smp.h:13,
                    from include/linux/lockdep.h:14,
                    from include/linux/mutex.h:17,
                    from include/linux/kernfs.h:11,
                    from include/linux/sysfs.h:16,
                    from include/linux/kobject.h:20,
                    from include/linux/cdev.h:5,
                    from include/linux/gnss.h:11,
                    from drivers/gnss/serial.c:9:
>> drivers/gnss/serial.c:270:28: error: 'gnss_serial_runtime_suspend' undeclared here (not in a function); did you mean 'pm_generic_runtime_suspend'?
     270 |         SET_RUNTIME_PM_OPS(gnss_serial_runtime_suspend, gnss_serial_runtime_resume, NULL)
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:337:28: note: in expansion of macro 'pm_ptr'
     337 |         .runtime_suspend = pm_ptr(suspend_fn), \
         |                            ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/gnss/serial.c:270:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     270 |         SET_RUNTIME_PM_OPS(gnss_serial_runtime_suspend, gnss_serial_runtime_resume, NULL)
         |         ^~~~~~~~~~~~~~~~~~
>> drivers/gnss/serial.c:270:57: error: 'gnss_serial_runtime_resume' undeclared here (not in a function); did you mean 'pm_generic_runtime_resume'?
     270 |         SET_RUNTIME_PM_OPS(gnss_serial_runtime_suspend, gnss_serial_runtime_resume, NULL)
         |                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:338:27: note: in expansion of macro 'pm_ptr'
     338 |         .runtime_resume = pm_ptr(resume_fn), \
         |                           ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/gnss/serial.c:270:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     270 |         SET_RUNTIME_PM_OPS(gnss_serial_runtime_suspend, gnss_serial_runtime_resume, NULL)
         |         ^~~~~~~~~~~~~~~~~~
--
   In file included from drivers/misc/apds990x.c:11:
>> drivers/misc/apds990x.c:1266:28: error: 'apds990x_runtime_suspend' undeclared here (not in a function); did you mean 'pm_runtime_suspend'?
    1266 |         SET_RUNTIME_PM_OPS(apds990x_runtime_suspend,
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:337:28: note: in expansion of macro 'pm_ptr'
     337 |         .runtime_suspend = pm_ptr(suspend_fn), \
         |                            ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/misc/apds990x.c:1266:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
    1266 |         SET_RUNTIME_PM_OPS(apds990x_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
>> drivers/misc/apds990x.c:1267:25: error: 'apds990x_runtime_resume' undeclared here (not in a function); did you mean 'pm_runtime_resume'?
    1267 |                         apds990x_runtime_resume,
         |                         ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:338:27: note: in expansion of macro 'pm_ptr'
     338 |         .runtime_resume = pm_ptr(resume_fn), \
         |                           ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/misc/apds990x.c:1266:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
    1266 |         SET_RUNTIME_PM_OPS(apds990x_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
--
   In file included from drivers/misc/bh1770glc.c:11:
>> drivers/misc/bh1770glc.c:1373:28: error: 'bh1770_runtime_suspend' undeclared here (not in a function); did you mean 'pm_runtime_suspend'?
    1373 |         SET_RUNTIME_PM_OPS(bh1770_runtime_suspend, bh1770_runtime_resume, NULL)
         |                            ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:337:28: note: in expansion of macro 'pm_ptr'
     337 |         .runtime_suspend = pm_ptr(suspend_fn), \
         |                            ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/misc/bh1770glc.c:1373:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
    1373 |         SET_RUNTIME_PM_OPS(bh1770_runtime_suspend, bh1770_runtime_resume, NULL)
         |         ^~~~~~~~~~~~~~~~~~
>> drivers/misc/bh1770glc.c:1373:52: error: 'bh1770_runtime_resume' undeclared here (not in a function); did you mean 'pm_runtime_resume'?
    1373 |         SET_RUNTIME_PM_OPS(bh1770_runtime_suspend, bh1770_runtime_resume, NULL)
         |                                                    ^~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:338:27: note: in expansion of macro 'pm_ptr'
     338 |         .runtime_resume = pm_ptr(resume_fn), \
         |                           ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/misc/bh1770glc.c:1373:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
    1373 |         SET_RUNTIME_PM_OPS(bh1770_runtime_suspend, bh1770_runtime_resume, NULL)
         |         ^~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/cpumask.h:11,
                    from include/linux/smp.h:13,
                    from include/linux/lockdep.h:14,
                    from include/linux/spinlock.h:63,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:7,
                    from include/linux/umh.h:4,
                    from include/linux/kmod.h:9,
                    from include/linux/module.h:17,
                    from drivers/iio/accel/bmc150-accel-core.c:7:
>> drivers/iio/accel/bmc150-accel-core.c:1858:28: error: 'bmc150_accel_runtime_suspend' undeclared here (not in a function); did you mean 'bmc150_accel_update_slope'?
    1858 |         SET_RUNTIME_PM_OPS(bmc150_accel_runtime_suspend,
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:337:28: note: in expansion of macro 'pm_ptr'
     337 |         .runtime_suspend = pm_ptr(suspend_fn), \
         |                            ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/iio/accel/bmc150-accel-core.c:1858:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
    1858 |         SET_RUNTIME_PM_OPS(bmc150_accel_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
>> drivers/iio/accel/bmc150-accel-core.c:1859:28: error: 'bmc150_accel_runtime_resume' undeclared here (not in a function); did you mean 'bmc150_accel_core_remove'?
    1859 |                            bmc150_accel_runtime_resume, NULL)
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:338:27: note: in expansion of macro 'pm_ptr'
     338 |         .runtime_resume = pm_ptr(resume_fn), \
         |                           ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/iio/accel/bmc150-accel-core.c:1858:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
    1858 |         SET_RUNTIME_PM_OPS(bmc150_accel_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/cpumask.h:11,
                    from include/linux/smp.h:13,
                    from include/linux/lockdep.h:14,
                    from include/linux/spinlock.h:63,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:7,
                    from include/linux/umh.h:4,
                    from include/linux/kmod.h:9,
                    from include/linux/module.h:17,
                    from drivers/iio/accel/mma8452.c:21:
>> drivers/iio/accel/mma8452.c:1823:28: error: 'mma8452_runtime_suspend' undeclared here (not in a function); did you mean 'pm_runtime_suspend'?
    1823 |         SET_RUNTIME_PM_OPS(mma8452_runtime_suspend,
         |                            ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:337:28: note: in expansion of macro 'pm_ptr'
     337 |         .runtime_suspend = pm_ptr(suspend_fn), \
         |                            ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/iio/accel/mma8452.c:1823:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
    1823 |         SET_RUNTIME_PM_OPS(mma8452_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
>> drivers/iio/accel/mma8452.c:1824:28: error: 'mma8452_runtime_resume' undeclared here (not in a function); did you mean 'pm_runtime_resume'?
    1824 |                            mma8452_runtime_resume, NULL)
         |                            ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:338:27: note: in expansion of macro 'pm_ptr'
     338 |         .runtime_resume = pm_ptr(resume_fn), \
         |                           ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/iio/accel/mma8452.c:1823:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
    1823 |         SET_RUNTIME_PM_OPS(mma8452_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/cpumask.h:11,
                    from include/linux/smp.h:13,
                    from include/linux/lockdep.h:14,
                    from include/linux/spinlock.h:63,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:7,
                    from include/linux/umh.h:4,
                    from include/linux/kmod.h:9,
                    from include/linux/module.h:17,
                    from drivers/iio/magnetometer/bmc150_magn.c:12:
>> drivers/iio/magnetometer/bmc150_magn.c:1062:28: error: 'bmc150_magn_runtime_suspend' undeclared here (not in a function)
    1062 |         SET_RUNTIME_PM_OPS(bmc150_magn_runtime_suspend,
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:337:28: note: in expansion of macro 'pm_ptr'
     337 |         .runtime_suspend = pm_ptr(suspend_fn), \
         |                            ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/iio/magnetometer/bmc150_magn.c:1062:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
    1062 |         SET_RUNTIME_PM_OPS(bmc150_magn_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
>> drivers/iio/magnetometer/bmc150_magn.c:1063:28: error: 'bmc150_magn_runtime_resume' undeclared here (not in a function); did you mean 'bmc150_magn_trim_regs'?
    1063 |                            bmc150_magn_runtime_resume, NULL)
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:338:27: note: in expansion of macro 'pm_ptr'
     338 |         .runtime_resume = pm_ptr(resume_fn), \
         |                           ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/iio/magnetometer/bmc150_magn.c:1062:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
    1062 |         SET_RUNTIME_PM_OPS(bmc150_magn_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
..


vim +764 drivers/greybus/interface.c

30a3bf7b30d86b drivers/staging/greybus/interface.c David Lin 2016-07-14  762  
30a3bf7b30d86b drivers/staging/greybus/interface.c David Lin 2016-07-14  763  static const struct dev_pm_ops gb_interface_pm_ops = {
30a3bf7b30d86b drivers/staging/greybus/interface.c David Lin 2016-07-14 @764  	SET_RUNTIME_PM_OPS(gb_interface_suspend, gb_interface_resume,
30a3bf7b30d86b drivers/staging/greybus/interface.c David Lin 2016-07-14 @765  			   gb_interface_runtime_idle)
30a3bf7b30d86b drivers/staging/greybus/interface.c David Lin 2016-07-14  766  };
30a3bf7b30d86b drivers/staging/greybus/interface.c David Lin 2016-07-14  767
kernel test robot Feb. 20, 2025, 11:27 a.m. UTC | #2
Hi Raag,

kernel test robot noticed the following build errors:

[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on rafael-pm/bleeding-edge linus/master v6.14-rc3 next-20250220]
[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/Raag-Jadav/PM-Discard-runtime_xx-handles-using-pm_ptr/20250220-160636
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20250220080318.2660840-1-raag.jadav%40intel.com
patch subject: [PATCH v1] PM: Discard runtime_xx() handles using pm_ptr()
config: sparc-randconfig-002-20250220 (https://download.01.org/0day-ci/archive/20250220/202502201907.xdsGS0fm-lkp@intel.com/config)
compiler: sparc-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250220/202502201907.xdsGS0fm-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/202502201907.xdsGS0fm-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from include/linux/cpumask.h:11,
                    from arch/sparc/include/asm/smp_32.h:15,
                    from arch/sparc/include/asm/smp.h:7,
                    from arch/sparc/include/asm/switch_to_32.h:5,
                    from arch/sparc/include/asm/switch_to.h:7,
                    from arch/sparc/include/asm/ptrace.h:120,
                    from arch/sparc/include/asm/thread_info_32.h:19,
                    from arch/sparc/include/asm/thread_info.h:7,
                    from include/linux/thread_info.h:60,
                    from include/asm-generic/preempt.h:5,
                    from ./arch/sparc/include/generated/asm/preempt.h:1,
                    from include/linux/preempt.h:79,
                    from include/linux/spinlock.h:56,
                    from include/linux/irq.h:14,
                    from drivers/slimbus/qcom-ctrl.c:6:
>> drivers/slimbus/qcom-ctrl.c:711:28: error: 'qcom_slim_runtime_suspend' undeclared here (not in a function); did you mean 'pm_runtime_suspend'?
     711 |                            qcom_slim_runtime_suspend,
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:337:28: note: in expansion of macro 'pm_ptr'
     337 |         .runtime_suspend = pm_ptr(suspend_fn), \
         |                            ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/slimbus/qcom-ctrl.c:710:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     710 |         SET_RUNTIME_PM_OPS(
         |         ^~~~~~~~~~~~~~~~~~
>> drivers/slimbus/qcom-ctrl.c:712:28: error: 'qcom_slim_runtime_resume' undeclared here (not in a function); did you mean 'pm_runtime_resume'?
     712 |                            qcom_slim_runtime_resume,
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:338:27: note: in expansion of macro 'pm_ptr'
     338 |         .runtime_resume = pm_ptr(resume_fn), \
         |                           ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/slimbus/qcom-ctrl.c:710:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     710 |         SET_RUNTIME_PM_OPS(
         |         ^~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/clk.h:13,
                    from drivers/spi/spi-amlogic-spifc-a1.c:11:
>> drivers/spi/spi-amlogic-spifc-a1.c:440:28: error: 'amlogic_spifc_a1_runtime_suspend' undeclared here (not in a function); did you mean 'amlogic_spifc_a1_fill_buffer'?
     440 |         SET_RUNTIME_PM_OPS(amlogic_spifc_a1_runtime_suspend,
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:337:28: note: in expansion of macro 'pm_ptr'
     337 |         .runtime_suspend = pm_ptr(suspend_fn), \
         |                            ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/spi/spi-amlogic-spifc-a1.c:440:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     440 |         SET_RUNTIME_PM_OPS(amlogic_spifc_a1_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
>> drivers/spi/spi-amlogic-spifc-a1.c:441:28: error: 'amlogic_spifc_a1_runtime_resume' undeclared here (not in a function); did you mean 'amlogic_spifc_a1_request'?
     441 |                            amlogic_spifc_a1_runtime_resume,
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:338:27: note: in expansion of macro 'pm_ptr'
     338 |         .runtime_resume = pm_ptr(resume_fn), \
         |                           ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/spi/spi-amlogic-spifc-a1.c:440:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     440 |         SET_RUNTIME_PM_OPS(amlogic_spifc_a1_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/clk.h:13,
                    from drivers/spi/spi-slave-mt27xx.c:4:
>> drivers/spi/spi-slave-mt27xx.c:548:28: error: 'mtk_spi_slave_runtime_suspend' undeclared here (not in a function); did you mean 'mtk_spi_slave_interrupt'?
     548 |         SET_RUNTIME_PM_OPS(mtk_spi_slave_runtime_suspend,
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:337:28: note: in expansion of macro 'pm_ptr'
     337 |         .runtime_suspend = pm_ptr(suspend_fn), \
         |                            ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/spi/spi-slave-mt27xx.c:548:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     548 |         SET_RUNTIME_PM_OPS(mtk_spi_slave_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
>> drivers/spi/spi-slave-mt27xx.c:549:28: error: 'mtk_spi_slave_runtime_resume' undeclared here (not in a function); did you mean 'mtk_spi_slave_interrupt'?
     549 |                            mtk_spi_slave_runtime_resume, NULL)
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:338:27: note: in expansion of macro 'pm_ptr'
     338 |         .runtime_resume = pm_ptr(resume_fn), \
         |                           ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/spi/spi-slave-mt27xx.c:548:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     548 |         SET_RUNTIME_PM_OPS(mtk_spi_slave_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/clk.h:13,
                    from drivers/spi/spi-meson-spifc.c:8:
>> drivers/spi/spi-meson-spifc.c:418:28: error: 'meson_spifc_runtime_suspend' undeclared here (not in a function); did you mean 'pm_generic_runtime_suspend'?
     418 |         SET_RUNTIME_PM_OPS(meson_spifc_runtime_suspend,
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:337:28: note: in expansion of macro 'pm_ptr'
     337 |         .runtime_suspend = pm_ptr(suspend_fn), \
         |                            ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/spi/spi-meson-spifc.c:418:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     418 |         SET_RUNTIME_PM_OPS(meson_spifc_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
>> drivers/spi/spi-meson-spifc.c:419:28: error: 'meson_spifc_runtime_resume' undeclared here (not in a function); did you mean 'pm_generic_runtime_resume'?
     419 |                            meson_spifc_runtime_resume,
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:338:27: note: in expansion of macro 'pm_ptr'
     338 |         .runtime_resume = pm_ptr(resume_fn), \
         |                           ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/spi/spi-meson-spifc.c:418:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     418 |         SET_RUNTIME_PM_OPS(meson_spifc_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/clk.h:13,
                    from drivers/spi/spi-s3c64xx.c:8:
>> drivers/spi/spi-s3c64xx.c:1507:28: error: 's3c64xx_spi_runtime_suspend' undeclared here (not in a function)
    1507 |         SET_RUNTIME_PM_OPS(s3c64xx_spi_runtime_suspend,
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:337:28: note: in expansion of macro 'pm_ptr'
     337 |         .runtime_suspend = pm_ptr(suspend_fn), \
         |                            ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/spi/spi-s3c64xx.c:1507:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
    1507 |         SET_RUNTIME_PM_OPS(s3c64xx_spi_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
>> drivers/spi/spi-s3c64xx.c:1508:28: error: 's3c64xx_spi_runtime_resume' undeclared here (not in a function)
    1508 |                            s3c64xx_spi_runtime_resume, NULL)
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:338:27: note: in expansion of macro 'pm_ptr'
     338 |         .runtime_resume = pm_ptr(resume_fn), \
         |                           ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/spi/spi-s3c64xx.c:1507:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
    1507 |         SET_RUNTIME_PM_OPS(s3c64xx_spi_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/clk.h:13,
                    from drivers/spi/spi-img-spfi.c:9:
>> drivers/spi/spi-img-spfi.c:741:28: error: 'img_spfi_runtime_suspend' undeclared here (not in a function); did you mean 'pm_runtime_suspend'?
     741 |         SET_RUNTIME_PM_OPS(img_spfi_runtime_suspend, img_spfi_runtime_resume,
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:337:28: note: in expansion of macro 'pm_ptr'
     337 |         .runtime_suspend = pm_ptr(suspend_fn), \
         |                            ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/spi/spi-img-spfi.c:741:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     741 |         SET_RUNTIME_PM_OPS(img_spfi_runtime_suspend, img_spfi_runtime_resume,
         |         ^~~~~~~~~~~~~~~~~~
>> drivers/spi/spi-img-spfi.c:741:54: error: 'img_spfi_runtime_resume' undeclared here (not in a function); did you mean 'pm_runtime_resume'?
     741 |         SET_RUNTIME_PM_OPS(img_spfi_runtime_suspend, img_spfi_runtime_resume,
         |                                                      ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:338:27: note: in expansion of macro 'pm_ptr'
     338 |         .runtime_resume = pm_ptr(resume_fn), \
         |                           ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/spi/spi-img-spfi.c:741:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     741 |         SET_RUNTIME_PM_OPS(img_spfi_runtime_suspend, img_spfi_runtime_resume,
         |         ^~~~~~~~~~~~~~~~~~
--
   In file included from drivers/spi/spi-dln2.c:8:
>> drivers/spi/spi-dln2.c:864:28: error: 'dln2_spi_runtime_suspend' undeclared here (not in a function); did you mean 'pm_runtime_suspend'?
     864 |         SET_RUNTIME_PM_OPS(dln2_spi_runtime_suspend,
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:337:28: note: in expansion of macro 'pm_ptr'
     337 |         .runtime_suspend = pm_ptr(suspend_fn), \
         |                            ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/spi/spi-dln2.c:864:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     864 |         SET_RUNTIME_PM_OPS(dln2_spi_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
>> drivers/spi/spi-dln2.c:865:28: error: 'dln2_spi_runtime_resume' undeclared here (not in a function); did you mean 'pm_runtime_resume'?
     865 |                            dln2_spi_runtime_resume, NULL)
         |                            ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:338:27: note: in expansion of macro 'pm_ptr'
     338 |         .runtime_resume = pm_ptr(resume_fn), \
         |                           ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/spi/spi-dln2.c:864:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     864 |         SET_RUNTIME_PM_OPS(dln2_spi_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/interrupt.h:6,
                    from drivers/spi/spi-orion.c:9:
>> drivers/spi/spi-orion.c:837:28: error: 'orion_spi_runtime_suspend' undeclared here (not in a function); did you mean 'pm_runtime_suspend'?
     837 |         SET_RUNTIME_PM_OPS(orion_spi_runtime_suspend,
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:337:28: note: in expansion of macro 'pm_ptr'
     337 |         .runtime_suspend = pm_ptr(suspend_fn), \
         |                            ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/spi/spi-orion.c:837:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     837 |         SET_RUNTIME_PM_OPS(orion_spi_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
>> drivers/spi/spi-orion.c:838:28: error: 'orion_spi_runtime_resume' undeclared here (not in a function); did you mean 'pm_runtime_resume'?
     838 |                            orion_spi_runtime_resume,
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:338:27: note: in expansion of macro 'pm_ptr'
     338 |         .runtime_resume = pm_ptr(resume_fn), \
         |                           ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/spi/spi-orion.c:837:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
     837 |         SET_RUNTIME_PM_OPS(orion_spi_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/clk.h:13,
                    from drivers/spi/spi-rockchip.c:7:
>> drivers/spi/spi-rockchip.c:1020:28: error: 'rockchip_spi_runtime_suspend' undeclared here (not in a function)
    1020 |         SET_RUNTIME_PM_OPS(rockchip_spi_runtime_suspend,
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:337:28: note: in expansion of macro 'pm_ptr'
     337 |         .runtime_suspend = pm_ptr(suspend_fn), \
         |                            ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/spi/spi-rockchip.c:1020:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
    1020 |         SET_RUNTIME_PM_OPS(rockchip_spi_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
>> drivers/spi/spi-rockchip.c:1021:28: error: 'rockchip_spi_runtime_resume' undeclared here (not in a function)
    1021 |                            rockchip_spi_runtime_resume, NULL)
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:48:44: note: in definition of macro 'PTR_IF'
      48 | #define PTR_IF(cond, ptr)       ((cond) ? (ptr) : NULL)
         |                                            ^~~
   include/linux/pm.h:338:27: note: in expansion of macro 'pm_ptr'
     338 |         .runtime_resume = pm_ptr(resume_fn), \
         |                           ^~~~~~
   include/linux/pm.h:363:9: note: in expansion of macro 'RUNTIME_PM_OPS'
     363 |         RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
         |         ^~~~~~~~~~~~~~
   drivers/spi/spi-rockchip.c:1020:9: note: in expansion of macro 'SET_RUNTIME_PM_OPS'
    1020 |         SET_RUNTIME_PM_OPS(rockchip_spi_runtime_suspend,
         |         ^~~~~~~~~~~~~~~~~~
..


vim +711 drivers/slimbus/qcom-ctrl.c

ad7fcbc308b050 Sagar Dharia 2017-12-11  707  
ad7fcbc308b050 Sagar Dharia 2017-12-11  708  static const struct dev_pm_ops qcom_slim_dev_pm_ops = {
ad7fcbc308b050 Sagar Dharia 2017-12-11  709  	SET_SYSTEM_SLEEP_PM_OPS(qcom_slim_suspend, qcom_slim_resume)
ad7fcbc308b050 Sagar Dharia 2017-12-11  710  	SET_RUNTIME_PM_OPS(
ad7fcbc308b050 Sagar Dharia 2017-12-11 @711  			   qcom_slim_runtime_suspend,
ad7fcbc308b050 Sagar Dharia 2017-12-11 @712  			   qcom_slim_runtime_resume,
ad7fcbc308b050 Sagar Dharia 2017-12-11  713  			   NULL
ad7fcbc308b050 Sagar Dharia 2017-12-11  714  	)
ad7fcbc308b050 Sagar Dharia 2017-12-11  715  };
ad7fcbc308b050 Sagar Dharia 2017-12-11  716
Paul Cercueil Feb. 20, 2025, 12:15 p.m. UTC | #3
Hi Raag,

Le jeudi 20 février 2025 à 13:33 +0530, Raag Jadav a écrit :
> Discard runtime_xx() handles in RUNTIME_PM_OPS() using pm_ptr() macro
> and drop unnecessary CONFIG_PM ifdeffery.

So the RUNTIME_PM_OPS() is newer and people should use that, but we're
not yet at the point where the older SET_RUNTIME_PM_OPS() macro can be
dropped.

The difference is that in the !CONFIG_PM case, the former will
reference the suspend/resume functions, but they will be detected as
dead code; on the other hand, the latter macro won't reference them at
all. Many drivers still wrap their suspend/resume functions in a #ifdef
CONFIG_PM to avoid warnings about unused static functions. Therefore if
you unconditionally force the use of the first macro everywhere, many
drivers will fail to compile in the !CONFIG_PM case.

As for adding pm_ptr() inside RUNTIME_PM_OPS(), it is unnecesary, as
the whole pm_ops struct should be referenced through pm_ptr() or
pm_sleep_ptr() anyway, which means that the whole struct and the
callback functions will be garbage-collected if PM is disabled.

Cheers,
-Paul

> Signed-off-by: Raag Jadav <raag.jadav@intel.com>
> ---
> PS: I'm not very confident about this but thought I'd give it a try.
> 
>  include/linux/pm.h | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/include/linux/pm.h b/include/linux/pm.h
> index 78855d794342..416561c60e81 100644
> --- a/include/linux/pm.h
> +++ b/include/linux/pm.h
> @@ -334,9 +334,9 @@ struct dev_pm_ops {
>  	.restore_noirq = pm_sleep_ptr(resume_fn),
>  
>  #define RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
> -	.runtime_suspend = suspend_fn, \
> -	.runtime_resume = resume_fn, \
> -	.runtime_idle = idle_fn,
> +	.runtime_suspend = pm_ptr(suspend_fn), \
> +	.runtime_resume = pm_ptr(resume_fn), \
> +	.runtime_idle = pm_ptr(idle_fn),
>  
>  #ifdef CONFIG_PM_SLEEP
>  #define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
> @@ -359,12 +359,8 @@ struct dev_pm_ops {
>  #define SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
>  #endif
>  
> -#ifdef CONFIG_PM
>  #define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
>  	RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
> -#else
> -#define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
> -#endif
>  
>  #define _DEFINE_DEV_PM_OPS(name, \
>  			   suspend_fn, resume_fn, \
Raag Jadav Feb. 20, 2025, 12:54 p.m. UTC | #4
On Thu, Feb 20, 2025 at 01:15:19PM +0100, Paul Cercueil wrote:
> Hi Raag,
> 
> Le jeudi 20 février 2025 à 13:33 +0530, Raag Jadav a écrit :
> > Discard runtime_xx() handles in RUNTIME_PM_OPS() using pm_ptr() macro
> > and drop unnecessary CONFIG_PM ifdeffery.
> 
> So the RUNTIME_PM_OPS() is newer and people should use that, but we're
> not yet at the point where the older SET_RUNTIME_PM_OPS() macro can be
> dropped.
> 
> The difference is that in the !CONFIG_PM case, the former will
> reference the suspend/resume functions, but they will be detected as
> dead code; on the other hand, the latter macro won't reference them at
> all. Many drivers still wrap their suspend/resume functions in a #ifdef
> CONFIG_PM to avoid warnings about unused static functions. Therefore if
> you unconditionally force the use of the first macro everywhere, many
> drivers will fail to compile in the !CONFIG_PM case.
> 
> As for adding pm_ptr() inside RUNTIME_PM_OPS(), it is unnecesary, as
> the whole pm_ops struct should be referenced through pm_ptr() or
> pm_sleep_ptr() anyway, which means that the whole struct and the
> callback functions will be garbage-collected if PM is disabled.

True. My intent was to garbage collect the runtime handles, atleast until
the users are converted to reference their struct pm_ops through it. I
didn't account for the driver wide CONFIG_PM ifdeffery though.

I guess pm.h has its own learning curve.

Raag
diff mbox series

Patch

diff --git a/include/linux/pm.h b/include/linux/pm.h
index 78855d794342..416561c60e81 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -334,9 +334,9 @@  struct dev_pm_ops {
 	.restore_noirq = pm_sleep_ptr(resume_fn),
 
 #define RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
-	.runtime_suspend = suspend_fn, \
-	.runtime_resume = resume_fn, \
-	.runtime_idle = idle_fn,
+	.runtime_suspend = pm_ptr(suspend_fn), \
+	.runtime_resume = pm_ptr(resume_fn), \
+	.runtime_idle = pm_ptr(idle_fn),
 
 #ifdef CONFIG_PM_SLEEP
 #define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
@@ -359,12 +359,8 @@  struct dev_pm_ops {
 #define SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
 #endif
 
-#ifdef CONFIG_PM
 #define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
 	RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
-#else
-#define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
-#endif
 
 #define _DEFINE_DEV_PM_OPS(name, \
 			   suspend_fn, resume_fn, \