diff options
Diffstat (limited to 'kernel/power/swsusp.c')
-rw-r--r-- | kernel/power/swsusp.c | 48 |
1 files changed, 3 insertions, 45 deletions
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index e1722d3155f1..023ff2a31d89 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c | |||
@@ -64,14 +64,6 @@ unsigned long image_size = 500 * 1024 * 1024; | |||
64 | 64 | ||
65 | int in_suspend __nosavedata = 0; | 65 | int in_suspend __nosavedata = 0; |
66 | 66 | ||
67 | #ifdef CONFIG_HIGHMEM | ||
68 | unsigned int count_highmem_pages(void); | ||
69 | int restore_highmem(void); | ||
70 | #else | ||
71 | static inline int restore_highmem(void) { return 0; } | ||
72 | static inline unsigned int count_highmem_pages(void) { return 0; } | ||
73 | #endif | ||
74 | |||
75 | /** | 67 | /** |
76 | * The following functions are used for tracing the allocated | 68 | * The following functions are used for tracing the allocated |
77 | * swap pages, so that they can be freed in case of an error. | 69 | * swap pages, so that they can be freed in case of an error. |
@@ -196,7 +188,8 @@ void swsusp_show_speed(struct timeval *start, struct timeval *stop, | |||
196 | centisecs = 1; /* avoid div-by-zero */ | 188 | centisecs = 1; /* avoid div-by-zero */ |
197 | k = nr_pages * (PAGE_SIZE / 1024); | 189 | k = nr_pages * (PAGE_SIZE / 1024); |
198 | kps = (k * 100) / centisecs; | 190 | kps = (k * 100) / centisecs; |
199 | printk("%s %d kbytes in %d.%02d seconds (%d.%02d MB/s)\n", msg, k, | 191 | printk(KERN_INFO "PM: %s %d kbytes in %d.%02d seconds (%d.%02d MB/s)\n", |
192 | msg, k, | ||
200 | centisecs / 100, centisecs % 100, | 193 | centisecs / 100, centisecs % 100, |
201 | kps / 1000, (kps % 1000) / 10); | 194 | kps / 1000, (kps % 1000) / 10); |
202 | } | 195 | } |
@@ -227,7 +220,7 @@ int swsusp_shrink_memory(void) | |||
227 | char *p = "-\\|/"; | 220 | char *p = "-\\|/"; |
228 | struct timeval start, stop; | 221 | struct timeval start, stop; |
229 | 222 | ||
230 | printk("Shrinking memory... "); | 223 | printk(KERN_INFO "PM: Shrinking memory... "); |
231 | do_gettimeofday(&start); | 224 | do_gettimeofday(&start); |
232 | do { | 225 | do { |
233 | long size, highmem_size; | 226 | long size, highmem_size; |
@@ -269,38 +262,3 @@ int swsusp_shrink_memory(void) | |||
269 | 262 | ||
270 | return 0; | 263 | return 0; |
271 | } | 264 | } |
272 | |||
273 | int swsusp_resume(void) | ||
274 | { | ||
275 | int error; | ||
276 | |||
277 | local_irq_disable(); | ||
278 | /* NOTE: device_power_down() is just a suspend() with irqs off; | ||
279 | * it has no special "power things down" semantics | ||
280 | */ | ||
281 | if (device_power_down(PMSG_PRETHAW)) | ||
282 | printk(KERN_ERR "Some devices failed to power down, very bad\n"); | ||
283 | /* We'll ignore saved state, but this gets preempt count (etc) right */ | ||
284 | save_processor_state(); | ||
285 | error = restore_highmem(); | ||
286 | if (!error) { | ||
287 | error = swsusp_arch_resume(); | ||
288 | /* The code below is only ever reached in case of a failure. | ||
289 | * Otherwise execution continues at place where | ||
290 | * swsusp_arch_suspend() was called | ||
291 | */ | ||
292 | BUG_ON(!error); | ||
293 | /* This call to restore_highmem() undos the previous one */ | ||
294 | restore_highmem(); | ||
295 | } | ||
296 | /* The only reason why swsusp_arch_resume() can fail is memory being | ||
297 | * very tight, so we have to free it as soon as we can to avoid | ||
298 | * subsequent failures | ||
299 | */ | ||
300 | swsusp_free(); | ||
301 | restore_processor_state(); | ||
302 | touch_softlockup_watchdog(); | ||
303 | device_power_up(); | ||
304 | local_irq_enable(); | ||
305 | return error; | ||
306 | } | ||