mmc: block: fix race in deferred resume

The actual resume takes place when a request is received. In a
situation when mmcqd and qseecomd(rpmb) both try to resume the
device, a race is ensued. This is because mmcqd first resumes
the device and then claims the host. Ideally, if resume is in
progress in one context the resume in the other context should
be cancelled.
Claim the host before resuming the device in mmcqd context.

CRs-fixed: 697018
Change-Id: I11d33e642a9b2022f77277196de128c9ac78d334
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
This commit is contained in:
Asutosh Das 2014-07-22 16:27:54 +05:30
parent 0af4da69e9
commit 33ab6ff829

View file

@ -2772,12 +2772,12 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
if (req && !mq->mqrq_prev->req) { if (req && !mq->mqrq_prev->req) {
mmc_rpm_hold(host, &card->dev); mmc_rpm_hold(host, &card->dev);
/* claim host only for the first request */
mmc_claim_host(card->host);
#ifdef CONFIG_MMC_BLOCK_DEFERRED_RESUME #ifdef CONFIG_MMC_BLOCK_DEFERRED_RESUME
if (mmc_bus_needs_resume(card->host)) if (mmc_bus_needs_resume(card->host))
mmc_resume_bus(card->host); mmc_resume_bus(card->host);
#endif #endif
/* claim host only for the first request */
mmc_claim_host(card->host);
if (card->ext_csd.bkops_en) if (card->ext_csd.bkops_en)
mmc_stop_bkops(card); mmc_stop_bkops(card);
} }