Skip to content

Commit 1c8cf9c

Browse files
ohadbccjb
authored andcommitted
mmc: sdio: fix SDIO suspend/resume regression
Fix SDIO suspend/resume regression introduced by 4c2ef25 "mmc: fix all hangs related to mmc/sd card insert/removal during suspend/resume": PM: Syncing filesystems ... done. Freezing user space processes ... (elapsed 0.01 seconds) done. Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done. Suspending console(s) (use no_console_suspend to debug) pm_op(): platform_pm_suspend+0x0/0x5c returns -38 PM: Device pxa2xx-mci.0 failed to suspend: error -38 PM: Some devices failed to suspend 4c2ef25 moved the card removal/insertion mechanism out of MMC's suspend/resume path and into pm notifiers (mmc_pm_notify), and that broke SDIO's expectation that mmc_suspend_host() will remove the card, and squash the error, in case -ENOSYS is returned from the bus suspend handler (mmc_sdio_suspend() in this case). mmc_sdio_suspend() is using this whenever at least one of the card's SDIO function drivers does not have suspend/resume handlers - in that case it is agreed to force removal of the entire card. This patch fixes this regression by trivially bringing back that part of mmc_suspend_host(), which was removed by 4c2ef25. Reported-and-tested-by: Sven Neumann <s.neumann@raumfeld.com> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Cc: Maxim Levitsky <maximlevitsky@gmail.com> Cc: <stable@kernel.org> Acked-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Chris Ball <cjb@laptop.org>
1 parent 8fd01d6 commit 1c8cf9c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/mmc/core/core.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,6 +1631,19 @@ int mmc_suspend_host(struct mmc_host *host)
16311631
if (host->bus_ops && !host->bus_dead) {
16321632
if (host->bus_ops->suspend)
16331633
err = host->bus_ops->suspend(host);
1634+
if (err == -ENOSYS || !host->bus_ops->resume) {
1635+
/*
1636+
* We simply "remove" the card in this case.
1637+
* It will be redetected on resume.
1638+
*/
1639+
if (host->bus_ops->remove)
1640+
host->bus_ops->remove(host);
1641+
mmc_claim_host(host);
1642+
mmc_detach_bus(host);
1643+
mmc_release_host(host);
1644+
host->pm_flags = 0;
1645+
err = 0;
1646+
}
16341647
}
16351648
mmc_bus_put(host);
16361649

0 commit comments

Comments
 (0)