diff options
author | Konstantin Dorfman <kdorfman@codeaurora.org> | 2015-06-09 13:07:50 +0300 |
---|---|---|
committer | Subhash Jadavani <subhashj@codeaurora.org> | 2016-05-31 15:26:43 -0700 |
commit | c6bb958c9b3c87f7a0f1015aefc1bd2583ddd0e4 (patch) | |
tree | 37328126c2d7cb1e1aca227403c571b2c9942d0e /drivers/mmc/card | |
parent | 3b7cc278b03915a44645676adf948a79965b6fbf (diff) |
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>
Diffstat (limited to 'drivers/mmc/card')
-rw-r--r-- | drivers/mmc/card/queue.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index e99b1cf16f94..322be51f28fe 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c @@ -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) |