public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] PM: Add PM_RESUME_PREPARE and PM_POST_RESUME notifiers
@ 2007-10-29 21:30 Alan Stern
  2007-10-29 22:34 ` Rafael J. Wysocki
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Stern @ 2007-10-29 21:30 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Linux-pm mailing list

Rafael:

How does this patch look?  Any reason not to have the resume notifiers?  
After all, drivers need to know when an image is about to be restored 
just as much as they need to know when one is about to be created.

Assuming this is okay, to whom should I submit it?  There will be a
couple of follow-up patches, one adding the icebox and one converting
the USB threads to use the icebox instead of the freezer.  This sort of
cross-subsystem stuff is difficult to coordinate unless one person
handles everything.

Alan Stern



Index: usb-2.6/Documentation/power/notifiers.txt
===================================================================
--- usb-2.6.orig/Documentation/power/notifiers.txt
+++ usb-2.6/Documentation/power/notifiers.txt
@@ -28,6 +28,14 @@ PM_POST_HIBERNATION	The system memory st
 			hibernation.  Device drivers' .resume() callbacks have
 			been executed and tasks have been thawed.
 
+PM_RESUME_PREPARE	The system is going to restore a hibernation image.
+			If all goes well the restored kernel will issue a
+			PM_POST_HIBERNATION notification.
+
+PM_POST_RESUME		An error occurred during the hibernation resume.
+			Device drivers' .resume() callbacks have been executed
+			and tasks have been thawed.
+
 PM_SUSPEND_PREPARE	The system is preparing for a suspend.
 
 PM_POST_SUSPEND		The system has just resumed or an error occured during
Index: usb-2.6/include/linux/notifier.h
===================================================================
--- usb-2.6.orig/include/linux/notifier.h
+++ usb-2.6/include/linux/notifier.h
@@ -230,6 +230,8 @@ static inline int notifier_to_errno(int 
 #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_RESUME_PREPARE	0x0005 /* Going to resume from hibernation */
+#define PM_POST_RESUME		0x0006 /* Resume failed */
 
 /* Console keyboard events.
  * Note: KBD_KEYCODE is always sent before KBD_UNBOUND_KEYCODE, KBD_UNICODE and
Index: usb-2.6/kernel/power/disk.c
===================================================================
--- usb-2.6.orig/kernel/power/disk.c
+++ usb-2.6/kernel/power/disk.c
@@ -489,6 +489,10 @@ static int software_resume(void)
 		goto Unlock;
 	}
 
+	error = pm_notifier_call_chain(PM_RESUME_PREPARE);
+	if (error)
+		goto Exit;
+
 	error = create_basic_memory_bitmaps();
 	if (error)
 		goto Finish;
@@ -512,6 +516,8 @@ static int software_resume(void)
  Done:
 	free_basic_memory_bitmaps();
  Finish:
+	pm_notifier_call_chain(PM_POST_RESUME);
+ Exit:
 	atomic_inc(&snapshot_device_available);
 	/* For success case, the suspend path will release the lock */
  Unlock:

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

end of thread, other threads:[~2007-11-01 19:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-29 21:30 [RFC] PM: Add PM_RESUME_PREPARE and PM_POST_RESUME notifiers Alan Stern
2007-10-29 22:34 ` Rafael J. Wysocki
2007-10-30 14:52   ` Alan Stern
2007-10-30 21:15     ` Rafael J. Wysocki
2007-10-31 21:11       ` Alan Stern
2007-10-31 22:09         ` Rafael J. Wysocki
2007-11-01 14:40           ` Alan Stern
2007-11-01 15:13             ` Rafael J. Wysocki
2007-11-01 19:31               ` [PATCH] PM: Add PM_RESTORE_PREPARE and PM_POST_RESTORE notifiers Alan Stern

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