diff options
Diffstat (limited to 'kernel/power/main.c')
-rw-r--r-- | kernel/power/main.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c index 62b0bc6e4983..2981af4ce7cb 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 */ |
@@ -227,7 +224,7 @@ power_attr(state); | |||
227 | * writing to 'state'. It first should read from 'wakeup_count' and store | 224 | * writing to 'state'. It first should read from 'wakeup_count' and store |
228 | * the read value. Then, after carrying out its own preparations for the system | 225 | * the read value. Then, after carrying out its own preparations for the system |
229 | * transition to a sleep state, it should write the stored value to | 226 | * transition to a sleep state, it should write the stored value to |
230 | * 'wakeup_count'. If that fails, at least one wakeup event has occured since | 227 | * 'wakeup_count'. If that fails, at least one wakeup event has occurred since |
231 | * 'wakeup_count' was read and 'state' should not be written to. Otherwise, it | 228 | * 'wakeup_count' was read and 'state' should not be written to. Otherwise, it |
232 | * is allowed to write to 'state', but the transition will be aborted if there | 229 | * is allowed to write to 'state', but the transition will be aborted if there |
233 | * are any wakeup events detected after 'wakeup_count' was written to. | 230 | * are any wakeup events detected after 'wakeup_count' was written to. |
@@ -237,18 +234,18 @@ static ssize_t wakeup_count_show(struct kobject *kobj, | |||
237 | struct kobj_attribute *attr, | 234 | struct kobj_attribute *attr, |
238 | char *buf) | 235 | char *buf) |
239 | { | 236 | { |
240 | unsigned long val; | 237 | unsigned int val; |
241 | 238 | ||
242 | return pm_get_wakeup_count(&val) ? sprintf(buf, "%lu\n", val) : -EINTR; | 239 | return pm_get_wakeup_count(&val) ? sprintf(buf, "%u\n", val) : -EINTR; |
243 | } | 240 | } |
244 | 241 | ||
245 | static ssize_t wakeup_count_store(struct kobject *kobj, | 242 | static ssize_t wakeup_count_store(struct kobject *kobj, |
246 | struct kobj_attribute *attr, | 243 | struct kobj_attribute *attr, |
247 | const char *buf, size_t n) | 244 | const char *buf, size_t n) |
248 | { | 245 | { |
249 | unsigned long val; | 246 | unsigned int val; |
250 | 247 | ||
251 | if (sscanf(buf, "%lu", &val) == 1) { | 248 | if (sscanf(buf, "%u", &val) == 1) { |
252 | if (pm_save_wakeup_count(val)) | 249 | if (pm_save_wakeup_count(val)) |
253 | return n; | 250 | return n; |
254 | } | 251 | } |
@@ -281,12 +278,30 @@ pm_trace_store(struct kobject *kobj, struct kobj_attribute *attr, | |||
281 | } | 278 | } |
282 | 279 | ||
283 | power_attr(pm_trace); | 280 | power_attr(pm_trace); |
281 | |||
282 | static ssize_t pm_trace_dev_match_show(struct kobject *kobj, | ||
283 | struct kobj_attribute *attr, | ||
284 | char *buf) | ||
285 | { | ||
286 | return show_trace_dev_match(buf, PAGE_SIZE); | ||
287 | } | ||
288 | |||
289 | static ssize_t | ||
290 | pm_trace_dev_match_store(struct kobject *kobj, struct kobj_attribute *attr, | ||
291 | const char *buf, size_t n) | ||
292 | { | ||
293 | return -EINVAL; | ||
294 | } | ||
295 | |||
296 | power_attr(pm_trace_dev_match); | ||
297 | |||
284 | #endif /* CONFIG_PM_TRACE */ | 298 | #endif /* CONFIG_PM_TRACE */ |
285 | 299 | ||
286 | static struct attribute * g[] = { | 300 | static struct attribute * g[] = { |
287 | &state_attr.attr, | 301 | &state_attr.attr, |
288 | #ifdef CONFIG_PM_TRACE | 302 | #ifdef CONFIG_PM_TRACE |
289 | &pm_trace_attr.attr, | 303 | &pm_trace_attr.attr, |
304 | &pm_trace_dev_match_attr.attr, | ||
290 | #endif | 305 | #endif |
291 | #ifdef CONFIG_PM_SLEEP | 306 | #ifdef CONFIG_PM_SLEEP |
292 | &pm_async_attr.attr, | 307 | &pm_async_attr.attr, |
@@ -308,7 +323,7 @@ EXPORT_SYMBOL_GPL(pm_wq); | |||
308 | 323 | ||
309 | static int __init pm_start_workqueue(void) | 324 | static int __init pm_start_workqueue(void) |
310 | { | 325 | { |
311 | pm_wq = create_freezeable_workqueue("pm"); | 326 | pm_wq = alloc_workqueue("pm", WQ_FREEZABLE, 0); |
312 | 327 | ||
313 | return pm_wq ? 0 : -ENOMEM; | 328 | return pm_wq ? 0 : -ENOMEM; |
314 | } | 329 | } |
@@ -321,6 +336,8 @@ static int __init pm_init(void) | |||
321 | int error = pm_start_workqueue(); | 336 | int error = pm_start_workqueue(); |
322 | if (error) | 337 | if (error) |
323 | return error; | 338 | return error; |
339 | hibernate_image_size_init(); | ||
340 | hibernate_reserved_size_init(); | ||
324 | power_kobj = kobject_create_and_add("power", NULL); | 341 | power_kobj = kobject_create_and_add("power", NULL); |
325 | if (!power_kobj) | 342 | if (!power_kobj) |
326 | return -ENOMEM; | 343 | return -ENOMEM; |