@@ -2084,7 +2084,8 @@ int mmc_detect_card_removed(struct mmc_host *host)
* The card will be considered unchanged unless we have been asked to
* detect a change or host requires polling to provide card detection.
*/
- if (card && !host->detect_change && !(host->caps & MMC_CAP_NEEDS_POLL))
+ if (card && !host->detect_change && !(host->caps & MMC_CAP_NEEDS_POLL)
+ && !(host->caps2 & MMC_CAP2_DETECT_ON_ERR))
return mmc_card_removed(card);
ret = mmc_card_removed(card);
@@ -257,6 +257,7 @@ struct mmc_host {
#define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */
#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
MMC_CAP2_HS200_1_2V_SDR)
+#define MMC_CAP2_DETECT_ON_ERR (1 << 7) /* On I/O err check card removal */
mmc_pm_flag_t pm_caps; /* supported pm features */
unsigned int power_notify_type;
A card can be "slowly" removed which means that when a card detect irq has triggered a scheduled detect work to handle the card removal, the card will still be present in the card slot and thus not removed by the rescan sequence. To prevent further I/O request for these lingering "removed" cards, use MMC_CAP2_DETECT_ON_ERR which will check if card is still present from mmc_detect_card_removed function. Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com> --- drivers/mmc/core/core.c | 3 ++- include/linux/mmc/host.h | 1 + 2 files changed, 3 insertions(+), 1 deletions(-)