diff options
Diffstat (limited to 'kernel/power/hibernate.c')
-rw-r--r-- | kernel/power/hibernate.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index c77963938bca..657272e91d0a 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include "power.h" | 29 | #include "power.h" |
30 | 30 | ||
31 | 31 | ||
32 | static int nocompress = 0; | ||
32 | static int noresume = 0; | 33 | static int noresume = 0; |
33 | static char resume_file[256] = CONFIG_PM_STD_PARTITION; | 34 | static char resume_file[256] = CONFIG_PM_STD_PARTITION; |
34 | dev_t swsusp_resume_device; | 35 | dev_t swsusp_resume_device; |
@@ -338,7 +339,6 @@ int hibernation_snapshot(int platform_mode) | |||
338 | goto Close; | 339 | goto Close; |
339 | 340 | ||
340 | suspend_console(); | 341 | suspend_console(); |
341 | hibernation_freeze_swap(); | ||
342 | saved_mask = clear_gfp_allowed_mask(GFP_IOFS); | 342 | saved_mask = clear_gfp_allowed_mask(GFP_IOFS); |
343 | error = dpm_suspend_start(PMSG_FREEZE); | 343 | error = dpm_suspend_start(PMSG_FREEZE); |
344 | if (error) | 344 | if (error) |
@@ -639,6 +639,8 @@ int hibernate(void) | |||
639 | 639 | ||
640 | if (hibernation_mode == HIBERNATION_PLATFORM) | 640 | if (hibernation_mode == HIBERNATION_PLATFORM) |
641 | flags |= SF_PLATFORM_MODE; | 641 | flags |= SF_PLATFORM_MODE; |
642 | if (nocompress) | ||
643 | flags |= SF_NOCOMPRESS_MODE; | ||
642 | pr_debug("PM: writing image.\n"); | 644 | pr_debug("PM: writing image.\n"); |
643 | error = swsusp_write(flags); | 645 | error = swsusp_write(flags); |
644 | swsusp_free(); | 646 | swsusp_free(); |
@@ -706,7 +708,7 @@ static int software_resume(void) | |||
706 | goto Unlock; | 708 | goto Unlock; |
707 | } | 709 | } |
708 | 710 | ||
709 | pr_debug("PM: Checking image partition %s\n", resume_file); | 711 | pr_debug("PM: Checking hibernation image partition %s\n", resume_file); |
710 | 712 | ||
711 | /* Check if the device is there */ | 713 | /* Check if the device is there */ |
712 | swsusp_resume_device = name_to_dev_t(resume_file); | 714 | swsusp_resume_device = name_to_dev_t(resume_file); |
@@ -731,10 +733,10 @@ static int software_resume(void) | |||
731 | } | 733 | } |
732 | 734 | ||
733 | Check_image: | 735 | Check_image: |
734 | pr_debug("PM: Resume from partition %d:%d\n", | 736 | pr_debug("PM: Hibernation image partition %d:%d present\n", |
735 | MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device)); | 737 | MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device)); |
736 | 738 | ||
737 | pr_debug("PM: Checking hibernation image.\n"); | 739 | pr_debug("PM: Looking for hibernation image.\n"); |
738 | error = swsusp_check(); | 740 | error = swsusp_check(); |
739 | if (error) | 741 | if (error) |
740 | goto Unlock; | 742 | goto Unlock; |
@@ -766,14 +768,14 @@ static int software_resume(void) | |||
766 | goto Done; | 768 | goto Done; |
767 | } | 769 | } |
768 | 770 | ||
769 | pr_debug("PM: Reading hibernation image.\n"); | 771 | pr_debug("PM: Loading hibernation image.\n"); |
770 | 772 | ||
771 | error = swsusp_read(&flags); | 773 | error = swsusp_read(&flags); |
772 | swsusp_close(FMODE_READ); | 774 | swsusp_close(FMODE_READ); |
773 | if (!error) | 775 | if (!error) |
774 | hibernation_restore(flags & SF_PLATFORM_MODE); | 776 | hibernation_restore(flags & SF_PLATFORM_MODE); |
775 | 777 | ||
776 | printk(KERN_ERR "PM: Restore failed, recovering.\n"); | 778 | printk(KERN_ERR "PM: Failed to load hibernation image, recovering.\n"); |
777 | swsusp_free(); | 779 | swsusp_free(); |
778 | thaw_processes(); | 780 | thaw_processes(); |
779 | Done: | 781 | Done: |
@@ -786,7 +788,7 @@ static int software_resume(void) | |||
786 | /* For success case, the suspend path will release the lock */ | 788 | /* For success case, the suspend path will release the lock */ |
787 | Unlock: | 789 | Unlock: |
788 | mutex_unlock(&pm_mutex); | 790 | mutex_unlock(&pm_mutex); |
789 | pr_debug("PM: Resume from disk failed.\n"); | 791 | pr_debug("PM: Hibernation image not present or could not be loaded.\n"); |
790 | return error; | 792 | return error; |
791 | close_finish: | 793 | close_finish: |
792 | swsusp_close(FMODE_READ); | 794 | swsusp_close(FMODE_READ); |
@@ -1005,6 +1007,15 @@ static int __init resume_offset_setup(char *str) | |||
1005 | return 1; | 1007 | return 1; |
1006 | } | 1008 | } |
1007 | 1009 | ||
1010 | static int __init hibernate_setup(char *str) | ||
1011 | { | ||
1012 | if (!strncmp(str, "noresume", 8)) | ||
1013 | noresume = 1; | ||
1014 | else if (!strncmp(str, "nocompress", 10)) | ||
1015 | nocompress = 1; | ||
1016 | return 1; | ||
1017 | } | ||
1018 | |||
1008 | static int __init noresume_setup(char *str) | 1019 | static int __init noresume_setup(char *str) |
1009 | { | 1020 | { |
1010 | noresume = 1; | 1021 | noresume = 1; |
@@ -1014,3 +1025,4 @@ static int __init noresume_setup(char *str) | |||
1014 | __setup("noresume", noresume_setup); | 1025 | __setup("noresume", noresume_setup); |
1015 | __setup("resume_offset=", resume_offset_setup); | 1026 | __setup("resume_offset=", resume_offset_setup); |
1016 | __setup("resume=", resume_setup); | 1027 | __setup("resume=", resume_setup); |
1028 | __setup("hibernate=", hibernate_setup); | ||