@@ -2077,6 +2077,7 @@ int _mmc_detect_card_removed(struct mmc_host *host)
int mmc_detect_card_removed(struct mmc_host *host)
{
struct mmc_card *card = host->card;
+ int ret;
WARN_ON(!host->claimed);
/*
@@ -2086,9 +2087,20 @@ int mmc_detect_card_removed(struct mmc_host *host)
if (card && !host->detect_change && !(host->caps & MMC_CAP_NEEDS_POLL))
return mmc_card_removed(card);
- host->detect_change = 0;
+ ret = mmc_card_removed(card);
+ if (!ret) {
+ ret = _mmc_detect_card_removed(host);
+ if (ret) {
+ /*
+ * Schedule a detect work as soon as possible to let a
+ * rescan handle the card removal.
+ */
+ cancel_delayed_work(&host->detect);
+ mmc_detect_change(host, 0);
+ }
+ }
- return _mmc_detect_card_removed(host);
+ return ret;
}
EXPORT_SYMBOL(mmc_detect_card_removed);
Once the card has been detected to be removed by the mmc_detect_card_removed function, schedule a new detect work immediately and without a delay to let a rescan remove the card device as soon a possible. This will sooner prevent further I/O requests. Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com> --- drivers/mmc/core/core.c | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-)