*/
 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);
 }
 
 {
        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);
 
  */
 void mmc_free_host(struct mmc_host *host)
 {
-       mmc_flush_scheduled_work();
        mmc_free_host_sysfs(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;
 };