mmc_rescan checks whether registered cards are still present before
skipping them, by calling the bus-specific ->detect() handler.

With buses that support runtime PM, the card may be powered off at
this point, so they need to be powered on and fully reinitialized before
->detect() executes.

This whole process is redundant with nonremovable cards; in those cases,
we can safely skip calling ->detect() and implicitly assume its success.

Signed-off-by: Ohad Ben-Cohen <[email protected]>
---
 drivers/mmc/core/core.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 6286898..e8332d7 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1506,8 +1506,12 @@ void mmc_rescan(struct work_struct *work)
 
        mmc_bus_get(host);
 
-       /* if there is a card registered, check whether it is still present */
-       if ((host->bus_ops != NULL) && host->bus_ops->detect && !host->bus_dead)
+       /*
+        * if there is a _removable_ card registered, check whether it is
+        * still present
+        */
+       if ((host->bus_ops != NULL) && host->bus_ops->detect && !host->bus_dead
+                                       && mmc_card_is_removable(host))
                host->bus_ops->detect(host);
 
        mmc_bus_put(host);
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to