diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-16 12:24:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-16 12:24:44 -0400 |
commit | fc82e1d59a24cbac01c49d4eb3b28d6abc26a5f4 (patch) | |
tree | 5e01479d69e69dbbe483044b39afd2aa99d4f2b2 /kernel | |
parent | 48d5f6731837f0ec9a0e19ca763aa17d58385a98 (diff) | |
parent | bea3864fb627d110933cfb8babe048b63c4fc76e (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6: (21 commits)
PM / Hibernate: Reduce autotuned default image size
PM / Core: Introduce struct syscore_ops for core subsystems PM
PM QoS: Make pm_qos settings readable
PM / OPP: opp_find_freq_exact() documentation fix
PM: Documentation/power/states.txt: fix repetition
PM: Make system-wide PM and runtime PM treat subsystems consistently
PM: Simplify kernel/power/Kconfig
PM: Add support for device power domains
PM: Drop pm_flags that is not necessary
PM: Allow pm_runtime_suspend() to succeed during system suspend
PM: Clean up PM_TRACE dependencies and drop unnecessary Kconfig option
PM: Remove CONFIG_PM_OPS
PM: Reorder power management Kconfig options
PM: Make CONFIG_PM depend on (CONFIG_PM_SLEEP || CONFIG_PM_RUNTIME)
PM / ACPI: Remove references to pm_flags from bus.c
PM: Do not create wakeup sysfs files for devices that cannot wake up
USB / Hub: Do not call device_set_wakeup_capable() under spinlock
PM: Use appropriate printk() priority level in trace.c
PM / Wakeup: Don't update events_check_enabled in pm_get_wakeup_count()
PM / Wakeup: Make pm_save_wakeup_count() work as documented
...
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/pm_qos_params.c | 24 | ||||
-rw-r--r-- | kernel/power/Kconfig | 237 | ||||
-rw-r--r-- | kernel/power/hibernate.c | 9 | ||||
-rw-r--r-- | kernel/power/main.c | 3 | ||||
-rw-r--r-- | kernel/power/snapshot.c | 8 | ||||
-rw-r--r-- | kernel/power/suspend.c | 4 | ||||
-rw-r--r-- | kernel/sys.c | 4 |
7 files changed, 147 insertions, 142 deletions
diff --git a/kernel/pm_qos_params.c b/kernel/pm_qos_params.c index aeaa7f846821..0da058bff8eb 100644 --- a/kernel/pm_qos_params.c +++ b/kernel/pm_qos_params.c | |||
@@ -103,11 +103,14 @@ static struct pm_qos_object *pm_qos_array[] = { | |||
103 | 103 | ||
104 | static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, | 104 | static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, |
105 | size_t count, loff_t *f_pos); | 105 | size_t count, loff_t *f_pos); |
106 | static ssize_t pm_qos_power_read(struct file *filp, char __user *buf, | ||
107 | size_t count, loff_t *f_pos); | ||
106 | static int pm_qos_power_open(struct inode *inode, struct file *filp); | 108 | static int pm_qos_power_open(struct inode *inode, struct file *filp); |
107 | static int pm_qos_power_release(struct inode *inode, struct file *filp); | 109 | static int pm_qos_power_release(struct inode *inode, struct file *filp); |
108 | 110 | ||
109 | static const struct file_operations pm_qos_power_fops = { | 111 | static const struct file_operations pm_qos_power_fops = { |
110 | .write = pm_qos_power_write, | 112 | .write = pm_qos_power_write, |
113 | .read = pm_qos_power_read, | ||
111 | .open = pm_qos_power_open, | 114 | .open = pm_qos_power_open, |
112 | .release = pm_qos_power_release, | 115 | .release = pm_qos_power_release, |
113 | .llseek = noop_llseek, | 116 | .llseek = noop_llseek, |
@@ -376,6 +379,27 @@ static int pm_qos_power_release(struct inode *inode, struct file *filp) | |||
376 | } | 379 | } |
377 | 380 | ||
378 | 381 | ||
382 | static ssize_t pm_qos_power_read(struct file *filp, char __user *buf, | ||
383 | size_t count, loff_t *f_pos) | ||
384 | { | ||
385 | s32 value; | ||
386 | unsigned long flags; | ||
387 | struct pm_qos_object *o; | ||
388 | struct pm_qos_request_list *pm_qos_req = filp->private_data;; | ||
389 | |||
390 | if (!pm_qos_req) | ||
391 | return -EINVAL; | ||
392 | if (!pm_qos_request_active(pm_qos_req)) | ||
393 | return -EINVAL; | ||
394 | |||
395 | o = pm_qos_array[pm_qos_req->pm_qos_class]; | ||
396 | spin_lock_irqsave(&pm_qos_lock, flags); | ||
397 | value = pm_qos_get_value(o); | ||
398 | spin_unlock_irqrestore(&pm_qos_lock, flags); | ||
399 | |||
400 | return simple_read_from_buffer(buf, count, f_pos, &value, sizeof(s32)); | ||
401 | } | ||
402 | |||
379 | static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, | 403 | static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, |
380 | size_t count, loff_t *f_pos) | 404 | size_t count, loff_t *f_pos) |
381 | { | 405 | { |
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index 265729966ece..4603f08dc47b 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig | |||
@@ -1,125 +1,12 @@ | |||
1 | config PM | ||
2 | bool "Power Management support" | ||
3 | depends on !IA64_HP_SIM | ||
4 | ---help--- | ||
5 | "Power Management" means that parts of your computer are shut | ||
6 | off or put into a power conserving "sleep" mode if they are not | ||
7 | being used. There are two competing standards for doing this: APM | ||
8 | and ACPI. If you want to use either one, say Y here and then also | ||
9 | to the requisite support below. | ||
10 | |||
11 | Power Management is most important for battery powered laptop | ||
12 | computers; if you have a laptop, check out the Linux Laptop home | ||
13 | page on the WWW at <http://www.linux-on-laptops.com/> or | ||
14 | Tuxmobil - Linux on Mobile Computers at <http://www.tuxmobil.org/> | ||
15 | and the Battery Powered Linux mini-HOWTO, available from | ||
16 | <http://www.tldp.org/docs.html#howto>. | ||
17 | |||
18 | Note that, even if you say N here, Linux on the x86 architecture | ||
19 | will issue the hlt instruction if nothing is to be done, thereby | ||
20 | sending the processor to sleep and saving power. | ||
21 | |||
22 | config PM_DEBUG | ||
23 | bool "Power Management Debug Support" | ||
24 | depends on PM | ||
25 | ---help--- | ||
26 | This option enables various debugging support in the Power Management | ||
27 | code. This is helpful when debugging and reporting PM bugs, like | ||
28 | suspend support. | ||
29 | |||
30 | config PM_ADVANCED_DEBUG | ||
31 | bool "Extra PM attributes in sysfs for low-level debugging/testing" | ||
32 | depends on PM_DEBUG | ||
33 | default n | ||
34 | ---help--- | ||
35 | Add extra sysfs attributes allowing one to access some Power Management | ||
36 | fields of device objects from user space. If you are not a kernel | ||
37 | developer interested in debugging/testing Power Management, say "no". | ||
38 | |||
39 | config PM_VERBOSE | ||
40 | bool "Verbose Power Management debugging" | ||
41 | depends on PM_DEBUG | ||
42 | default n | ||
43 | ---help--- | ||
44 | This option enables verbose messages from the Power Management code. | ||
45 | |||
46 | config CAN_PM_TRACE | ||
47 | def_bool y | ||
48 | depends on PM_DEBUG && PM_SLEEP && EXPERIMENTAL | ||
49 | |||
50 | config PM_TRACE | ||
51 | bool | ||
52 | help | ||
53 | This enables code to save the last PM event point across | ||
54 | reboot. The architecture needs to support this, x86 for | ||
55 | example does by saving things in the RTC, see below. | ||
56 | |||
57 | The architecture specific code must provide the extern | ||
58 | functions from <linux/resume-trace.h> as well as the | ||
59 | <asm/resume-trace.h> header with a TRACE_RESUME() macro. | ||
60 | |||
61 | The way the information is presented is architecture- | ||
62 | dependent, x86 will print the information during a | ||
63 | late_initcall. | ||
64 | |||
65 | config PM_TRACE_RTC | ||
66 | bool "Suspend/resume event tracing" | ||
67 | depends on CAN_PM_TRACE | ||
68 | depends on X86 | ||
69 | select PM_TRACE | ||
70 | default n | ||
71 | ---help--- | ||
72 | This enables some cheesy code to save the last PM event point in the | ||
73 | RTC across reboots, so that you can debug a machine that just hangs | ||
74 | during suspend (or more commonly, during resume). | ||
75 | |||
76 | To use this debugging feature you should attempt to suspend the | ||
77 | machine, reboot it and then run | ||
78 | |||
79 | dmesg -s 1000000 | grep 'hash matches' | ||
80 | |||
81 | CAUTION: this option will cause your machine's real-time clock to be | ||
82 | set to an invalid time after a resume. | ||
83 | |||
84 | config PM_SLEEP_SMP | ||
85 | bool | ||
86 | depends on SMP | ||
87 | depends on ARCH_SUSPEND_POSSIBLE || ARCH_HIBERNATION_POSSIBLE | ||
88 | depends on PM_SLEEP | ||
89 | select HOTPLUG | ||
90 | select HOTPLUG_CPU | ||
91 | default y | ||
92 | |||
93 | config PM_SLEEP | ||
94 | bool | ||
95 | depends on SUSPEND || HIBERNATION || XEN_SAVE_RESTORE | ||
96 | default y | ||
97 | |||
98 | config PM_SLEEP_ADVANCED_DEBUG | ||
99 | bool | ||
100 | depends on PM_ADVANCED_DEBUG | ||
101 | default n | ||
102 | |||
103 | config SUSPEND | 1 | config SUSPEND |
104 | bool "Suspend to RAM and standby" | 2 | bool "Suspend to RAM and standby" |
105 | depends on PM && ARCH_SUSPEND_POSSIBLE | 3 | depends on ARCH_SUSPEND_POSSIBLE |
106 | default y | 4 | default y |
107 | ---help--- | 5 | ---help--- |
108 | Allow the system to enter sleep states in which main memory is | 6 | Allow the system to enter sleep states in which main memory is |
109 | powered and thus its contents are preserved, such as the | 7 | powered and thus its contents are preserved, such as the |
110 | suspend-to-RAM state (e.g. the ACPI S3 state). | 8 | suspend-to-RAM state (e.g. the ACPI S3 state). |
111 | 9 | ||
112 | config PM_TEST_SUSPEND | ||
113 | bool "Test suspend/resume and wakealarm during bootup" | ||
114 | depends on SUSPEND && PM_DEBUG && RTC_CLASS=y | ||
115 | ---help--- | ||
116 | This option will let you suspend your machine during bootup, and | ||
117 | make it wake up a few seconds later using an RTC wakeup alarm. | ||
118 | Enable this with a kernel parameter like "test_suspend=mem". | ||
119 | |||
120 | You probably want to have your system's RTC driver statically | ||
121 | linked, ensuring that it's available when this test runs. | ||
122 | |||
123 | config SUSPEND_FREEZER | 10 | config SUSPEND_FREEZER |
124 | bool "Enable freezer for suspend to RAM/standby" \ | 11 | bool "Enable freezer for suspend to RAM/standby" \ |
125 | if ARCH_WANTS_FREEZER_CONTROL || BROKEN | 12 | if ARCH_WANTS_FREEZER_CONTROL || BROKEN |
@@ -133,7 +20,7 @@ config SUSPEND_FREEZER | |||
133 | 20 | ||
134 | config HIBERNATION | 21 | config HIBERNATION |
135 | bool "Hibernation (aka 'suspend to disk')" | 22 | bool "Hibernation (aka 'suspend to disk')" |
136 | depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE | 23 | depends on SWAP && ARCH_HIBERNATION_POSSIBLE |
137 | select LZO_COMPRESS | 24 | select LZO_COMPRESS |
138 | select LZO_DECOMPRESS | 25 | select LZO_DECOMPRESS |
139 | ---help--- | 26 | ---help--- |
@@ -196,6 +83,106 @@ config PM_STD_PARTITION | |||
196 | suspended image to. It will simply pick the first available swap | 83 | suspended image to. It will simply pick the first available swap |
197 | device. | 84 | device. |
198 | 85 | ||
86 | config PM_SLEEP | ||
87 | def_bool y | ||
88 | depends on SUSPEND || HIBERNATION || XEN_SAVE_RESTORE | ||
89 | |||
90 | config PM_SLEEP_SMP | ||
91 | def_bool y | ||
92 | depends on SMP | ||
93 | depends on ARCH_SUSPEND_POSSIBLE || ARCH_HIBERNATION_POSSIBLE | ||
94 | depends on PM_SLEEP | ||
95 | select HOTPLUG | ||
96 | select HOTPLUG_CPU | ||
97 | |||
98 | config PM_RUNTIME | ||
99 | bool "Run-time PM core functionality" | ||
100 | depends on !IA64_HP_SIM | ||
101 | ---help--- | ||
102 | Enable functionality allowing I/O devices to be put into energy-saving | ||
103 | (low power) states at run time (or autosuspended) after a specified | ||
104 | period of inactivity and woken up in response to a hardware-generated | ||
105 | wake-up event or a driver's request. | ||
106 | |||
107 | Hardware support is generally required for this functionality to work | ||
108 | and the bus type drivers of the buses the devices are on are | ||
109 | responsible for the actual handling of the autosuspend requests and | ||
110 | wake-up events. | ||
111 | |||
112 | config PM | ||
113 | def_bool y | ||
114 | depends on PM_SLEEP || PM_RUNTIME | ||
115 | |||
116 | config PM_DEBUG | ||
117 | bool "Power Management Debug Support" | ||
118 | depends on PM | ||
119 | ---help--- | ||
120 | This option enables various debugging support in the Power Management | ||
121 | code. This is helpful when debugging and reporting PM bugs, like | ||
122 | suspend support. | ||
123 | |||
124 | config PM_VERBOSE | ||
125 | bool "Verbose Power Management debugging" | ||
126 | depends on PM_DEBUG | ||
127 | ---help--- | ||
128 | This option enables verbose messages from the Power Management code. | ||
129 | |||
130 | config PM_ADVANCED_DEBUG | ||
131 | bool "Extra PM attributes in sysfs for low-level debugging/testing" | ||
132 | depends on PM_DEBUG | ||
133 | ---help--- | ||
134 | Add extra sysfs attributes allowing one to access some Power Management | ||
135 | fields of device objects from user space. If you are not a kernel | ||
136 | developer interested in debugging/testing Power Management, say "no". | ||
137 | |||
138 | config PM_TEST_SUSPEND | ||
139 | bool "Test suspend/resume and wakealarm during bootup" | ||
140 | depends on SUSPEND && PM_DEBUG && RTC_CLASS=y | ||
141 | ---help--- | ||
142 | This option will let you suspend your machine during bootup, and | ||
143 | make it wake up a few seconds later using an RTC wakeup alarm. | ||
144 | Enable this with a kernel parameter like "test_suspend=mem". | ||
145 | |||
146 | You probably want to have your system's RTC driver statically | ||
147 | linked, ensuring that it's available when this test runs. | ||
148 | |||
149 | config CAN_PM_TRACE | ||
150 | def_bool y | ||
151 | depends on PM_DEBUG && PM_SLEEP | ||
152 | |||
153 | config PM_TRACE | ||
154 | bool | ||
155 | help | ||
156 | This enables code to save the last PM event point across | ||
157 | reboot. The architecture needs to support this, x86 for | ||
158 | example does by saving things in the RTC, see below. | ||
159 | |||
160 | The architecture specific code must provide the extern | ||
161 | functions from <linux/resume-trace.h> as well as the | ||
162 | <asm/resume-trace.h> header with a TRACE_RESUME() macro. | ||
163 | |||
164 | The way the information is presented is architecture- | ||
165 | dependent, x86 will print the information during a | ||
166 | late_initcall. | ||
167 | |||
168 | config PM_TRACE_RTC | ||
169 | bool "Suspend/resume event tracing" | ||
170 | depends on CAN_PM_TRACE | ||
171 | depends on X86 | ||
172 | select PM_TRACE | ||
173 | ---help--- | ||
174 | This enables some cheesy code to save the last PM event point in the | ||
175 | RTC across reboots, so that you can debug a machine that just hangs | ||
176 | during suspend (or more commonly, during resume). | ||
177 | |||
178 | To use this debugging feature you should attempt to suspend the | ||
179 | machine, reboot it and then run | ||
180 | |||
181 | dmesg -s 1000000 | grep 'hash matches' | ||
182 | |||
183 | CAUTION: this option will cause your machine's real-time clock to be | ||
184 | set to an invalid time after a resume. | ||
185 | |||
199 | config APM_EMULATION | 186 | config APM_EMULATION |
200 | tristate "Advanced Power Management Emulation" | 187 | tristate "Advanced Power Management Emulation" |
201 | depends on PM && SYS_SUPPORTS_APM_EMULATION | 188 | depends on PM && SYS_SUPPORTS_APM_EMULATION |
@@ -222,31 +209,11 @@ config APM_EMULATION | |||
222 | anything, try disabling/enabling this option (or disabling/enabling | 209 | anything, try disabling/enabling this option (or disabling/enabling |
223 | APM in your BIOS). | 210 | APM in your BIOS). |
224 | 211 | ||
225 | config PM_RUNTIME | ||
226 | bool "Run-time PM core functionality" | ||
227 | depends on PM | ||
228 | ---help--- | ||
229 | Enable functionality allowing I/O devices to be put into energy-saving | ||
230 | (low power) states at run time (or autosuspended) after a specified | ||
231 | period of inactivity and woken up in response to a hardware-generated | ||
232 | wake-up event or a driver's request. | ||
233 | |||
234 | Hardware support is generally required for this functionality to work | ||
235 | and the bus type drivers of the buses the devices are on are | ||
236 | responsible for the actual handling of the autosuspend requests and | ||
237 | wake-up events. | ||
238 | |||
239 | config PM_OPS | ||
240 | bool | ||
241 | depends on PM_SLEEP || PM_RUNTIME | ||
242 | default y | ||
243 | |||
244 | config ARCH_HAS_OPP | 212 | config ARCH_HAS_OPP |
245 | bool | 213 | bool |
246 | 214 | ||
247 | config PM_OPP | 215 | config PM_OPP |
248 | bool "Operating Performance Point (OPP) Layer library" | 216 | bool "Operating Performance Point (OPP) Layer library" |
249 | depends on PM | ||
250 | depends on ARCH_HAS_OPP | 217 | depends on ARCH_HAS_OPP |
251 | ---help--- | 218 | ---help--- |
252 | SOCs have a standard set of tuples consisting of frequency and | 219 | SOCs have a standard set of tuples consisting of frequency and |
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 1832bd264219..aeabd26e3342 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/cpu.h> | 23 | #include <linux/cpu.h> |
24 | #include <linux/freezer.h> | 24 | #include <linux/freezer.h> |
25 | #include <linux/gfp.h> | 25 | #include <linux/gfp.h> |
26 | #include <linux/syscore_ops.h> | ||
26 | #include <scsi/scsi_scan.h> | 27 | #include <scsi/scsi_scan.h> |
27 | #include <asm/suspend.h> | 28 | #include <asm/suspend.h> |
28 | 29 | ||
@@ -272,6 +273,8 @@ static int create_image(int platform_mode) | |||
272 | local_irq_disable(); | 273 | local_irq_disable(); |
273 | 274 | ||
274 | error = sysdev_suspend(PMSG_FREEZE); | 275 | error = sysdev_suspend(PMSG_FREEZE); |
276 | if (!error) | ||
277 | error = syscore_suspend(); | ||
275 | if (error) { | 278 | if (error) { |
276 | printk(KERN_ERR "PM: Some system devices failed to power down, " | 279 | printk(KERN_ERR "PM: Some system devices failed to power down, " |
277 | "aborting hibernation\n"); | 280 | "aborting hibernation\n"); |
@@ -295,6 +298,7 @@ static int create_image(int platform_mode) | |||
295 | } | 298 | } |
296 | 299 | ||
297 | Power_up: | 300 | Power_up: |
301 | syscore_resume(); | ||
298 | sysdev_resume(); | 302 | sysdev_resume(); |
299 | /* NOTE: dpm_resume_noirq() is just a resume() for devices | 303 | /* NOTE: dpm_resume_noirq() is just a resume() for devices |
300 | * that suspended with irqs off ... no overall powerup. | 304 | * that suspended with irqs off ... no overall powerup. |
@@ -403,6 +407,8 @@ static int resume_target_kernel(bool platform_mode) | |||
403 | local_irq_disable(); | 407 | local_irq_disable(); |
404 | 408 | ||
405 | error = sysdev_suspend(PMSG_QUIESCE); | 409 | error = sysdev_suspend(PMSG_QUIESCE); |
410 | if (!error) | ||
411 | error = syscore_suspend(); | ||
406 | if (error) | 412 | if (error) |
407 | goto Enable_irqs; | 413 | goto Enable_irqs; |
408 | 414 | ||
@@ -429,6 +435,7 @@ static int resume_target_kernel(bool platform_mode) | |||
429 | restore_processor_state(); | 435 | restore_processor_state(); |
430 | touch_softlockup_watchdog(); | 436 | touch_softlockup_watchdog(); |
431 | 437 | ||
438 | syscore_resume(); | ||
432 | sysdev_resume(); | 439 | sysdev_resume(); |
433 | 440 | ||
434 | Enable_irqs: | 441 | Enable_irqs: |
@@ -516,6 +523,7 @@ int hibernation_platform_enter(void) | |||
516 | 523 | ||
517 | local_irq_disable(); | 524 | local_irq_disable(); |
518 | sysdev_suspend(PMSG_HIBERNATE); | 525 | sysdev_suspend(PMSG_HIBERNATE); |
526 | syscore_suspend(); | ||
519 | if (pm_wakeup_pending()) { | 527 | if (pm_wakeup_pending()) { |
520 | error = -EAGAIN; | 528 | error = -EAGAIN; |
521 | goto Power_up; | 529 | goto Power_up; |
@@ -526,6 +534,7 @@ int hibernation_platform_enter(void) | |||
526 | while (1); | 534 | while (1); |
527 | 535 | ||
528 | Power_up: | 536 | Power_up: |
537 | syscore_resume(); | ||
529 | sysdev_resume(); | 538 | sysdev_resume(); |
530 | local_irq_enable(); | 539 | local_irq_enable(); |
531 | enable_nonboot_cpus(); | 540 | enable_nonboot_cpus(); |
diff --git a/kernel/power/main.c b/kernel/power/main.c index 701853042c28..8eaba5f27b10 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -17,9 +17,6 @@ | |||
17 | 17 | ||
18 | DEFINE_MUTEX(pm_mutex); | 18 | DEFINE_MUTEX(pm_mutex); |
19 | 19 | ||
20 | unsigned int pm_flags; | ||
21 | EXPORT_SYMBOL(pm_flags); | ||
22 | |||
23 | #ifdef CONFIG_PM_SLEEP | 20 | #ifdef CONFIG_PM_SLEEP |
24 | 21 | ||
25 | /* Routines for PM-transition notifications */ | 22 | /* Routines for PM-transition notifications */ |
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 64db648ff911..ca0aacc24874 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c | |||
@@ -42,15 +42,15 @@ static void swsusp_unset_page_forbidden(struct page *); | |||
42 | 42 | ||
43 | /* | 43 | /* |
44 | * Preferred image size in bytes (tunable via /sys/power/image_size). | 44 | * Preferred image size in bytes (tunable via /sys/power/image_size). |
45 | * When it is set to N, swsusp will do its best to ensure the image | 45 | * When it is set to N, the image creating code will do its best to |
46 | * size will not exceed N bytes, but if that is impossible, it will | 46 | * ensure the image size will not exceed N bytes, but if that is |
47 | * try to create the smallest image possible. | 47 | * impossible, it will try to create the smallest image possible. |
48 | */ | 48 | */ |
49 | unsigned long image_size; | 49 | unsigned long image_size; |
50 | 50 | ||
51 | void __init hibernate_image_size_init(void) | 51 | void __init hibernate_image_size_init(void) |
52 | { | 52 | { |
53 | image_size = ((totalram_pages * 2) / 5) * PAGE_SIZE; | 53 | image_size = (totalram_pages / 3) * PAGE_SIZE; |
54 | } | 54 | } |
55 | 55 | ||
56 | /* List of PBEs needed for restoring the pages that were allocated before | 56 | /* List of PBEs needed for restoring the pages that were allocated before |
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index de6f86bfa303..2814c32aed51 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/suspend.h> | 24 | #include <linux/suspend.h> |
25 | #include <linux/syscore_ops.h> | ||
25 | #include <trace/events/power.h> | 26 | #include <trace/events/power.h> |
26 | 27 | ||
27 | #include "power.h" | 28 | #include "power.h" |
@@ -163,11 +164,14 @@ static int suspend_enter(suspend_state_t state) | |||
163 | BUG_ON(!irqs_disabled()); | 164 | BUG_ON(!irqs_disabled()); |
164 | 165 | ||
165 | error = sysdev_suspend(PMSG_SUSPEND); | 166 | error = sysdev_suspend(PMSG_SUSPEND); |
167 | if (!error) | ||
168 | error = syscore_suspend(); | ||
166 | if (!error) { | 169 | if (!error) { |
167 | if (!(suspend_test(TEST_CORE) || pm_wakeup_pending())) { | 170 | if (!(suspend_test(TEST_CORE) || pm_wakeup_pending())) { |
168 | error = suspend_ops->enter(state); | 171 | error = suspend_ops->enter(state); |
169 | events_check_enabled = false; | 172 | events_check_enabled = false; |
170 | } | 173 | } |
174 | syscore_resume(); | ||
171 | sysdev_resume(); | 175 | sysdev_resume(); |
172 | } | 176 | } |
173 | 177 | ||
diff --git a/kernel/sys.c b/kernel/sys.c index 18da702ec813..1ad48b3b9068 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/ptrace.h> | 37 | #include <linux/ptrace.h> |
38 | #include <linux/fs_struct.h> | 38 | #include <linux/fs_struct.h> |
39 | #include <linux/gfp.h> | 39 | #include <linux/gfp.h> |
40 | #include <linux/syscore_ops.h> | ||
40 | 41 | ||
41 | #include <linux/compat.h> | 42 | #include <linux/compat.h> |
42 | #include <linux/syscalls.h> | 43 | #include <linux/syscalls.h> |
@@ -298,6 +299,7 @@ void kernel_restart_prepare(char *cmd) | |||
298 | system_state = SYSTEM_RESTART; | 299 | system_state = SYSTEM_RESTART; |
299 | device_shutdown(); | 300 | device_shutdown(); |
300 | sysdev_shutdown(); | 301 | sysdev_shutdown(); |
302 | syscore_shutdown(); | ||
301 | } | 303 | } |
302 | 304 | ||
303 | /** | 305 | /** |
@@ -336,6 +338,7 @@ void kernel_halt(void) | |||
336 | { | 338 | { |
337 | kernel_shutdown_prepare(SYSTEM_HALT); | 339 | kernel_shutdown_prepare(SYSTEM_HALT); |
338 | sysdev_shutdown(); | 340 | sysdev_shutdown(); |
341 | syscore_shutdown(); | ||
339 | printk(KERN_EMERG "System halted.\n"); | 342 | printk(KERN_EMERG "System halted.\n"); |
340 | kmsg_dump(KMSG_DUMP_HALT); | 343 | kmsg_dump(KMSG_DUMP_HALT); |
341 | machine_halt(); | 344 | machine_halt(); |
@@ -355,6 +358,7 @@ void kernel_power_off(void) | |||
355 | pm_power_off_prepare(); | 358 | pm_power_off_prepare(); |
356 | disable_nonboot_cpus(); | 359 | disable_nonboot_cpus(); |
357 | sysdev_shutdown(); | 360 | sysdev_shutdown(); |
361 | syscore_shutdown(); | ||
358 | printk(KERN_EMERG "Power down.\n"); | 362 | printk(KERN_EMERG "Power down.\n"); |
359 | kmsg_dump(KMSG_DUMP_POWEROFF); | 363 | kmsg_dump(KMSG_DUMP_POWEROFF); |
360 | machine_power_off(); | 364 | machine_power_off(); |