aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/core.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2012-06-14 04:17:39 -0400
committerChris Ball <cjb@laptop.org>2012-07-21 00:02:21 -0400
commitd9adcc12860d76cf3401c6ab7c0406b15b356b7a (patch)
tree10f2e7c5248ea93ad80105635e2ccdb268ee4dda /drivers/mmc/core/core.c
parentbf68a812f06ca40bccfa2e792055141f2c3948c7 (diff)
mmc: prohibit card detection when host is not ready
Currently mmc host drivers have to decide whether to enable card detection before calling mmc_add_host() -- in which case a card insertion event can arrive before the host has been completely initialised -- or after mmc_add_host(), in which case the initial card detection can be problematic. This patch adds an explicit indication of when card detection should not be carried out. With it in place enabling card detection before calling mmc_add_host() should be safe. Similarly, disabling it again after calling mmc_remove_host() will avoid any races. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/core/core.c')
-rw-r--r--drivers/mmc/core/core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 8d00aef9523..9503cabc96f 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2107,6 +2107,7 @@ void mmc_rescan(struct work_struct *work)
2107void mmc_start_host(struct mmc_host *host) 2107void mmc_start_host(struct mmc_host *host)
2108{ 2108{
2109 host->f_init = max(freqs[0], host->f_min); 2109 host->f_init = max(freqs[0], host->f_min);
2110 host->rescan_disable = 0;
2110 mmc_power_up(host); 2111 mmc_power_up(host);
2111 mmc_detect_change(host, 0); 2112 mmc_detect_change(host, 0);
2112} 2113}
@@ -2120,6 +2121,7 @@ void mmc_stop_host(struct mmc_host *host)
2120 spin_unlock_irqrestore(&host->lock, flags); 2121 spin_unlock_irqrestore(&host->lock, flags);
2121#endif 2122#endif
2122 2123
2124 host->rescan_disable = 1;
2123 cancel_delayed_work_sync(&host->detect); 2125 cancel_delayed_work_sync(&host->detect);
2124 mmc_flush_scheduled_work(); 2126 mmc_flush_scheduled_work();
2125 2127