diff options
-rw-r--r-- | drivers/mmc/host/sdhci.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 398e9e496736..1453cd127921 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -1351,6 +1351,8 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
1351 | 1351 | ||
1352 | sdhci_runtime_pm_get(host); | 1352 | sdhci_runtime_pm_get(host); |
1353 | 1353 | ||
1354 | present = mmc_gpio_get_cd(host->mmc); | ||
1355 | |||
1354 | spin_lock_irqsave(&host->lock, flags); | 1356 | spin_lock_irqsave(&host->lock, flags); |
1355 | 1357 | ||
1356 | WARN_ON(host->mrq != NULL); | 1358 | WARN_ON(host->mrq != NULL); |
@@ -1379,7 +1381,6 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
1379 | * zero: cd-gpio is used, and card is removed | 1381 | * zero: cd-gpio is used, and card is removed |
1380 | * one: cd-gpio is used, and card is present | 1382 | * one: cd-gpio is used, and card is present |
1381 | */ | 1383 | */ |
1382 | present = mmc_gpio_get_cd(host->mmc); | ||
1383 | if (present < 0) { | 1384 | if (present < 0) { |
1384 | /* If polling, assume that the card is always present. */ | 1385 | /* If polling, assume that the card is always present. */ |
1385 | if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) | 1386 | if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) |
@@ -2126,15 +2127,18 @@ static void sdhci_card_event(struct mmc_host *mmc) | |||
2126 | { | 2127 | { |
2127 | struct sdhci_host *host = mmc_priv(mmc); | 2128 | struct sdhci_host *host = mmc_priv(mmc); |
2128 | unsigned long flags; | 2129 | unsigned long flags; |
2130 | int present; | ||
2129 | 2131 | ||
2130 | /* First check if client has provided their own card event */ | 2132 | /* First check if client has provided their own card event */ |
2131 | if (host->ops->card_event) | 2133 | if (host->ops->card_event) |
2132 | host->ops->card_event(host); | 2134 | host->ops->card_event(host); |
2133 | 2135 | ||
2136 | present = sdhci_do_get_cd(host); | ||
2137 | |||
2134 | spin_lock_irqsave(&host->lock, flags); | 2138 | spin_lock_irqsave(&host->lock, flags); |
2135 | 2139 | ||
2136 | /* Check host->mrq first in case we are runtime suspended */ | 2140 | /* Check host->mrq first in case we are runtime suspended */ |
2137 | if (host->mrq && !sdhci_do_get_cd(host)) { | 2141 | if (host->mrq && !present) { |
2138 | pr_err("%s: Card removed during transfer!\n", | 2142 | pr_err("%s: Card removed during transfer!\n", |
2139 | mmc_hostname(host->mmc)); | 2143 | mmc_hostname(host->mmc)); |
2140 | pr_err("%s: Resetting controller.\n", | 2144 | pr_err("%s: Resetting controller.\n", |