aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/power/main.c')
-rw-r--r--kernel/power/main.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 40d56a31245e..8812985f3029 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -97,25 +97,26 @@ static int suspend_prepare(suspend_state_t state)
97 } 97 }
98 } 98 }
99 99
100 if (pm_ops->prepare) {
101 if ((error = pm_ops->prepare(state)))
102 goto Thaw;
103 }
104
105 suspend_console(); 100 suspend_console();
106 error = device_suspend(PMSG_SUSPEND); 101 error = device_suspend(PMSG_SUSPEND);
107 if (error) { 102 if (error) {
108 printk(KERN_ERR "Some devices failed to suspend\n"); 103 printk(KERN_ERR "Some devices failed to suspend\n");
109 goto Resume_devices; 104 goto Resume_console;
110 } 105 }
106 if (pm_ops->prepare) {
107 if ((error = pm_ops->prepare(state)))
108 goto Resume_devices;
109 }
110
111 error = disable_nonboot_cpus(); 111 error = disable_nonboot_cpus();
112 if (!error) 112 if (!error)
113 return 0; 113 return 0;
114 114
115 enable_nonboot_cpus(); 115 enable_nonboot_cpus();
116 Resume_devices:
117 pm_finish(state); 116 pm_finish(state);
117 Resume_devices:
118 device_resume(); 118 device_resume();
119 Resume_console:
119 resume_console(); 120 resume_console();
120 Thaw: 121 Thaw:
121 thaw_processes(); 122 thaw_processes();
@@ -289,13 +290,13 @@ static ssize_t state_store(struct kset *kset, const char *buf, size_t n)
289 len = p ? p - buf : n; 290 len = p ? p - buf : n;
290 291
291 /* First, check if we are requested to hibernate */ 292 /* First, check if we are requested to hibernate */
292 if (!strncmp(buf, "disk", len)) { 293 if (len == 4 && !strncmp(buf, "disk", len)) {
293 error = hibernate(); 294 error = hibernate();
294 return error ? error : n; 295 return error ? error : n;
295 } 296 }
296 297
297 for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) { 298 for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) {
298 if (*s && !strncmp(buf, *s, len)) 299 if (*s && len == strlen(*s) && !strncmp(buf, *s, len))
299 break; 300 break;
300 } 301 }
301 if (state < PM_SUSPEND_MAX && *s) 302 if (state < PM_SUSPEND_MAX && *s)