mmc: queue: Fix pull new requests condition, when in cmdq mode

There are three cases, request should not be pulled from the queue:
- it is dcmd request, while dcmd request is in progress
- the CQE is halted, but not because of the runtime suspend
- the cmdq is in error state

When the card is suspended, the CQE is halted. New request coming should
be pulled from the request queue and the runtime resume will be triggered
by mmc_get_card(). There is no race between the pulling request condition
and the runtime suspend flow, because the card marked as suspended after
the CQE is halted.

Change-Id: I126ae689f7fea2e7545dfda7c4c6abda286a0f11
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
This commit is contained in:
Konstantin Dorfman 2015-06-09 13:07:50 +03:00 committed by Subhash Jadavani
parent 3b7cc278b0
commit c6bb958c9b

View file

@ -60,16 +60,22 @@ static inline bool mmc_cmdq_should_pull_reqs(struct mmc_host *host,
struct request *req)
{
if (((req->cmd_flags & (REQ_FLUSH | REQ_DISCARD)) &&
test_bit(CMDQ_STATE_DCMD_ACTIVE, &ctx->curr_state)) ||
(!host->card->part_curr && mmc_host_halt(host)) ||
test_bit(CMDQ_STATE_ERR, &ctx->curr_state)) {
pr_debug("%s: %s: skip pulling reqs: state: %lu\n",
mmc_hostname(host), __func__, ctx->curr_state);
return false;
} else {
return true;
}
bool ret = true;
if ((req->cmd_flags & (REQ_FLUSH | REQ_DISCARD)) &&
test_bit(CMDQ_STATE_DCMD_ACTIVE, &ctx->curr_state))
ret = false;
else if (!host->card->part_curr &&
mmc_host_halt(host) && !mmc_card_suspended(host->card))
ret = false;
else if (test_bit(CMDQ_STATE_ERR, &ctx->curr_state))
ret = false;
if (!ret)
pr_debug("%s: %s: skip pulling reqs: state: %lu, cmd_flags: 0x%x\n",
mmc_hostname(host), __func__,
ctx->curr_state, (unsigned int)req->cmd_flags);
return ret;
}
static int mmc_cmdq_thread(void *d)