aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/hibernate.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/power/hibernate.c')
-rw-r--r--kernel/power/hibernate.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index e1914c7b85b1..a5c36e9c56a6 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -651,7 +651,7 @@ static int load_image_and_restore(void)
651 int error; 651 int error;
652 unsigned int flags; 652 unsigned int flags;
653 653
654 pr_debug("Loading hibernation image.\n"); 654 pm_pr_dbg("Loading hibernation image.\n");
655 655
656 lock_device_hotplug(); 656 lock_device_hotplug();
657 error = create_basic_memory_bitmaps(); 657 error = create_basic_memory_bitmaps();
@@ -681,7 +681,7 @@ int hibernate(void)
681 bool snapshot_test = false; 681 bool snapshot_test = false;
682 682
683 if (!hibernation_available()) { 683 if (!hibernation_available()) {
684 pr_debug("Hibernation not available.\n"); 684 pm_pr_dbg("Hibernation not available.\n");
685 return -EPERM; 685 return -EPERM;
686 } 686 }
687 687
@@ -692,6 +692,7 @@ int hibernate(void)
692 goto Unlock; 692 goto Unlock;
693 } 693 }
694 694
695 pr_info("hibernation entry\n");
695 pm_prepare_console(); 696 pm_prepare_console();
696 error = __pm_notifier_call_chain(PM_HIBERNATION_PREPARE, -1, &nr_calls); 697 error = __pm_notifier_call_chain(PM_HIBERNATION_PREPARE, -1, &nr_calls);
697 if (error) { 698 if (error) {
@@ -727,7 +728,7 @@ int hibernate(void)
727 else 728 else
728 flags |= SF_CRC32_MODE; 729 flags |= SF_CRC32_MODE;
729 730
730 pr_debug("Writing image.\n"); 731 pm_pr_dbg("Writing image.\n");
731 error = swsusp_write(flags); 732 error = swsusp_write(flags);
732 swsusp_free(); 733 swsusp_free();
733 if (!error) { 734 if (!error) {
@@ -739,7 +740,7 @@ int hibernate(void)
739 in_suspend = 0; 740 in_suspend = 0;
740 pm_restore_gfp_mask(); 741 pm_restore_gfp_mask();
741 } else { 742 } else {
742 pr_debug("Image restored successfully.\n"); 743 pm_pr_dbg("Image restored successfully.\n");
743 } 744 }
744 745
745 Free_bitmaps: 746 Free_bitmaps:
@@ -747,7 +748,7 @@ int hibernate(void)
747 Thaw: 748 Thaw:
748 unlock_device_hotplug(); 749 unlock_device_hotplug();
749 if (snapshot_test) { 750 if (snapshot_test) {
750 pr_debug("Checking hibernation image\n"); 751 pm_pr_dbg("Checking hibernation image\n");
751 error = swsusp_check(); 752 error = swsusp_check();
752 if (!error) 753 if (!error)
753 error = load_image_and_restore(); 754 error = load_image_and_restore();
@@ -762,6 +763,8 @@ int hibernate(void)
762 atomic_inc(&snapshot_device_available); 763 atomic_inc(&snapshot_device_available);
763 Unlock: 764 Unlock:
764 unlock_system_sleep(); 765 unlock_system_sleep();
766 pr_info("hibernation exit\n");
767
765 return error; 768 return error;
766} 769}
767 770
@@ -811,7 +814,7 @@ static int software_resume(void)
811 goto Unlock; 814 goto Unlock;
812 } 815 }
813 816
814 pr_debug("Checking hibernation image partition %s\n", resume_file); 817 pm_pr_dbg("Checking hibernation image partition %s\n", resume_file);
815 818
816 if (resume_delay) { 819 if (resume_delay) {
817 pr_info("Waiting %dsec before reading resume device ...\n", 820 pr_info("Waiting %dsec before reading resume device ...\n",
@@ -853,10 +856,10 @@ static int software_resume(void)
853 } 856 }
854 857
855 Check_image: 858 Check_image:
856 pr_debug("Hibernation image partition %d:%d present\n", 859 pm_pr_dbg("Hibernation image partition %d:%d present\n",
857 MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device)); 860 MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device));
858 861
859 pr_debug("Looking for hibernation image.\n"); 862 pm_pr_dbg("Looking for hibernation image.\n");
860 error = swsusp_check(); 863 error = swsusp_check();
861 if (error) 864 if (error)
862 goto Unlock; 865 goto Unlock;
@@ -868,6 +871,7 @@ static int software_resume(void)
868 goto Unlock; 871 goto Unlock;
869 } 872 }
870 873
874 pr_info("resume from hibernation\n");
871 pm_prepare_console(); 875 pm_prepare_console();
872 error = __pm_notifier_call_chain(PM_RESTORE_PREPARE, -1, &nr_calls); 876 error = __pm_notifier_call_chain(PM_RESTORE_PREPARE, -1, &nr_calls);
873 if (error) { 877 if (error) {
@@ -875,7 +879,7 @@ static int software_resume(void)
875 goto Close_Finish; 879 goto Close_Finish;
876 } 880 }
877 881
878 pr_debug("Preparing processes for restore.\n"); 882 pm_pr_dbg("Preparing processes for restore.\n");
879 error = freeze_processes(); 883 error = freeze_processes();
880 if (error) 884 if (error)
881 goto Close_Finish; 885 goto Close_Finish;
@@ -884,11 +888,12 @@ static int software_resume(void)
884 Finish: 888 Finish:
885 __pm_notifier_call_chain(PM_POST_RESTORE, nr_calls, NULL); 889 __pm_notifier_call_chain(PM_POST_RESTORE, nr_calls, NULL);
886 pm_restore_console(); 890 pm_restore_console();
891 pr_info("resume from hibernation failed (%d)\n", error);
887 atomic_inc(&snapshot_device_available); 892 atomic_inc(&snapshot_device_available);
888 /* For success case, the suspend path will release the lock */ 893 /* For success case, the suspend path will release the lock */
889 Unlock: 894 Unlock:
890 mutex_unlock(&pm_mutex); 895 mutex_unlock(&pm_mutex);
891 pr_debug("Hibernation image not present or could not be loaded.\n"); 896 pm_pr_dbg("Hibernation image not present or could not be loaded.\n");
892 return error; 897 return error;
893 Close_Finish: 898 Close_Finish:
894 swsusp_close(FMODE_READ); 899 swsusp_close(FMODE_READ);
@@ -1012,8 +1017,8 @@ static ssize_t disk_store(struct kobject *kobj, struct kobj_attribute *attr,
1012 error = -EINVAL; 1017 error = -EINVAL;
1013 1018
1014 if (!error) 1019 if (!error)
1015 pr_debug("Hibernation mode set to '%s'\n", 1020 pm_pr_dbg("Hibernation mode set to '%s'\n",
1016 hibernation_modes[mode]); 1021 hibernation_modes[mode]);
1017 unlock_system_sleep(); 1022 unlock_system_sleep();
1018 return error ? error : n; 1023 return error ? error : n;
1019} 1024}