diff options
Diffstat (limited to 'kernel/power/main.c')
-rw-r--r-- | kernel/power/main.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c index 2981af4ce7c..3304594553c 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -37,8 +37,9 @@ EXPORT_SYMBOL_GPL(unregister_pm_notifier); | |||
37 | 37 | ||
38 | int pm_notifier_call_chain(unsigned long val) | 38 | int pm_notifier_call_chain(unsigned long val) |
39 | { | 39 | { |
40 | return (blocking_notifier_call_chain(&pm_chain_head, val, NULL) | 40 | int ret = blocking_notifier_call_chain(&pm_chain_head, val, NULL); |
41 | == NOTIFY_BAD) ? -EINVAL : 0; | 41 | |
42 | return notifier_to_errno(ret); | ||
42 | } | 43 | } |
43 | 44 | ||
44 | /* If set, devices may be suspended and resumed asynchronously. */ | 45 | /* If set, devices may be suspended and resumed asynchronously. */ |
@@ -170,7 +171,11 @@ static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr, | |||
170 | const char *buf, size_t n) | 171 | const char *buf, size_t n) |
171 | { | 172 | { |
172 | #ifdef CONFIG_SUSPEND | 173 | #ifdef CONFIG_SUSPEND |
174 | #ifdef CONFIG_EARLYSUSPEND | ||
175 | suspend_state_t state = PM_SUSPEND_ON; | ||
176 | #else | ||
173 | suspend_state_t state = PM_SUSPEND_STANDBY; | 177 | suspend_state_t state = PM_SUSPEND_STANDBY; |
178 | #endif | ||
174 | const char * const *s; | 179 | const char * const *s; |
175 | #endif | 180 | #endif |
176 | char *p; | 181 | char *p; |
@@ -192,8 +197,15 @@ static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr, | |||
192 | break; | 197 | break; |
193 | } | 198 | } |
194 | if (state < PM_SUSPEND_MAX && *s) | 199 | if (state < PM_SUSPEND_MAX && *s) |
200 | #ifdef CONFIG_EARLYSUSPEND | ||
201 | if (state == PM_SUSPEND_ON || valid_state(state)) { | ||
202 | error = 0; | ||
203 | request_suspend_state(state); | ||
204 | } | ||
205 | #else | ||
195 | error = enter_state(state); | 206 | error = enter_state(state); |
196 | #endif | 207 | #endif |
208 | #endif | ||
197 | 209 | ||
198 | Exit: | 210 | Exit: |
199 | return error ? error : n; | 211 | return error ? error : n; |
@@ -297,6 +309,11 @@ power_attr(pm_trace_dev_match); | |||
297 | 309 | ||
298 | #endif /* CONFIG_PM_TRACE */ | 310 | #endif /* CONFIG_PM_TRACE */ |
299 | 311 | ||
312 | #ifdef CONFIG_USER_WAKELOCK | ||
313 | power_attr(wake_lock); | ||
314 | power_attr(wake_unlock); | ||
315 | #endif | ||
316 | |||
300 | static struct attribute * g[] = { | 317 | static struct attribute * g[] = { |
301 | &state_attr.attr, | 318 | &state_attr.attr, |
302 | #ifdef CONFIG_PM_TRACE | 319 | #ifdef CONFIG_PM_TRACE |
@@ -309,6 +326,10 @@ static struct attribute * g[] = { | |||
309 | #ifdef CONFIG_PM_DEBUG | 326 | #ifdef CONFIG_PM_DEBUG |
310 | &pm_test_attr.attr, | 327 | &pm_test_attr.attr, |
311 | #endif | 328 | #endif |
329 | #ifdef CONFIG_USER_WAKELOCK | ||
330 | &wake_lock_attr.attr, | ||
331 | &wake_unlock_attr.attr, | ||
332 | #endif | ||
312 | #endif | 333 | #endif |
313 | NULL, | 334 | NULL, |
314 | }; | 335 | }; |