aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Song <baohua.song@csr.com>2011-10-10 17:38:41 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-10-16 17:30:37 -0400
commitf126f7334f72e2fd1b7a62bba20c488b86e6e7c4 (patch)
treec56a286700df963245e56cb8caea3e96565b478b
parentbf1c138e350155edb06709c7fbf0946f252b257c (diff)
PM / Hibernate: Add resumedelay kernel param in addition to resumewait
Patch "PM / Hibernate: Add resumewait param to support MMC-like devices as resume file" added the resumewait kernel command line option. The present patch adds resumedelay so that resumewait/delay were analogous to rootwait/delay. [rjw: Modified the subject and changelog slightly.] Signed-off-by: Barry Song <baohua.song@csr.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
-rw-r--r--Documentation/kernel-parameters.txt3
-rw-r--r--kernel/power/hibernate.c14
2 files changed, 17 insertions, 0 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 88a7b197a4eb..831bde222bde 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2240,6 +2240,9 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
2240 in <PAGE_SIZE> units (needed only for swap files). 2240 in <PAGE_SIZE> units (needed only for swap files).
2241 See Documentation/power/swsusp-and-swap-files.txt 2241 See Documentation/power/swsusp-and-swap-files.txt
2242 2242
2243 resumedelay= [HIBERNATION] Delay (in seconds) to pause before attempting to
2244 read the resume files
2245
2243 resumewait [HIBERNATION] Wait (indefinitely) for resume device to show up. 2246 resumewait [HIBERNATION] Wait (indefinitely) for resume device to show up.
2244 Useful for devices that are detected asynchronously 2247 Useful for devices that are detected asynchronously
2245 (e.g. USB and MMC devices). 2248 (e.g. USB and MMC devices).
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 0f8785080cde..50f537953e70 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -33,6 +33,7 @@
33static int nocompress = 0; 33static int nocompress = 0;
34static int noresume = 0; 34static int noresume = 0;
35static int resume_wait = 0; 35static int resume_wait = 0;
36static int resume_delay = 0;
36static char resume_file[256] = CONFIG_PM_STD_PARTITION; 37static char resume_file[256] = CONFIG_PM_STD_PARTITION;
37dev_t swsusp_resume_device; 38dev_t swsusp_resume_device;
38sector_t swsusp_resume_block; 39sector_t swsusp_resume_block;
@@ -730,6 +731,12 @@ static int software_resume(void)
730 731
731 pr_debug("PM: Checking hibernation image partition %s\n", resume_file); 732 pr_debug("PM: Checking hibernation image partition %s\n", resume_file);
732 733
734 if (resume_delay) {
735 printk(KERN_INFO "Waiting %dsec before reading resume device...\n",
736 resume_delay);
737 ssleep(resume_delay);
738 }
739
733 /* Check if the device is there */ 740 /* Check if the device is there */
734 swsusp_resume_device = name_to_dev_t(resume_file); 741 swsusp_resume_device = name_to_dev_t(resume_file);
735 if (!swsusp_resume_device) { 742 if (!swsusp_resume_device) {
@@ -1079,8 +1086,15 @@ static int __init resumewait_setup(char *str)
1079 return 1; 1086 return 1;
1080} 1087}
1081 1088
1089static int __init resumedelay_setup(char *str)
1090{
1091 resume_delay = simple_strtoul(str, NULL, 0);
1092 return 1;
1093}
1094
1082__setup("noresume", noresume_setup); 1095__setup("noresume", noresume_setup);
1083__setup("resume_offset=", resume_offset_setup); 1096__setup("resume_offset=", resume_offset_setup);
1084__setup("resume=", resume_setup); 1097__setup("resume=", resume_setup);
1085__setup("hibernate=", hibernate_setup); 1098__setup("hibernate=", hibernate_setup);
1086__setup("resumewait", resumewait_setup); 1099__setup("resumewait", resumewait_setup);
1100__setup("resumedelay=", resumedelay_setup);