Skip to content

Commit 87a0d90

Browse files
committed
mmc: core: Further prevent card detect during shutdown
Disabling card detect from the host's ->shutdown_pre() callback turned out to not be the complete solution. More precisely, beyond the point when the mmc_bus->shutdown() has been called, to gracefully power off the card, we need to prevent card detect. Otherwise the mmc_rescan work may poll for the card with a CMD13, to see if it's still alive, which then will fail and hang as the card has already been powered off. To fix this problem, let's disable mmc_rescan prior to power off the card during shutdown. Reported-by: Anthony Pighin <anthony.pighin@nokia.com> Fixes: 66c915d ("mmc: core: Disable card detect during shutdown") Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Adrian Hunter <adrian.hunter@intel.com> Closes: https://lore.kernel.org/all/BN0PR08MB695133000AF116F04C3A9FFE83212@BN0PR08MB6951.namprd08.prod.outlook.com/ Tested-by: Anthony Pighin <anthony.pighin@nokia.com> Message-ID: <20241125122446.18684-1-ulf.hansson@linaro.org>
1 parent 7f0fa47 commit 87a0d90

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

drivers/mmc/core/bus.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ static void mmc_bus_shutdown(struct device *dev)
149149
if (dev->driver && drv->shutdown)
150150
drv->shutdown(card);
151151

152+
__mmc_stop_host(host);
153+
152154
if (host->bus_ops->shutdown) {
153155
ret = host->bus_ops->shutdown(host);
154156
if (ret)

drivers/mmc/core/core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,6 +2335,9 @@ void mmc_start_host(struct mmc_host *host)
23352335

23362336
void __mmc_stop_host(struct mmc_host *host)
23372337
{
2338+
if (host->rescan_disable)
2339+
return;
2340+
23382341
if (host->slot.cd_irq >= 0) {
23392342
mmc_gpio_set_cd_wake(host, false);
23402343
disable_irq(host->slot.cd_irq);

0 commit comments

Comments
 (0)