diff options
Diffstat (limited to 'kernel/power/hibernate.c')
-rw-r--r-- | kernel/power/hibernate.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index aa9e916da4d5..c77963938bca 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (c) 2003 Patrick Mochel | 4 | * Copyright (c) 2003 Patrick Mochel |
5 | * Copyright (c) 2003 Open Source Development Lab | 5 | * Copyright (c) 2003 Open Source Development Lab |
6 | * Copyright (c) 2004 Pavel Machek <pavel@suse.cz> | 6 | * Copyright (c) 2004 Pavel Machek <pavel@ucw.cz> |
7 | * Copyright (c) 2009 Rafael J. Wysocki, Novell Inc. | 7 | * Copyright (c) 2009 Rafael J. Wysocki, Novell Inc. |
8 | * | 8 | * |
9 | * This file is released under the GPLv2. | 9 | * This file is released under the GPLv2. |
@@ -277,7 +277,7 @@ static int create_image(int platform_mode) | |||
277 | goto Enable_irqs; | 277 | goto Enable_irqs; |
278 | } | 278 | } |
279 | 279 | ||
280 | if (hibernation_test(TEST_CORE)) | 280 | if (hibernation_test(TEST_CORE) || !pm_check_wakeup_events()) |
281 | goto Power_up; | 281 | goto Power_up; |
282 | 282 | ||
283 | in_suspend = 1; | 283 | in_suspend = 1; |
@@ -288,8 +288,10 @@ static int create_image(int platform_mode) | |||
288 | error); | 288 | error); |
289 | /* Restore control flow magically appears here */ | 289 | /* Restore control flow magically appears here */ |
290 | restore_processor_state(); | 290 | restore_processor_state(); |
291 | if (!in_suspend) | 291 | if (!in_suspend) { |
292 | events_check_enabled = false; | ||
292 | platform_leave(platform_mode); | 293 | platform_leave(platform_mode); |
294 | } | ||
293 | 295 | ||
294 | Power_up: | 296 | Power_up: |
295 | sysdev_resume(); | 297 | sysdev_resume(); |
@@ -328,7 +330,7 @@ int hibernation_snapshot(int platform_mode) | |||
328 | 330 | ||
329 | error = platform_begin(platform_mode); | 331 | error = platform_begin(platform_mode); |
330 | if (error) | 332 | if (error) |
331 | return error; | 333 | goto Close; |
332 | 334 | ||
333 | /* Preallocate image memory before shutting down devices. */ | 335 | /* Preallocate image memory before shutting down devices. */ |
334 | error = hibernate_preallocate_memory(); | 336 | error = hibernate_preallocate_memory(); |
@@ -336,6 +338,7 @@ int hibernation_snapshot(int platform_mode) | |||
336 | goto Close; | 338 | goto Close; |
337 | 339 | ||
338 | suspend_console(); | 340 | suspend_console(); |
341 | hibernation_freeze_swap(); | ||
339 | saved_mask = clear_gfp_allowed_mask(GFP_IOFS); | 342 | saved_mask = clear_gfp_allowed_mask(GFP_IOFS); |
340 | error = dpm_suspend_start(PMSG_FREEZE); | 343 | error = dpm_suspend_start(PMSG_FREEZE); |
341 | if (error) | 344 | if (error) |
@@ -511,18 +514,24 @@ int hibernation_platform_enter(void) | |||
511 | 514 | ||
512 | local_irq_disable(); | 515 | local_irq_disable(); |
513 | sysdev_suspend(PMSG_HIBERNATE); | 516 | sysdev_suspend(PMSG_HIBERNATE); |
517 | if (!pm_check_wakeup_events()) { | ||
518 | error = -EAGAIN; | ||
519 | goto Power_up; | ||
520 | } | ||
521 | |||
514 | hibernation_ops->enter(); | 522 | hibernation_ops->enter(); |
515 | /* We should never get here */ | 523 | /* We should never get here */ |
516 | while (1); | 524 | while (1); |
517 | 525 | ||
518 | /* | 526 | Power_up: |
519 | * We don't need to reenable the nonboot CPUs or resume consoles, since | 527 | sysdev_resume(); |
520 | * the system is going to be halted anyway. | 528 | local_irq_enable(); |
521 | */ | 529 | enable_nonboot_cpus(); |
530 | |||
522 | Platform_finish: | 531 | Platform_finish: |
523 | hibernation_ops->finish(); | 532 | hibernation_ops->finish(); |
524 | 533 | ||
525 | dpm_suspend_noirq(PMSG_RESTORE); | 534 | dpm_resume_noirq(PMSG_RESTORE); |
526 | 535 | ||
527 | Resume_devices: | 536 | Resume_devices: |
528 | entering_platform_hibernation = false; | 537 | entering_platform_hibernation = false; |