]> err.no Git - linux-2.6/commitdiff
mmc: Flush pending detects on host removal
authorPierre Ossman <drzeus@drzeus.cx>
Sun, 11 Feb 2007 19:43:19 +0000 (20:43 +0100)
committerPierre Ossman <drzeus@drzeus.cx>
Tue, 1 May 2007 11:04:17 +0000 (13:04 +0200)
Make sure we kill of any pending detection runs when the host
is removed instead of when it is freed. Also add some debugging
to make sure the driver doesn't queue up more detection after it
has removed the host.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
drivers/mmc/mmc.c
include/linux/mmc/host.h

index 9ffeeb2cba45dc216529d20cbb1e23680f2ca936..0242c6a21daf67f6ebc8c34aef624d36002c1b19 100644 (file)
@@ -1550,6 +1550,12 @@ static void mmc_setup(struct mmc_host *host)
  */
 void mmc_detect_change(struct mmc_host *host, unsigned long delay)
 {
+#ifdef CONFIG_MMC_DEBUG
+       mmc_claim_host(host);
+       BUG_ON(host->removed);
+       mmc_release_host(host);
+#endif
+
        mmc_schedule_delayed_work(&host->detect, delay);
 }
 
@@ -1690,6 +1696,14 @@ void mmc_remove_host(struct mmc_host *host)
 {
        struct list_head *l, *n;
 
+#ifdef CONFIG_MMC_DEBUG
+       mmc_claim_host(host);
+       host->removed = 1;
+       mmc_release_host(host);
+#endif
+
+       mmc_flush_scheduled_work();
+
        list_for_each_safe(l, n, &host->cards) {
                struct mmc_card *card = mmc_list_to_card(l);
 
@@ -1710,7 +1724,6 @@ EXPORT_SYMBOL(mmc_remove_host);
  */
 void mmc_free_host(struct mmc_host *host)
 {
-       mmc_flush_scheduled_work();
        mmc_free_host_sysfs(host);
 }
 
index c89f410913045b1e262715919758d340e6f12790..92efe8e5be7e6013ae8581504fa9e9d90d6e7967 100644 (file)
@@ -147,6 +147,9 @@ struct mmc_host {
        struct mmc_card         *card_selected; /* the selected MMC card */
 
        struct delayed_work     detect;
+#ifdef CONFIG_MMC_DEBUG
+       unsigned int            removed:1;      /* host is being removed */
+#endif
 
        unsigned long           private[0] ____cacheline_aligned;
 };