aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/power/disk.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index 53c22d9cf577..d09da0895174 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -458,20 +458,13 @@ static void power_down(void)
458 while(1); 458 while(1);
459} 459}
460 460
461static void unprepare_processes(void)
462{
463 thaw_processes();
464 pm_restore_console();
465}
466
467static int prepare_processes(void) 461static int prepare_processes(void)
468{ 462{
469 int error = 0; 463 int error = 0;
470 464
471 pm_prepare_console();
472 if (freeze_processes()) { 465 if (freeze_processes()) {
473 error = -EBUSY; 466 error = -EBUSY;
474 unprepare_processes(); 467 thaw_processes();
475 } 468 }
476 return error; 469 return error;
477} 470}
@@ -491,6 +484,7 @@ int hibernate(void)
491 goto Unlock; 484 goto Unlock;
492 } 485 }
493 486
487 pm_prepare_console();
494 error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE); 488 error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
495 if (error) 489 if (error)
496 goto Exit; 490 goto Exit;
@@ -530,11 +524,12 @@ int hibernate(void)
530 swsusp_free(); 524 swsusp_free();
531 } 525 }
532 Thaw: 526 Thaw:
533 unprepare_processes(); 527 thaw_processes();
534 Finish: 528 Finish:
535 free_basic_memory_bitmaps(); 529 free_basic_memory_bitmaps();
536 Exit: 530 Exit:
537 pm_notifier_call_chain(PM_POST_HIBERNATION); 531 pm_notifier_call_chain(PM_POST_HIBERNATION);
532 pm_restore_console();
538 atomic_inc(&snapshot_device_available); 533 atomic_inc(&snapshot_device_available);
539 Unlock: 534 Unlock:
540 mutex_unlock(&pm_mutex); 535 mutex_unlock(&pm_mutex);
@@ -603,6 +598,7 @@ static int software_resume(void)
603 goto Unlock; 598 goto Unlock;
604 } 599 }
605 600
601 pm_prepare_console();
606 error = pm_notifier_call_chain(PM_RESTORE_PREPARE); 602 error = pm_notifier_call_chain(PM_RESTORE_PREPARE);
607 if (error) 603 if (error)
608 goto Finish; 604 goto Finish;
@@ -626,11 +622,12 @@ static int software_resume(void)
626 622
627 printk(KERN_ERR "PM: Restore failed, recovering.\n"); 623 printk(KERN_ERR "PM: Restore failed, recovering.\n");
628 swsusp_free(); 624 swsusp_free();
629 unprepare_processes(); 625 thaw_processes();
630 Done: 626 Done:
631 free_basic_memory_bitmaps(); 627 free_basic_memory_bitmaps();
632 Finish: 628 Finish:
633 pm_notifier_call_chain(PM_POST_RESTORE); 629 pm_notifier_call_chain(PM_POST_RESTORE);
630 pm_restore_console();
634 atomic_inc(&snapshot_device_available); 631 atomic_inc(&snapshot_device_available);
635 /* For success case, the suspend path will release the lock */ 632 /* For success case, the suspend path will release the lock */
636 Unlock: 633 Unlock: