mmc: msm_sdcc: Fix issue with msmsdcc_enable()
Due to the recent commit 68338b, any pending runtime PM
work (runtime suspend/resume request) is not getting
cancelled before enabling the host for a new request.
This results in a possibility for suspend work to happen
in parallel while processing any active SD/MMC command.
CRs-fixed: 305399
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index 9a7cc26..b980377 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -2344,18 +2344,25 @@
#ifdef CONFIG_PM_RUNTIME
static int msmsdcc_enable(struct mmc_host *mmc)
{
- int rc = 0;
+ int rc;
struct device *dev = mmc->parent;
- if (pm_runtime_suspended(dev))
- rc = pm_runtime_get_sync(dev);
- else
- pm_runtime_get_noresume(dev);
+ if (dev->power.runtime_status == RPM_SUSPENDING) {
+ if (mmc->suspend_task == current) {
+ pm_runtime_get_noresume(dev);
+ goto out;
+ }
+ }
- if (rc < 0)
+ rc = pm_runtime_get_sync(dev);
+
+ if (rc < 0) {
pr_info("%s: %s: failed with error %d", mmc_hostname(mmc),
__func__, rc);
- return rc;
+ return rc;
+ }
+out:
+ return 0;
}
static int msmsdcc_disable(struct mmc_host *mmc, int lazy)