mmc: msm_sdcc: Fix deadlock in mmc_suspend_host and mmc_rescan
SDCC runtime suspend can race with mmc_rescan causing deadlock.
The call flow would be this:
1) When runtime suspend is triggered:
msmsdcc_runtime_suspend()
-> mmc_suspend_host()
-> mmc_flush_scheduled_work()
2) mmc_flush_schedule_work() waits for mmc_rescan() work
to be completed if it is already in runqueue.
3) When mmc_rescan() is scheduled to run:
mmc_claim_host()
-> msmsdcc_enable()
->pm_runtime_get_sync()
4) pm_runtime_get_sync() waits for runtime_suspend to complete,
and hence cause two threads to wait upon each other.
Fix this deadlock by aborting runtime suspend when mmc_rescan
is scheduled.
CRs-Fixed: 326610
Change-Id: I4ca88651f80f5a1bfccb6e0c07e3ea83fadcdc57
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
2 files changed