mmc: msm_sdcc: Fix deadlock while resuming sdcc from userspace

The runtime power management of sdcc can be controlled by
userspace with auto/on modes by writing into
/sys/devices/platform/msm_sdcc.1/power/control entry.
"auto" mode allows runtime pm suspend to happen.
"on" mode forbids runtime suspend of sdcc and also take care
of resuming the device if already suspended. During this resume
process there is a deadlock as described below:

o User writes "on" into control parameter.

o The sysfs write triggers a rpm_resume() (assume sdcc is
  already suspended, hence rpm_resume() tries to wake it up).

o rpm_resume() -> msmsdcc_runtime_resume() -> mmc_claim_host()
  -> msmsdcc_enable() -> pm_runtime_get_sync() -> rpm_resume()
  -> wait for previous rpm_resume() completion which cause deadlock.

CRs-Fixed: 372071
Change-Id: I0f666b56b6db98b182b8fc828588b476fd4eef6a
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
This commit is contained in:
Sujit Reddy Thumma 2012-06-20 12:29:45 +05:30 committed by Stephen Boyd
parent 1e11a8dc54
commit 627560c305

View file

@ -3188,6 +3188,9 @@ static int msmsdcc_enable(struct mmc_host *mmc)
pm_runtime_get_noresume(dev);
goto out;
}
} else if (dev->power.runtime_status == RPM_RESUMING) {
pm_runtime_get_noresume(dev);
goto out;
}
rc = pm_runtime_get_sync(dev);