From: Barry Song <Barry.Song@csr.com>
To: <pavel@ucw.cz>, <rjw@sisk.pl>, <frank.hofmann@tomtom.com>
Cc: <linux-pm@lists.linux-foundation.org>,
<linux-mmc@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <workgroup.linux@csr.com>,
Barry Song <baohua.song@csr.com>,
Barry Song <Baohua.Song@csr.com>
Subject: [PATCH] PM: HIBERNATION: add resume_wait param to support MMC-like devices as resume file
Date: Thu, 29 Sep 2011 02:29:08 -0700 [thread overview]
Message-ID: <1317288548-19560-1-git-send-email-Barry.Song@csr.com> (raw)
From: Barry Song <baohua.song@csr.com>
Some devices like mmc are async detected very slow. For example,
drivers/mmc/host/sdhci.c launchs a 200ms delayed work to detect
mmc partitions then add disk.
we do have wait_for_device_probe and scsi_complete_async_scans
before calling swsusp_check, but it is not enough to wait mmc.
This patch adds resumewait kernel param just like rootwait so
that we have enough time to wait mmc ready. The differene is
here we wait for resume partition but rootwait waits for rootfs
partition.
This patch will make swsusp support many embedded products
without scsi devices but devices like mmc.
This was tested on one ARM platform with Frank Hofmann's patch.
Signed-off-by: Barry Song <Baohua.Song@csr.com>
---
kernel/power/hibernate.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 8f7b1db..9f4b4f3 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -14,6 +14,7 @@
#include <linux/reboot.h>
#include <linux/string.h>
#include <linux/device.h>
+#include <linux/async.h>
#include <linux/kmod.h>
#include <linux/delay.h>
#include <linux/fs.h>
@@ -31,6 +32,7 @@
static int nocompress = 0;
static int noresume = 0;
+static int resume_wait = 0;
static char resume_file[256] = CONFIG_PM_STD_PARTITION;
dev_t swsusp_resume_device;
sector_t swsusp_resume_block;
@@ -732,6 +734,13 @@ static int software_resume(void)
* to wait for this to finish.
*/
wait_for_device_probe();
+
+ if (resume_wait) {
+ while ((swsusp_resume_device = name_to_dev_t(resume_file)) == 0)
+ msleep(10);
+ async_synchronize_full();
+ }
+
/*
* We can't depend on SCSI devices being available after loading
* one of their modules until scsi_complete_async_scans() is
@@ -1060,7 +1069,14 @@ static int __init noresume_setup(char *str)
return 1;
}
+static int __init resumewait_setup(char *str)
+{
+ resume_wait = 1;
+ return 1;
+}
+
__setup("noresume", noresume_setup);
__setup("resume_offset=", resume_offset_setup);
__setup("resume=", resume_setup);
__setup("hibernate=", hibernate_setup);
+__setup("resumewait", resumewait_setup);
--
1.7.1
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
next reply other threads:[~2011-09-29 9:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-29 9:29 Barry Song [this message]
2011-09-29 12:30 ` Valdis.Kletnieks
2011-09-29 12:43 ` Barry Song
2011-10-04 22:30 ` Rafael J. Wysocki
2011-09-29 15:47 ` Luca Tettamanti
2011-09-29 15:56 ` Luca Tettamanti
2011-09-29 23:21 ` Barry Song
2011-09-29 23:16 ` Barry Song
2011-10-06 17:58 ` Pavel Machek
2011-10-07 15:45 ` Barry Song
2011-10-07 15:46 ` Barry Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1317288548-19560-1-git-send-email-Barry.Song@csr.com \
--to=barry.song@csr.com \
--cc=baohua.song@csr.com \
--cc=frank.hofmann@tomtom.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=pavel@ucw.cz \
--cc=rjw@sisk.pl \
--cc=workgroup.linux@csr.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®