aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mmc
diff options
context:
space:
mode:
authorMaxim Levitsky <maximlevitsky@gmail.com>2010-08-10 21:01:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-11 11:59:03 -0400
commit4c2ef25fe0b847d2ae818f74758ddb0be1c27d8e (patch)
tree76dd136c6248c7bfffbf6663951e9e6b38238f20 /include/linux/mmc
parent7310ece86ad7da027f85a37a0638164118a5d12f (diff)
mmc: fix all hangs related to mmc/sd card insert/removal during suspend/resume
If you don't use CONFIG_MMC_UNSAFE_RESUME, as soon as you attempt to suspend, the card will be removed, therefore this patch doesn't change the behavior of this option. However the removal will be done by pm notifier, which runs while userspace is still not frozen and thus can freely use del_gendisk, without the risk of deadlock which would happen otherwise. Card detect workqueue is now disabled while userspace is frozen, Therefore if you do use CONFIG_MMC_UNSAFE_RESUME, and remove the card during suspend, the removal will be detected as soon as userspace is unfrozen, again at the moment it is safe to call del_gendisk. Tested with and without CONFIG_MMC_UNSAFE_RESUME with suspend and hibernate. [akpm@linux-foundation.org: clean up function prototype] [akpm@linux-foundation.org: fix CONFIG_PM-n linkage, small cleanups] [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Cc: David Brownell <david-b@pacbell.net> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: <linux-mmc@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/mmc')
-rw-r--r--include/linux/mmc/host.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index f65913c9f5a4..513ff0376b09 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -124,6 +124,7 @@ struct mmc_host {
124 unsigned int f_min; 124 unsigned int f_min;
125 unsigned int f_max; 125 unsigned int f_max;
126 u32 ocr_avail; 126 u32 ocr_avail;
127 struct notifier_block pm_notify;
127 128
128#define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */ 129#define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */
129#define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */ 130#define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */
@@ -183,6 +184,7 @@ struct mmc_host {
183 184
184 /* Only used with MMC_CAP_DISABLE */ 185 /* Only used with MMC_CAP_DISABLE */
185 int enabled; /* host is enabled */ 186 int enabled; /* host is enabled */
187 int rescan_disable; /* disable card detection */
186 int nesting_cnt; /* "enable" nesting count */ 188 int nesting_cnt; /* "enable" nesting count */
187 int en_dis_recurs; /* detect recursion */ 189 int en_dis_recurs; /* detect recursion */
188 unsigned int disable_delay; /* disable delay in msecs */ 190 unsigned int disable_delay; /* disable delay in msecs */
@@ -257,6 +259,7 @@ int mmc_card_can_sleep(struct mmc_host *host);
257int mmc_host_enable(struct mmc_host *host); 259int mmc_host_enable(struct mmc_host *host);
258int mmc_host_disable(struct mmc_host *host); 260int mmc_host_disable(struct mmc_host *host);
259int mmc_host_lazy_disable(struct mmc_host *host); 261int mmc_host_lazy_disable(struct mmc_host *host);
262int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *);
260 263
261static inline void mmc_set_disable_delay(struct mmc_host *host, 264static inline void mmc_set_disable_delay(struct mmc_host *host,
262 unsigned int disable_delay) 265 unsigned int disable_delay)