diff options
Diffstat (limited to 'kernel/power/hibernate.c')
| -rw-r--r-- | kernel/power/hibernate.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 8dc31e02ae12..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; |
| @@ -638,6 +639,8 @@ int hibernate(void) | |||
| 638 | 639 | ||
| 639 | if (hibernation_mode == HIBERNATION_PLATFORM) | 640 | if (hibernation_mode == HIBERNATION_PLATFORM) |
| 640 | flags |= SF_PLATFORM_MODE; | 641 | flags |= SF_PLATFORM_MODE; |
| 642 | if (nocompress) | ||
| 643 | flags |= SF_NOCOMPRESS_MODE; | ||
| 641 | pr_debug("PM: writing image.\n"); | 644 | pr_debug("PM: writing image.\n"); |
| 642 | error = swsusp_write(flags); | 645 | error = swsusp_write(flags); |
| 643 | swsusp_free(); | 646 | swsusp_free(); |
| @@ -705,7 +708,7 @@ static int software_resume(void) | |||
| 705 | goto Unlock; | 708 | goto Unlock; |
| 706 | } | 709 | } |
| 707 | 710 | ||
| 708 | pr_debug("PM: Checking image partition %s\n", resume_file); | 711 | pr_debug("PM: Checking hibernation image partition %s\n", resume_file); |
| 709 | 712 | ||
| 710 | /* Check if the device is there */ | 713 | /* Check if the device is there */ |
| 711 | swsusp_resume_device = name_to_dev_t(resume_file); | 714 | swsusp_resume_device = name_to_dev_t(resume_file); |
| @@ -730,10 +733,10 @@ static int software_resume(void) | |||
| 730 | } | 733 | } |
| 731 | 734 | ||
| 732 | Check_image: | 735 | Check_image: |
| 733 | pr_debug("PM: Resume from partition %d:%d\n", | 736 | pr_debug("PM: Hibernation image partition %d:%d present\n", |
| 734 | MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device)); | 737 | MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device)); |
| 735 | 738 | ||
| 736 | pr_debug("PM: Checking hibernation image.\n"); | 739 | pr_debug("PM: Looking for hibernation image.\n"); |
| 737 | error = swsusp_check(); | 740 | error = swsusp_check(); |
| 738 | if (error) | 741 | if (error) |
| 739 | goto Unlock; | 742 | goto Unlock; |
| @@ -765,14 +768,14 @@ static int software_resume(void) | |||
| 765 | goto Done; | 768 | goto Done; |
| 766 | } | 769 | } |
| 767 | 770 | ||
| 768 | pr_debug("PM: Reading hibernation image.\n"); | 771 | pr_debug("PM: Loading hibernation image.\n"); |
| 769 | 772 | ||
| 770 | error = swsusp_read(&flags); | 773 | error = swsusp_read(&flags); |
| 771 | swsusp_close(FMODE_READ); | 774 | swsusp_close(FMODE_READ); |
| 772 | if (!error) | 775 | if (!error) |
| 773 | hibernation_restore(flags & SF_PLATFORM_MODE); | 776 | hibernation_restore(flags & SF_PLATFORM_MODE); |
| 774 | 777 | ||
| 775 | printk(KERN_ERR "PM: Restore failed, recovering.\n"); | 778 | printk(KERN_ERR "PM: Failed to load hibernation image, recovering.\n"); |
| 776 | swsusp_free(); | 779 | swsusp_free(); |
| 777 | thaw_processes(); | 780 | thaw_processes(); |
| 778 | Done: | 781 | Done: |
| @@ -785,7 +788,7 @@ static int software_resume(void) | |||
| 785 | /* For success case, the suspend path will release the lock */ | 788 | /* For success case, the suspend path will release the lock */ |
| 786 | Unlock: | 789 | Unlock: |
| 787 | mutex_unlock(&pm_mutex); | 790 | mutex_unlock(&pm_mutex); |
| 788 | pr_debug("PM: Resume from disk failed.\n"); | 791 | pr_debug("PM: Hibernation image not present or could not be loaded.\n"); |
| 789 | return error; | 792 | return error; |
| 790 | close_finish: | 793 | close_finish: |
| 791 | swsusp_close(FMODE_READ); | 794 | swsusp_close(FMODE_READ); |
| @@ -1004,6 +1007,15 @@ static int __init resume_offset_setup(char *str) | |||
| 1004 | return 1; | 1007 | return 1; |
| 1005 | } | 1008 | } |
| 1006 | 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 | |||
| 1007 | static int __init noresume_setup(char *str) | 1019 | static int __init noresume_setup(char *str) |
| 1008 | { | 1020 | { |
| 1009 | noresume = 1; | 1021 | noresume = 1; |
| @@ -1013,3 +1025,4 @@ static int __init noresume_setup(char *str) | |||
| 1013 | __setup("noresume", noresume_setup); | 1025 | __setup("noresume", noresume_setup); |
| 1014 | __setup("resume_offset=", resume_offset_setup); | 1026 | __setup("resume_offset=", resume_offset_setup); |
| 1015 | __setup("resume=", resume_setup); | 1027 | __setup("resume=", resume_setup); |
| 1028 | __setup("hibernate=", hibernate_setup); | ||
