]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] swsusp: Use suspend_console
authorRafael J. Wysocki <rjw@sisk.pl>
Wed, 11 Oct 2006 08:20:45 +0000 (01:20 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 11 Oct 2006 18:14:14 +0000 (11:14 -0700)
Add suspend_console() and resume_console() to the suspend-to-disk code paths
so that the users of netconsole can use swsusp with it.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/power/disk.c
kernel/power/user.c

index d72234942798e6606d613cf6c99d5fc72ab40c09..d3a158a60312187242c8e1238b68ac5151d11459 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/fs.h>
 #include <linux/mount.h>
 #include <linux/pm.h>
+#include <linux/console.h>
 #include <linux/cpu.h>
 
 #include "power.h"
@@ -119,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;
@@ -133,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)
@@ -148,6 +152,7 @@ int pm_suspend_disk(void)
        swsusp_free();
  Done:
        device_resume();
+       resume_console();
        unprepare_processes();
        return error;
 }
@@ -212,7 +217,9 @@ static int software_resume(void)
 
        pr_debug("PM: Preparing devices for restore.\n");
 
+       suspend_console();
        if ((error = device_suspend(PMSG_PRETHAW))) {
+               resume_console();
                printk("Some devices failed to suspend\n");
                swsusp_free();
                goto Thaw;
@@ -224,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:
index 93b5dd283dea05dcdf7c6f1681f67385292ba9c8..d991d3b0e5a4e326ea29b6b7fc50c4a926dd5e3e 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/swapops.h>
 #include <linux/pm.h>
 #include <linux/fs.h>
+#include <linux/console.h>
 #include <linux/cpu.h>
 
 #include <asm/uaccess.h>
@@ -173,12 +174,14 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
                /* Free memory before shutting down devices. */
                error = swsusp_shrink_memory();
                if (!error) {
+                       suspend_console();
                        error = device_suspend(PMSG_FREEZE);
                        if (!error) {
                                in_suspend = 1;
                                error = swsusp_suspend();
                                device_resume();
                        }
+                       resume_console();
                }
                up(&pm_sem);
                if (!error)
@@ -196,11 +199,13 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
                snapshot_free_unused_memory(&data->handle);
                down(&pm_sem);
                pm_prepare_console();
+               suspend_console();
                error = device_suspend(PMSG_PRETHAW);
                if (!error) {
                        error = swsusp_resume();
                        device_resume();
                }
+               resume_console();
                pm_restore_console();
                up(&pm_sem);
                break;
@@ -289,6 +294,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
                }
 
                /* Put devices to sleep */
+               suspend_console();
                error = device_suspend(PMSG_SUSPEND);
                if (error) {
                        printk(KERN_ERR "Failed to suspend some devices.\n");
@@ -299,7 +305,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
                        /* Wake up devices */
                        device_resume();
                }
-
+               resume_console();
                if (pm_ops->finish)
                        pm_ops->finish(PM_SUSPEND_MEM);