@@ -2100,7 +2100,7 @@ static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq)
int _mmc_detect_card_removed(struct mmc_host *host)
{
- int ret;
+ int ret = -ENOSYS;
if ((host->caps & MMC_CAP_NONREMOVABLE) || !host->bus_ops->alive)
return 0;
@@ -2108,7 +2108,13 @@ int _mmc_detect_card_removed(struct mmc_host *host)
if (!host->card || mmc_card_removed(host->card))
return 1;
- ret = host->bus_ops->alive(host);
+ if (host->ops->get_cd) {
+ ret = host->ops->get_cd(host);
+ if (ret >= 0)
+ ret = !ret;
+ }
+ if (ret < 0)
+ ret = host->bus_ops->alive(host);
if (ret) {
mmc_card_set_removed(host->card);
pr_debug("%s: card remove detected\n", mmc_hostname(host));