aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/console.c12
-rw-r--r--kernel/power/disk.c15
-rw-r--r--kernel/power/main.c4
-rw-r--r--kernel/power/power.h9
-rw-r--r--kernel/power/swsusp.c8
5 files changed, 18 insertions, 30 deletions
diff --git a/kernel/power/console.c b/kernel/power/console.c
index 7ff375e7c95f..579d239d129f 100644
--- a/kernel/power/console.c
+++ b/kernel/power/console.c
@@ -9,18 +9,11 @@
9#include <linux/console.h> 9#include <linux/console.h>
10#include "power.h" 10#include "power.h"
11 11
12static int new_loglevel = 10;
13static int orig_loglevel;
14#ifdef SUSPEND_CONSOLE 12#ifdef SUSPEND_CONSOLE
15static int orig_fgconsole, orig_kmsg; 13static int orig_fgconsole, orig_kmsg;
16#endif
17 14
18int pm_prepare_console(void) 15int pm_prepare_console(void)
19{ 16{
20 orig_loglevel = console_loglevel;
21 console_loglevel = new_loglevel;
22
23#ifdef SUSPEND_CONSOLE
24 acquire_console_sem(); 17 acquire_console_sem();
25 18
26 orig_fgconsole = fg_console; 19 orig_fgconsole = fg_console;
@@ -41,18 +34,15 @@ int pm_prepare_console(void)
41 } 34 }
42 orig_kmsg = kmsg_redirect; 35 orig_kmsg = kmsg_redirect;
43 kmsg_redirect = SUSPEND_CONSOLE; 36 kmsg_redirect = SUSPEND_CONSOLE;
44#endif
45 return 0; 37 return 0;
46} 38}
47 39
48void pm_restore_console(void) 40void pm_restore_console(void)
49{ 41{
50 console_loglevel = orig_loglevel;
51#ifdef SUSPEND_CONSOLE
52 acquire_console_sem(); 42 acquire_console_sem();
53 set_console(orig_fgconsole); 43 set_console(orig_fgconsole);
54 release_console_sem(); 44 release_console_sem();
55 kmsg_redirect = orig_kmsg; 45 kmsg_redirect = orig_kmsg;
56#endif
57 return; 46 return;
58} 47}
48#endif
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index e24446f8d8cd..0b43847dc980 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -53,7 +53,7 @@ static void power_down(suspend_disk_method_t mode)
53 53
54 switch(mode) { 54 switch(mode) {
55 case PM_DISK_PLATFORM: 55 case PM_DISK_PLATFORM:
56 kernel_power_off_prepare(); 56 kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
57 error = pm_ops->enter(PM_SUSPEND_DISK); 57 error = pm_ops->enter(PM_SUSPEND_DISK);
58 break; 58 break;
59 case PM_DISK_SHUTDOWN: 59 case PM_DISK_SHUTDOWN:
@@ -95,13 +95,6 @@ static int prepare_processes(void)
95 goto thaw; 95 goto thaw;
96 } 96 }
97 97
98 if (pm_disk_mode == PM_DISK_PLATFORM) {
99 if (pm_ops && pm_ops->prepare) {
100 if ((error = pm_ops->prepare(PM_SUSPEND_DISK)))
101 goto thaw;
102 }
103 }
104
105 /* Free memory before shutting down devices. */ 98 /* Free memory before shutting down devices. */
106 if (!(error = swsusp_shrink_memory())) 99 if (!(error = swsusp_shrink_memory()))
107 return 0; 100 return 0;
@@ -367,14 +360,14 @@ power_attr(resume);
367 360
368static ssize_t image_size_show(struct subsystem * subsys, char *buf) 361static ssize_t image_size_show(struct subsystem * subsys, char *buf)
369{ 362{
370 return sprintf(buf, "%u\n", image_size); 363 return sprintf(buf, "%lu\n", image_size);
371} 364}
372 365
373static ssize_t image_size_store(struct subsystem * subsys, const char * buf, size_t n) 366static ssize_t image_size_store(struct subsystem * subsys, const char * buf, size_t n)
374{ 367{
375 unsigned int size; 368 unsigned long size;
376 369
377 if (sscanf(buf, "%u", &size) == 1) { 370 if (sscanf(buf, "%lu", &size) == 1) {
378 image_size = size; 371 image_size = size;
379 return n; 372 return n;
380 } 373 }
diff --git a/kernel/power/main.c b/kernel/power/main.c
index d253f3ae2fa5..9cb235cba4a9 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -133,10 +133,10 @@ static int suspend_enter(suspend_state_t state)
133static void suspend_finish(suspend_state_t state) 133static void suspend_finish(suspend_state_t state)
134{ 134{
135 device_resume(); 135 device_resume();
136 if (pm_ops && pm_ops->finish)
137 pm_ops->finish(state);
138 thaw_processes(); 136 thaw_processes();
139 enable_nonboot_cpus(); 137 enable_nonboot_cpus();
138 if (pm_ops && pm_ops->finish)
139 pm_ops->finish(state);
140 pm_restore_console(); 140 pm_restore_console();
141} 141}
142 142
diff --git a/kernel/power/power.h b/kernel/power/power.h
index 7e8492fd1423..d8f0d1a76bae 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -42,8 +42,13 @@ static struct subsys_attribute _name##_attr = { \
42 42
43extern struct subsystem power_subsys; 43extern struct subsystem power_subsys;
44 44
45#ifdef SUSPEND_CONSOLE
45extern int pm_prepare_console(void); 46extern int pm_prepare_console(void);
46extern void pm_restore_console(void); 47extern void pm_restore_console(void);
48#else
49static int pm_prepare_console(void) { return 0; }
50static void pm_restore_console(void) {}
51#endif
47 52
48/* References to section boundaries */ 53/* References to section boundaries */
49extern const void __nosave_begin, __nosave_end; 54extern const void __nosave_begin, __nosave_end;
@@ -51,8 +56,8 @@ extern const void __nosave_begin, __nosave_end;
51extern unsigned int nr_copy_pages; 56extern unsigned int nr_copy_pages;
52extern struct pbe *pagedir_nosave; 57extern struct pbe *pagedir_nosave;
53 58
54/* Preferred image size in MB (default 500) */ 59/* Preferred image size in bytes (default 500 MB) */
55extern unsigned int image_size; 60extern unsigned long image_size;
56 61
57extern asmlinkage int swsusp_arch_suspend(void); 62extern asmlinkage int swsusp_arch_suspend(void);
58extern asmlinkage int swsusp_arch_resume(void); 63extern asmlinkage int swsusp_arch_resume(void);
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index 55a18d26abed..59c91c148e82 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -70,12 +70,12 @@
70#include "power.h" 70#include "power.h"
71 71
72/* 72/*
73 * Preferred image size in MB (tunable via /sys/power/image_size). 73 * Preferred image size in bytes (tunable via /sys/power/image_size).
74 * When it is set to N, swsusp will do its best to ensure the image 74 * When it is set to N, swsusp will do its best to ensure the image
75 * size will not exceed N MB, but if that is impossible, it will 75 * size will not exceed N bytes, but if that is impossible, it will
76 * try to create the smallest image possible. 76 * try to create the smallest image possible.
77 */ 77 */
78unsigned int image_size = 500; 78unsigned long image_size = 500 * 1024 * 1024;
79 79
80#ifdef CONFIG_HIGHMEM 80#ifdef CONFIG_HIGHMEM
81unsigned int count_highmem_pages(void); 81unsigned int count_highmem_pages(void);
@@ -590,7 +590,7 @@ int swsusp_shrink_memory(void)
590 if (!tmp) 590 if (!tmp)
591 return -ENOMEM; 591 return -ENOMEM;
592 pages += tmp; 592 pages += tmp;
593 } else if (size > (image_size * 1024 * 1024) / PAGE_SIZE) { 593 } else if (size > image_size / PAGE_SIZE) {
594 tmp = shrink_all_memory(SHRINK_BITE); 594 tmp = shrink_all_memory(SHRINK_BITE);
595 pages += tmp; 595 pages += tmp;
596 } 596 }