[PATCH 6/7] PM: suspend: introduce PM_SUSPEND_LATE event

From
Zhang Rui <rui.zhang@intel.com>
Date
2022-05-05 01:58:47
Also in
linux-acpi, linux-pm, linux-wireless
Reply to
Zhang Rui, 2022-05-05
In some cases, special handling is needed after the .suspend_noirq phase.

Introduce a new suspend event PM_SUSPEND_LATE and call the notifier chain
for this purpose.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Tested-by: Sumeet Pawnikar <redacted>
---
 include/linux/suspend.h | 1 +
 kernel/power/suspend.c  | 2 ++
 2 files changed, 3 insertions(+)
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 300273ff40cc..01ec171e8f60 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -477,6 +477,7 @@ static inline int is_hibernate_resume_dev(dev_t dev) { return 0; }
 #define PM_POST_SUSPEND		0x0004 /* Suspend finished */
 #define PM_RESTORE_PREPARE	0x0005 /* Going to restore a saved image */
 #define PM_POST_RESTORE		0x0006 /* Restore failed */
+#define PM_SUSPEND_LATE		0x0007 /* Late suspend phase */
 
 extern struct mutex system_transition_mutex;
 
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 6fcdee7e87a5..3c662acc908f 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -415,6 +415,8 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
 	if (suspend_test(TEST_PLATFORM))
 		goto Platform_wake;
 
+	pm_notifier_call_chain(PM_SUSPEND_LATE);
+
 	if (state == PM_SUSPEND_TO_IDLE) {
 		s2idle_loop();
 		goto Platform_wake;
-- 
2.17.1
Thread (26 messages) 26 messages, 5 authors, last reply 2022-05-19
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help