]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/mmc/core/core.c
mmc: add support for card-detection polling
[linux-2.6-omap-h63xx.git] / drivers / mmc / core / core.c
index 01ced4c5a61d45016234654c9e0cf3313ad0ff3d..ede5d1e2e20dfe4626ef3814dae5e886c8374372 100644 (file)
@@ -638,6 +638,9 @@ void mmc_rescan(struct work_struct *work)
                 */
                mmc_bus_put(host);
 
+               if (host->ops->get_cd && host->ops->get_cd(host) == 0)
+                       goto out;
+
                mmc_claim_host(host);
 
                mmc_power_up(host);
@@ -652,7 +655,7 @@ void mmc_rescan(struct work_struct *work)
                if (!err) {
                        if (mmc_attach_sdio(host, ocr))
                                mmc_power_off(host);
-                       return;
+                       goto out;
                }
 
                /*
@@ -662,7 +665,7 @@ void mmc_rescan(struct work_struct *work)
                if (!err) {
                        if (mmc_attach_sd(host, ocr))
                                mmc_power_off(host);
-                       return;
+                       goto out;
                }
 
                /*
@@ -672,7 +675,7 @@ void mmc_rescan(struct work_struct *work)
                if (!err) {
                        if (mmc_attach_mmc(host, ocr))
                                mmc_power_off(host);
-                       return;
+                       goto out;
                }
 
                mmc_release_host(host);
@@ -683,6 +686,9 @@ void mmc_rescan(struct work_struct *work)
 
                mmc_bus_put(host);
        }
+out:
+       if (host->caps & MMC_CAP_NEEDS_POLL)
+               mmc_schedule_delayed_work(&host->detect, HZ);
 }
 
 void mmc_start_host(struct mmc_host *host)