Skip to content

Commit

Permalink
mmc: sdio: ensure mmc_sdio_detect is powered
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ohad Ben-Cohen authored and Chris Ball committed Oct 23, 2010
1 parent 40bba0c commit 87973ba
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/mmc/core/sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,11 @@ static void mmc_sdio_detect(struct mmc_host *host)
BUG_ON(!host);
BUG_ON(!host->card);

/* Make sure card is powered before detecting it */
err = pm_runtime_get_sync(&host->card->dev);
if (err < 0)
goto out;

mmc_claim_host(host);

/*
Expand All @@ -555,13 +560,17 @@ static void mmc_sdio_detect(struct mmc_host *host)

mmc_release_host(host);

out:
if (err) {
mmc_sdio_remove(host);

mmc_claim_host(host);
mmc_detach_bus(host);
mmc_release_host(host);
}

/* Tell PM core that we're done */
pm_runtime_put(&host->card->dev);
}

/*
Expand Down

0 comments on commit 87973ba

Please sign in to comment.