summaryrefslogtreecommitdiff
path: root/drivers/mmc/card/queue.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/card/queue.c')
-rw-r--r--drivers/mmc/card/queue.c37
1 files changed, 6 insertions, 31 deletions
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index 05f456b0d1c1..fdbfdc0f4e3a 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -655,7 +655,6 @@ int mmc_cmdq_init(struct mmc_queue *mq, struct mmc_card *card)
blk_queue_softirq_done(mq->queue, mmc_cmdq_softirq_done);
INIT_WORK(&mq->cmdq_err_work, mmc_cmdq_error_work);
- init_completion(&mq->cmdq_shutdown_complete);
init_completion(&mq->cmdq_pending_req_done);
blk_queue_rq_timed_out(mq->queue, mmc_cmdq_rq_timed_out);
@@ -704,7 +703,6 @@ int mmc_queue_suspend(struct mmc_queue *mq, int wait)
int rc = 0;
struct mmc_card *card = mq->card;
struct request *req;
- #define SLEEP_TIME_BETWEEN_BLK_REQ_CHECK 100 /* microseconds */
if (card->cmdq_init && blk_queue_tagged(q)) {
struct mmc_host *host = card->host;
@@ -712,44 +710,21 @@ int mmc_queue_suspend(struct mmc_queue *mq, int wait)
if (test_and_set_bit(MMC_QUEUE_SUSPENDED, &mq->flags))
goto out;
- spin_lock_irqsave(q->queue_lock, flags);
- blk_stop_queue(q);
- spin_unlock_irqrestore(q->queue_lock, flags);
-
- wake_up(&host->cmdq_ctx.wait);
-
if (wait) {
- while (1) {
- spin_lock_irqsave(q->queue_lock, flags);
- req = blk_peek_request(q);
- spin_unlock_irqrestore(q->queue_lock, flags);
-
- if (!req)
- break;
-
- /* sleep for some time before rechecking */
- usleep_range(SLEEP_TIME_BETWEEN_BLK_REQ_CHECK,
- SLEEP_TIME_BETWEEN_BLK_REQ_CHECK + 10);
- }
-
- /* Wait for already issued requests to complete */
- if (host->cmdq_ctx.active_reqs)
- wait_for_completion(
- &mq->cmdq_shutdown_complete);
-
+ blk_cleanup_queue(q);
mq->cmdq_shutdown(mq);
} else {
spin_lock_irqsave(q->queue_lock, flags);
+ blk_stop_queue(q);
+ wake_up(&host->cmdq_ctx.wait);
req = blk_peek_request(q);
- spin_unlock_irqrestore(q->queue_lock, flags);
-
- if (req || host->cmdq_ctx.active_reqs) {
+ if (req || mq->cmdq_req_peeked ||
+ host->cmdq_ctx.active_reqs) {
clear_bit(MMC_QUEUE_SUSPENDED, &mq->flags);
- spin_lock_irqsave(q->queue_lock, flags);
blk_start_queue(q);
- spin_unlock_irqrestore(q->queue_lock, flags);
rc = -EBUSY;
}
+ spin_unlock_irqrestore(q->queue_lock, flags);
}
goto out;