aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/power/disk.c8
-rw-r--r--kernel/power/user.c8
2 files changed, 15 insertions, 1 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index d72234942798..d3a158a60312 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -18,6 +18,7 @@
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/mount.h> 19#include <linux/mount.h>
20#include <linux/pm.h> 20#include <linux/pm.h>
21#include <linux/console.h>
21#include <linux/cpu.h> 22#include <linux/cpu.h>
22 23
23#include "power.h" 24#include "power.h"
@@ -119,8 +120,10 @@ int pm_suspend_disk(void)
119 if (error) 120 if (error)
120 return error; 121 return error;
121 122
123 suspend_console();
122 error = device_suspend(PMSG_FREEZE); 124 error = device_suspend(PMSG_FREEZE);
123 if (error) { 125 if (error) {
126 resume_console();
124 printk("Some devices failed to suspend\n"); 127 printk("Some devices failed to suspend\n");
125 unprepare_processes(); 128 unprepare_processes();
126 return error; 129 return error;
@@ -133,6 +136,7 @@ int pm_suspend_disk(void)
133 136
134 if (in_suspend) { 137 if (in_suspend) {
135 device_resume(); 138 device_resume();
139 resume_console();
136 pr_debug("PM: writing image.\n"); 140 pr_debug("PM: writing image.\n");
137 error = swsusp_write(); 141 error = swsusp_write();
138 if (!error) 142 if (!error)
@@ -148,6 +152,7 @@ int pm_suspend_disk(void)
148 swsusp_free(); 152 swsusp_free();
149 Done: 153 Done:
150 device_resume(); 154 device_resume();
155 resume_console();
151 unprepare_processes(); 156 unprepare_processes();
152 return error; 157 return error;
153} 158}
@@ -212,7 +217,9 @@ static int software_resume(void)
212 217
213 pr_debug("PM: Preparing devices for restore.\n"); 218 pr_debug("PM: Preparing devices for restore.\n");
214 219
220 suspend_console();
215 if ((error = device_suspend(PMSG_PRETHAW))) { 221 if ((error = device_suspend(PMSG_PRETHAW))) {
222 resume_console();
216 printk("Some devices failed to suspend\n"); 223 printk("Some devices failed to suspend\n");
217 swsusp_free(); 224 swsusp_free();
218 goto Thaw; 225 goto Thaw;
@@ -224,6 +231,7 @@ static int software_resume(void)
224 swsusp_resume(); 231 swsusp_resume();
225 pr_debug("PM: Restore failed, recovering.n"); 232 pr_debug("PM: Restore failed, recovering.n");
226 device_resume(); 233 device_resume();
234 resume_console();
227 Thaw: 235 Thaw:
228 unprepare_processes(); 236 unprepare_processes();
229 Done: 237 Done:
diff --git a/kernel/power/user.c b/kernel/power/user.c
index 93b5dd283dea..d991d3b0e5a4 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -19,6 +19,7 @@
19#include <linux/swapops.h> 19#include <linux/swapops.h>
20#include <linux/pm.h> 20#include <linux/pm.h>
21#include <linux/fs.h> 21#include <linux/fs.h>
22#include <linux/console.h>
22#include <linux/cpu.h> 23#include <linux/cpu.h>
23 24
24#include <asm/uaccess.h> 25#include <asm/uaccess.h>
@@ -173,12 +174,14 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
173 /* Free memory before shutting down devices. */ 174 /* Free memory before shutting down devices. */
174 error = swsusp_shrink_memory(); 175 error = swsusp_shrink_memory();
175 if (!error) { 176 if (!error) {
177 suspend_console();
176 error = device_suspend(PMSG_FREEZE); 178 error = device_suspend(PMSG_FREEZE);
177 if (!error) { 179 if (!error) {
178 in_suspend = 1; 180 in_suspend = 1;
179 error = swsusp_suspend(); 181 error = swsusp_suspend();
180 device_resume(); 182 device_resume();
181 } 183 }
184 resume_console();
182 } 185 }
183 up(&pm_sem); 186 up(&pm_sem);
184 if (!error) 187 if (!error)
@@ -196,11 +199,13 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
196 snapshot_free_unused_memory(&data->handle); 199 snapshot_free_unused_memory(&data->handle);
197 down(&pm_sem); 200 down(&pm_sem);
198 pm_prepare_console(); 201 pm_prepare_console();
202 suspend_console();
199 error = device_suspend(PMSG_PRETHAW); 203 error = device_suspend(PMSG_PRETHAW);
200 if (!error) { 204 if (!error) {
201 error = swsusp_resume(); 205 error = swsusp_resume();
202 device_resume(); 206 device_resume();
203 } 207 }
208 resume_console();
204 pm_restore_console(); 209 pm_restore_console();
205 up(&pm_sem); 210 up(&pm_sem);
206 break; 211 break;
@@ -289,6 +294,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
289 } 294 }
290 295
291 /* Put devices to sleep */ 296 /* Put devices to sleep */
297 suspend_console();
292 error = device_suspend(PMSG_SUSPEND); 298 error = device_suspend(PMSG_SUSPEND);
293 if (error) { 299 if (error) {
294 printk(KERN_ERR "Failed to suspend some devices.\n"); 300 printk(KERN_ERR "Failed to suspend some devices.\n");
@@ -299,7 +305,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
299 /* Wake up devices */ 305 /* Wake up devices */
300 device_resume(); 306 device_resume();
301 } 307 }
302 308 resume_console();
303 if (pm_ops->finish) 309 if (pm_ops->finish)
304 pm_ops->finish(PM_SUSPEND_MEM); 310 pm_ops->finish(PM_SUSPEND_MEM);
305 311