aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorBarry Song <baohua.song@csr.com>2011-10-06 14:34:46 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-10-16 17:30:36 -0400
commit6f8d7022a842809aeb24db1d15669198ef02c131 (patch)
treeae1d4bacda83b3f430c644cf2479ffb1948bb30c /kernel
parent21e82808fc465b66fedaac0f4e885cafb304e843 (diff)
PM / Hibernate: Add resumewait param to support MMC-like devices as resume file
Some devices like MMC are async detected very slow. For example, drivers/mmc/host/sdhci.c launches a 200ms delayed work to detect MMC partitions then add disk. We have wait_for_device_probe() and scsi_complete_async_scans() before calling swsusp_check(), but it is not enough to wait for MMC. This patch adds resumewait kernel param just like rootwait so that we have enough time to wait until MMC is ready. The difference is that we wait for resume partition whereas rootwait waits for rootfs partition (which may be on a different device). This patch will make hibernation support many embedded products without SCSI devices, but with devices like MMC. [rjw: Modified the changelog slightly.] Signed-off-by: Barry Song <Baohua.Song@csr.com> Reviewed-by: Valdis Kletnieks <valdis.kletnieks@vt.edu> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/power/hibernate.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 7f44e5c2697..0f8785080cd 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -14,6 +14,7 @@
14#include <linux/reboot.h> 14#include <linux/reboot.h>
15#include <linux/string.h> 15#include <linux/string.h>
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/async.h>
17#include <linux/kmod.h> 18#include <linux/kmod.h>
18#include <linux/delay.h> 19#include <linux/delay.h>
19#include <linux/fs.h> 20#include <linux/fs.h>
@@ -31,6 +32,7 @@
31 32
32static int nocompress = 0; 33static int nocompress = 0;
33static int noresume = 0; 34static int noresume = 0;
35static int resume_wait = 0;
34static char resume_file[256] = CONFIG_PM_STD_PARTITION; 36static char resume_file[256] = CONFIG_PM_STD_PARTITION;
35dev_t swsusp_resume_device; 37dev_t swsusp_resume_device;
36sector_t swsusp_resume_block; 38sector_t swsusp_resume_block;
@@ -736,6 +738,13 @@ static int software_resume(void)
736 * to wait for this to finish. 738 * to wait for this to finish.
737 */ 739 */
738 wait_for_device_probe(); 740 wait_for_device_probe();
741
742 if (resume_wait) {
743 while ((swsusp_resume_device = name_to_dev_t(resume_file)) == 0)
744 msleep(10);
745 async_synchronize_full();
746 }
747
739 /* 748 /*
740 * We can't depend on SCSI devices being available after loading 749 * We can't depend on SCSI devices being available after loading
741 * one of their modules until scsi_complete_async_scans() is 750 * one of their modules until scsi_complete_async_scans() is
@@ -1064,7 +1073,14 @@ static int __init noresume_setup(char *str)
1064 return 1; 1073 return 1;
1065} 1074}
1066 1075
1076static int __init resumewait_setup(char *str)
1077{
1078 resume_wait = 1;
1079 return 1;
1080}
1081
1067__setup("noresume", noresume_setup); 1082__setup("noresume", noresume_setup);
1068__setup("resume_offset=", resume_offset_setup); 1083__setup("resume_offset=", resume_offset_setup);
1069__setup("resume=", resume_setup); 1084__setup("resume=", resume_setup);
1070__setup("hibernate=", hibernate_setup); 1085__setup("hibernate=", hibernate_setup);
1086__setup("resumewait", resumewait_setup);