From 54e1258f91fde23794e86aa36b3ff92c2bdb7de9 Mon Sep 17 00:00:00 2001 From: Sujith Reddy Thumma Date: Thu, 28 Apr 2011 18:29:34 +0530 Subject: mmc: core: Claim host while freeing card When SD/MMC card is removed without unmounting and then reinserted again while gendisk is freed. Partition invalidation and deletion may take more than 10secs during which SDCC controller can suspend due to runtime pm functionality. Once the block layer activity is done it claims host to detach card from MMC bus which triggers SDCC resume. As the host->card is NULL already there is a BUG_ON hit in mmc_sd_resume(). Fix this by claiming host even before we free host->card. CRs-Fixed: 284262 Signed-off-by: Sujith Reddy Thumma (cherry picked from commit 5eed6a9778440ef512f597b43368337a7ef9438b) Change-Id: I6b58aab1865a93a025fd9912200ab0beea21be92 Signed-off-by: Shruthi Krishna Signed-off-by: David Brown --- drivers/mmc/core/mmc.c | 3 +++ drivers/mmc/core/sd.c | 3 +++ 2 files changed, 6 insertions(+) (limited to 'drivers') diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index fd910a73d8be..d9b64b50ce4b 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1827,7 +1827,10 @@ static void mmc_remove(struct mmc_host *host) BUG_ON(!host->card); mmc_remove_card(host->card); + + mmc_claim_host(host); host->card = NULL; + mmc_release_host(host); } /* diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index c1e68f40e0b2..bd5e43a67c8b 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -1110,7 +1110,10 @@ static void mmc_sd_remove(struct mmc_host *host) BUG_ON(!host->card); mmc_remove_card(host->card); + + mmc_claim_host(host); host->card = NULL; + mmc_release_host(host); } /* -- cgit v1.2.3