PM: issue PM_EVENT_PRETHAW
authorDavid Brownell <david-b@pacbell.net>
Tue, 15 Aug 2006 06:11:08 +0000 (23:11 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 26 Sep 2006 04:08:37 +0000 (21:08 -0700)
This patch is the first of this series that should actually change any
behavior ...  by issuing the new event, now tha the rest of the kernel is
prepared to receive it.

This converts the PM core to issue the new PRETHAW message, which the rest of
the kernel is now ready to receive.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/base/power/suspend.c
kernel/power/disk.c
kernel/power/swsusp.c
kernel/power/user.c

index 0bda4a7f20422d82687efec95cb9be5cc668c0a3..e86db83746acb4e65c9a3275efca47811ac27b14 100644 (file)
@@ -34,6 +34,7 @@ static inline char *suspend_verb(u32 event)
        switch (event) {
        case PM_EVENT_SUSPEND:  return "suspend";
        case PM_EVENT_FREEZE:   return "freeze";
+       case PM_EVENT_PRETHAW:  return "prethaw";
        default:                return "(unknown suspend event)";
        }
 }
index e13e740678456c6e20e97af70724fdebe2106dcd..a3c34fb143215ac8d10fa5565ecf2977426e47b1 100644 (file)
@@ -98,7 +98,7 @@ static void unprepare_processes(void)
 }
 
 /**
- *     pm_suspend_disk - The granpappy of power management.
+ *     pm_suspend_disk - The granpappy of hibernation power management.
  *
  *     If we're going through the firmware, then get it over with quickly.
  *
@@ -207,7 +207,7 @@ static int software_resume(void)
 
        pr_debug("PM: Preparing devices for restore.\n");
 
-       if ((error = device_suspend(PMSG_FREEZE))) {
+       if ((error = device_suspend(PMSG_PRETHAW))) {
                printk("Some devices failed to suspend\n");
                swsusp_free();
                goto Thaw;
index 17f669c83012e95121d9d8930a32d3bd25c080aa..62752899b1a1f32dcee8d547599e1cad2708e521 100644 (file)
@@ -248,6 +248,9 @@ int swsusp_suspend(void)
        restore_processor_state();
 Restore_highmem:
        restore_highmem();
+       /* NOTE:  device_power_up() is just a resume() for devices
+        * that suspended with irqs off ... no overall powerup.
+        */
        device_power_up();
 Enable_irqs:
        local_irq_enable();
@@ -257,8 +260,12 @@ Enable_irqs:
 int swsusp_resume(void)
 {
        int error;
+
        local_irq_disable();
-       if (device_power_down(PMSG_FREEZE))
+       /* NOTE:  device_power_down() is just a suspend() with irqs off;
+        * it has no special "power things down" semantics
+        */
+       if (device_power_down(PMSG_PRETHAW))
                printk(KERN_ERR "Some devices failed to power down, very bad\n");
        /* We'll ignore saved state, but this gets preempt count (etc) right */
        save_processor_state();
index 3f1539fbe48a8be9c9f5ecf86f13042b3fed523d..5a8d060d7909993f149ebd14c152e0366ac8505d 100644 (file)
@@ -191,7 +191,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
                }
                down(&pm_sem);
                pm_prepare_console();
-               error = device_suspend(PMSG_FREEZE);
+               error = device_suspend(PMSG_PRETHAW);
                if (!error) {
                        error = swsusp_resume();
                        device_resume();