diff mbox

PM / Suspend: Add more suspend notifier events

Message ID 20110318174620.2D0B99D401D@zog.reactivated.net (mailing list archive)
State Rejected, archived
Headers show

Commit Message

Daniel Drake March 18, 2011, 5:46 p.m. UTC
None
diff mbox

Patch

diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 2026f9e..4519d4f 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -254,10 +254,12 @@  static inline int notifier_to_errno(int ret)
 /* Hibernation and suspend events */
 #define PM_HIBERNATION_PREPARE	0x0001 /* Going to hibernate */
 #define PM_POST_HIBERNATION	0x0002 /* Hibernation finished */
-#define PM_SUSPEND_PREPARE	0x0003 /* Going to suspend the system */
-#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_PREPARE	0x0003 /* Preparing to suspend the system */
+#define PM_DO_SUSPEND		0x0004 /* Going to suspend the system */
+#define PM_DO_RESUME		0x0005 /* Going to resume the system */
+#define PM_POST_SUSPEND		0x0006 /* Suspend finished */
+#define PM_RESTORE_PREPARE	0x0007 /* Going to restore a saved image */
+#define PM_POST_RESTORE		0x0008 /* Restore failed */
 
 /* Console keyboard events.
  * Note: KBD_KEYCODE is always sent before KBD_UNBOUND_KEYCODE, KBD_UNICODE and
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 2814c32..35acfc5 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -224,9 +224,14 @@  int suspend_devices_and_enter(suspend_state_t state)
 	if (suspend_test(TEST_DEVICES))
 		goto Recover_platform;
 
+	error = pm_notifier_call_chain(PM_DO_SUSPEND);
+	if (error)
+		goto Recover_platform;
+
 	suspend_enter(state);
 
  Resume_devices:
+	pm_notifier_call_chain(PM_DO_RESUME);
 	suspend_test_start();
 	dpm_resume_end(PMSG_RESUME);
 	suspend_test_finish("resume devices");