]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/power/disk.c
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
[linux-2.6-omap-h63xx.git] / kernel / power / disk.c
index 81d4d982f3f097f55f02f427381f8871cac6f8cf..d3a158a60312187242c8e1238b68ac5151d11459 100644 (file)
@@ -18,6 +18,8 @@
 #include <linux/fs.h>
 #include <linux/mount.h>
 #include <linux/pm.h>
+#include <linux/console.h>
+#include <linux/cpu.h>
 
 #include "power.h"
 
@@ -72,7 +74,10 @@ static int prepare_processes(void)
        int error;
 
        pm_prepare_console();
-       disable_nonboot_cpus();
+
+       error = disable_nonboot_cpus();
+       if (error)
+               goto enable_cpus;
 
        if (freeze_processes()) {
                error = -EBUSY;
@@ -84,6 +89,7 @@ static int prepare_processes(void)
                return 0;
 thaw:
        thaw_processes();
+enable_cpus:
        enable_nonboot_cpus();
        pm_restore_console();
        return error;
@@ -98,7 +104,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.
  *
@@ -114,8 +120,10 @@ int pm_suspend_disk(void)
        if (error)
                return error;
 
+       suspend_console();
        error = device_suspend(PMSG_FREEZE);
        if (error) {
+               resume_console();
                printk("Some devices failed to suspend\n");
                unprepare_processes();
                return error;
@@ -128,6 +136,7 @@ int pm_suspend_disk(void)
 
        if (in_suspend) {
                device_resume();
+               resume_console();
                pr_debug("PM: writing image.\n");
                error = swsusp_write();
                if (!error)
@@ -143,6 +152,7 @@ int pm_suspend_disk(void)
        swsusp_free();
  Done:
        device_resume();
+       resume_console();
        unprepare_processes();
        return error;
 }
@@ -207,7 +217,9 @@ static int software_resume(void)
 
        pr_debug("PM: Preparing devices for restore.\n");
 
-       if ((error = device_suspend(PMSG_FREEZE))) {
+       suspend_console();
+       if ((error = device_suspend(PMSG_PRETHAW))) {
+               resume_console();
                printk("Some devices failed to suspend\n");
                swsusp_free();
                goto Thaw;
@@ -219,6 +231,7 @@ static int software_resume(void)
        swsusp_resume();
        pr_debug("PM: Restore failed, recovering.n");
        device_resume();
+       resume_console();
  Thaw:
        unprepare_processes();
  Done:
@@ -231,7 +244,7 @@ static int software_resume(void)
 late_initcall(software_resume);
 
 
-static char * pm_disk_modes[] = {
+static const char * const pm_disk_modes[] = {
        [PM_DISK_FIRMWARE]      = "firmware",
        [PM_DISK_PLATFORM]      = "platform",
        [PM_DISK_SHUTDOWN]      = "shutdown",