Commit 87973ba2 authored by Ohad Ben-Cohen's avatar Ohad Ben-Cohen Committed by Chris Ball
Browse files

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: default avatarOhad Ben-Cohen <ohad@wizery.com>
Tested-by: default avatarLuciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent 40bba0c1
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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);

	/*
@@ -555,6 +560,7 @@ static void mmc_sdio_detect(struct mmc_host *host)

	mmc_release_host(host);

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

@@ -562,6 +568,9 @@ static void mmc_sdio_detect(struct mmc_host *host)
		mmc_detach_bus(host);
		mmc_release_host(host);
	}

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

/*