Skip to content

Commit 8c3c7aa

Browse files
committed
PM: sleep: Introduce pm_suspend_in_progress()
JIRA: https://issues.redhat.com/browse/RHEL-113204 Conflicts: There was a conflict in kernel/power/main.c: bool pm_debug_messages_should_print(void) { <<<<<<< HEAD return pm_debug_messages_on && pm_suspend_target_state != PM_SUSPEND_ON; ======= return pm_debug_messages_on && (pm_suspend_in_progress() || hibernation_in_progress()); >>>>>>> PM: sleep: Introduce pm_suspend_in_progress() } EXPORT_SYMBOL_GPL(pm_debug_messages_should_print); Since `pm_suspend_in_progress()` checks that `pm_suspend_target_state != PM_SUSPEND_ON`, I resolved it with: `return pm_debug_messages_on && pm_suspend_in_progress();` commit 34a364f Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Date: Fri May 9 15:02:27 2025 +0200 PM: sleep: Introduce pm_suspend_in_progress() Introduce pm_suspend_in_progress() to be used for checking if a system- wide suspend or resume transition is in progress, instead of comparing pm_suspend_target_state directly to PM_SUSPEND_ON, and use it where applicable. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Reviewed-by: Raag Jadav <raag.jadav@intel.com> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://patch.msgid.link/2020901.PYKUYFuaPT@rjwysocki.net Signed-off-by: José Expósito <jexposit@redhat.com>
1 parent 579cfab commit 8c3c7aa

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

arch/x86/pci/fixup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -970,13 +970,13 @@ static void amd_rp_pme_suspend(struct pci_dev *dev)
970970
struct pci_dev *rp;
971971

972972
/*
973-
* PM_SUSPEND_ON means we're doing runtime suspend, which means
973+
* If system suspend is not in progress, we're doing runtime suspend, so
974974
* amd-pmc will not be involved so PMEs during D3 work as advertised.
975975
*
976976
* The PMEs *do* work if amd-pmc doesn't put the SoC in the hardware
977977
* sleep state, but we assume amd-pmc is always present.
978978
*/
979-
if (pm_suspend_target_state == PM_SUSPEND_ON)
979+
if (!pm_suspend_in_progress())
980980
return;
981981

982982
rp = pcie_find_root_port(dev);

drivers/base/power/wakeup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ int device_wakeup_enable(struct device *dev)
337337
if (!dev || !dev->power.can_wakeup)
338338
return -EINVAL;
339339

340-
if (pm_suspend_target_state != PM_SUSPEND_ON)
340+
if (pm_suspend_in_progress())
341341
dev_dbg(dev, "Suspicious %s() during system transition!\n", __func__);
342342

343343
ws = wakeup_source_register(dev, dev_name(dev));

drivers/gpu/drm/xe/xe_pm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ static bool xe_pm_suspending_or_resuming(struct xe_device *xe)
641641

642642
return dev->power.runtime_status == RPM_SUSPENDING ||
643643
dev->power.runtime_status == RPM_RESUMING ||
644-
pm_suspend_target_state != PM_SUSPEND_ON;
644+
pm_suspend_in_progress();
645645
#else
646646
return false;
647647
#endif

include/linux/suspend.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,11 @@ static inline void s2idle_set_ops(const struct platform_s2idle_ops *ops) {}
357357
static inline void s2idle_wake(void) {}
358358
#endif /* !CONFIG_SUSPEND */
359359

360+
static inline bool pm_suspend_in_progress(void)
361+
{
362+
return pm_suspend_target_state != PM_SUSPEND_ON;
363+
}
364+
360365
/* struct pbe is used for creating lists of pages that should be restored
361366
* atomically during the resume from disk, because the page frames they have
362367
* occupied before the suspend are in use.

kernel/power/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ bool pm_debug_messages_on __read_mostly;
569569

570570
bool pm_debug_messages_should_print(void)
571571
{
572-
return pm_debug_messages_on && pm_suspend_target_state != PM_SUSPEND_ON;
572+
return pm_debug_messages_on && pm_suspend_in_progress();
573573
}
574574
EXPORT_SYMBOL_GPL(pm_debug_messages_should_print);
575575

0 commit comments

Comments
 (0)