If sdio host can wakeup system, its interrupt will _NOT_ be disabled during suspending. So when card interrupt happens, the sdio irq thread will be woken up. Claim the host to avoid sdio irq thread handling the pending interrupt while sdio host suspended. The pending interrupt will be handled after the host released in resume when sdio host has been resumed. Signed-off-by: Jialing Fu <jlfu@xxxxxxxxxxx> Signed-off-by: Kevin Liu <kliu5@xxxxxxxxxxx> --- drivers/mmc/core/sdio.c | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 2273ce6..81140b9 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -11,6 +11,7 @@ #include <linux/err.h> #include <linux/pm_runtime.h> +#include <linux/pm_wakeup.h> #include <linux/mmc/host.h> #include <linux/mmc/card.h> @@ -923,6 +924,17 @@ static int mmc_sdio_suspend(struct mmc_host *host) mmc_release_host(host); } + /* + * If sdio host can wakeup system, its interrupt will _NOT_ be disabled + * during suspending. So the card interrupt may occur after host has + * suspended. Claim the host here to avoid sdio irq thread handling the + * pending interrupt while sdio host suspended. The pending interrupt + * will be handled after the host released in resume when sdio host has + * been resumed. + */ + if (!err && device_may_wakeup(mmc_dev(host))) + mmc_claim_host(host); + return err; } @@ -933,8 +945,12 @@ static int mmc_sdio_resume(struct mmc_host *host) BUG_ON(!host); BUG_ON(!host->card); - /* Basic card reinitialization. */ - mmc_claim_host(host); + /* + * Basic card reinitialization. + * if sdio host can wakeup system, the host has been claimed in suspend. + */ + if (!device_may_wakeup(mmc_dev(host))) + mmc_claim_host(host); /* No need to reinitialize powered-resumed nonremovable cards */ if (mmc_card_is_removable(host) || !mmc_card_keep_power(host)) -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html