diff options
author | Ohad Ben-Cohen <ohad@wizery.com> | 2010-10-02 07:54:12 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2010-10-23 09:11:18 -0400 |
commit | 87973ba27b751353e2915cb3aa5c0e0dc6a79a4f (patch) | |
tree | 02c84b25c7697eed2c82d08ae5bf4308e6efe9fd /drivers/mmc | |
parent | 40bba0c1ca83a370f749c8bc9afda71cf79ebd91 (diff) |
mmc: sdio: ensure mmc_sdio_detect is powered
To prevent an erroneous removal of the card, make sure
the device is powered when it is mmc_sdio_detect()ed.
This is required since mmc_sdio_detect may be invoked
while the device is runtime suspended (e.g., MMC core
is rescanning when system comes out of suspend).
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Tested-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/core/sdio.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 85561dde4c9d..c3ad1058cd31 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c | |||
@@ -546,6 +546,11 @@ static void mmc_sdio_detect(struct mmc_host *host) | |||
546 | BUG_ON(!host); | 546 | BUG_ON(!host); |
547 | BUG_ON(!host->card); | 547 | BUG_ON(!host->card); |
548 | 548 | ||
549 | /* Make sure card is powered before detecting it */ | ||
550 | err = pm_runtime_get_sync(&host->card->dev); | ||
551 | if (err < 0) | ||
552 | goto out; | ||
553 | |||
549 | mmc_claim_host(host); | 554 | mmc_claim_host(host); |
550 | 555 | ||
551 | /* | 556 | /* |
@@ -555,6 +560,7 @@ static void mmc_sdio_detect(struct mmc_host *host) | |||
555 | 560 | ||
556 | mmc_release_host(host); | 561 | mmc_release_host(host); |
557 | 562 | ||
563 | out: | ||
558 | if (err) { | 564 | if (err) { |
559 | mmc_sdio_remove(host); | 565 | mmc_sdio_remove(host); |
560 | 566 | ||
@@ -562,6 +568,9 @@ static void mmc_sdio_detect(struct mmc_host *host) | |||
562 | mmc_detach_bus(host); | 568 | mmc_detach_bus(host); |
563 | mmc_release_host(host); | 569 | mmc_release_host(host); |
564 | } | 570 | } |
571 | |||
572 | /* Tell PM core that we're done */ | ||
573 | pm_runtime_put(&host->card->dev); | ||
565 | } | 574 | } |
566 | 575 | ||
567 | /* | 576 | /* |