Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH] PM: hibernate: Add stub for pm_hibernate_is_recovering()
@ 2025-07-12 18:58 Mario Limonciello
  2025-07-12 21:44 ` kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Mario Limonciello @ 2025-07-12 18:58 UTC (permalink / raw)
  To: mario.limonciello, rafael, len.brown, pavel, guoqing.zhang
  Cc: Randy Dunlap, linux-pm

From: Mario Limonciello <mario.limonciello@amd.com>

Randy reports that amdgpu fails to compile with the following error:
ERROR: modpost: "pm_hibernate_is_recovering" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!

This happens because pm_hibernate_is_recovering() is only compiled when
CONFIG_PM_SLEEP is set.  Add a stub for it so that drivers don't need
to depend upon CONFIG_PM.

Cc: Samuel Zhang <guoqing.zhang@amd.com>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Closes: https://lore.kernel.org/dri-devel/CAJZ5v0h1CX+aTu7dFy6vB-9LM6t5J4rt7Su3qVnq1xx-BFAm=Q@mail.gmail.com/T/#m2b9fe212b35fde11d58fcbc4e0727bc02ebba7b0
Fixes: c2aaddbd2dede ("PM: hibernate: add new api pm_hibernate_is_recovering()")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 include/linux/suspend.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 293137210fdf4..b4f1d1f781df6 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -401,6 +401,7 @@ int hibernate_quiet_exec(int (*func)(void *data), void *data);
 int hibernate_resume_nonboot_cpu_disable(void);
 int arch_hibernation_header_save(void *addr, unsigned int max_size);
 int arch_hibernation_header_restore(void *addr);
+bool pm_hibernate_is_recovering(void);
 
 #else /* CONFIG_HIBERNATION */
 static inline void register_nosave_region(unsigned long b, unsigned long e) {}
@@ -416,6 +417,7 @@ static inline bool hibernation_available(void) { return false; }
 static inline int hibernate_quiet_exec(int (*func)(void *data), void *data) {
 	return -ENOTSUPP;
 }
+static inline bool pm_hibernate_is_recovering(void) { return false; }
 #endif /* CONFIG_HIBERNATION */
 
 int arch_resume_nosmt(void);
@@ -426,7 +428,6 @@ int is_hibernate_resume_dev(dev_t dev);
 static inline int is_hibernate_resume_dev(dev_t dev) { return 0; }
 #endif
 
-bool pm_hibernate_is_recovering(void);
 
 /* Hibernation and suspend events */
 #define PM_HIBERNATION_PREPARE	0x0001 /* Going to hibernate */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] PM: hibernate: Add stub for pm_hibernate_is_recovering()
  2025-07-12 18:58 [PATCH] PM: hibernate: Add stub for pm_hibernate_is_recovering() Mario Limonciello
@ 2025-07-12 21:44 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2025-07-12 21:44 UTC (permalink / raw)
  To: Mario Limonciello, mario.limonciello, rafael, len.brown, pavel,
	guoqing.zhang
  Cc: oe-kbuild-all, Randy Dunlap, linux-pm

Hi Mario,

kernel test robot noticed the following build errors:

[auto build test ERROR on linux-next/master]
[cannot apply to linus/master v6.16-rc5]
[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/Mario-Limonciello/PM-hibernate-Add-stub-for-pm_hibernate_is_recovering/20250713-025938
base:   linux-next/master
patch link:    https://lore.kernel.org/r/20250712185851.591024-1-superm1%40kernel.org
patch subject: [PATCH] PM: hibernate: Add stub for pm_hibernate_is_recovering()
config: i386-buildonly-randconfig-003-20250713 (https://download.01.org/0day-ci/archive/20250713/202507130544.2Nxzh8Qg-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250713/202507130544.2Nxzh8Qg-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/202507130544.2Nxzh8Qg-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/base/power/main.c:77:6: error: redefinition of 'pm_hibernate_is_recovering'
      77 | bool pm_hibernate_is_recovering(void)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from drivers/base/power/main.c:32:
   include/linux/suspend.h:420:20: note: previous definition of 'pm_hibernate_is_recovering' with type 'bool(void)' {aka '_Bool(void)'}
     420 | static inline bool pm_hibernate_is_recovering(void) { return false; }
         |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/pm_hibernate_is_recovering +77 drivers/base/power/main.c

098dff738abbea Rafael J. Wysocki 2010-09-22  68  
c2aaddbd2deded Samuel Zhang      2025-07-10  69  /**
c2aaddbd2deded Samuel Zhang      2025-07-10  70   * pm_hibernate_is_recovering - if recovering from hibernate due to error.
c2aaddbd2deded Samuel Zhang      2025-07-10  71   *
c2aaddbd2deded Samuel Zhang      2025-07-10  72   * Used to query if dev_pm_ops.thaw() is called for normal hibernation case or
c2aaddbd2deded Samuel Zhang      2025-07-10  73   * recovering from some error.
c2aaddbd2deded Samuel Zhang      2025-07-10  74   *
c2aaddbd2deded Samuel Zhang      2025-07-10  75   * Return: true for error case, false for normal case.
c2aaddbd2deded Samuel Zhang      2025-07-10  76   */
c2aaddbd2deded Samuel Zhang      2025-07-10 @77  bool pm_hibernate_is_recovering(void)
c2aaddbd2deded Samuel Zhang      2025-07-10  78  {
c2aaddbd2deded Samuel Zhang      2025-07-10  79  	return pm_transition.event == PM_EVENT_RECOVER;
c2aaddbd2deded Samuel Zhang      2025-07-10  80  }
c2aaddbd2deded Samuel Zhang      2025-07-10  81  EXPORT_SYMBOL_GPL(pm_hibernate_is_recovering);
c2aaddbd2deded Samuel Zhang      2025-07-10  82  

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-12 21:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-12 18:58 [PATCH] PM: hibernate: Add stub for pm_hibernate_is_recovering() Mario Limonciello
2025-07-12 21:44 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox