aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/host.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/host.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/host.c')
-rw-r--r--drivers/mmc/core/host.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 74cf29a504f4..597f189b4427 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -313,6 +313,8 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
313 if (!host) 313 if (!host)
314 return NULL; 314 return NULL;
315 315
316 /* scanning will be enabled when we're ready */
317 host->rescan_disable = 1;
316 spin_lock(&mmc_host_lock); 318 spin_lock(&mmc_host_lock);
317 err = idr_get_new(&mmc_host_idr, host, &host->index); 319 err = idr_get_new(&mmc_host_idr, host, &host->index);
318 spin_unlock(&mmc_host_lock); 320 spin_unlock(&mmc_host_lock);