diff options
Diffstat (limited to 'drivers/mmc/card/queue.c')
-rw-r--r-- | drivers/mmc/card/queue.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index d630d9861e7b..5e0971016ac5 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
@@ -22,7 +22,6 @@ | |||
22 | 22 | ||
23 | #define MMC_QUEUE_BOUNCESZ 65536 | 23 | #define MMC_QUEUE_BOUNCESZ 65536 |
24 | 24 | ||
25 | #define MMC_QUEUE_SUSPENDED (1 << 0) | ||
26 | 25 | ||
27 | #define MMC_REQ_SPECIAL_MASK (REQ_DISCARD | REQ_FLUSH) | 26 | #define MMC_REQ_SPECIAL_MASK (REQ_DISCARD | REQ_FLUSH) |
28 | 27 | ||
@@ -72,6 +71,10 @@ static int mmc_queue_thread(void *d) | |||
72 | set_current_state(TASK_RUNNING); | 71 | set_current_state(TASK_RUNNING); |
73 | cmd_flags = req ? req->cmd_flags : 0; | 72 | cmd_flags = req ? req->cmd_flags : 0; |
74 | mq->issue_fn(mq, req); | 73 | mq->issue_fn(mq, req); |
74 | if (mq->flags & MMC_QUEUE_NEW_REQUEST) { | ||
75 | mq->flags &= ~MMC_QUEUE_NEW_REQUEST; | ||
76 | continue; /* fetch again */ | ||
77 | } | ||
75 | 78 | ||
76 | /* | 79 | /* |
77 | * Current request becomes previous request | 80 | * Current request becomes previous request |
@@ -113,6 +116,8 @@ static void mmc_request_fn(struct request_queue *q) | |||
113 | { | 116 | { |
114 | struct mmc_queue *mq = q->queuedata; | 117 | struct mmc_queue *mq = q->queuedata; |
115 | struct request *req; | 118 | struct request *req; |
119 | unsigned long flags; | ||
120 | struct mmc_context_info *cntx; | ||
116 | 121 | ||
117 | if (!mq) { | 122 | if (!mq) { |
118 | while ((req = blk_fetch_request(q)) != NULL) { | 123 | while ((req = blk_fetch_request(q)) != NULL) { |
@@ -122,7 +127,20 @@ static void mmc_request_fn(struct request_queue *q) | |||
122 | return; | 127 | return; |
123 | } | 128 | } |
124 | 129 | ||
125 | if (!mq->mqrq_cur->req && !mq->mqrq_prev->req) | 130 | cntx = &mq->card->host->context_info; |
131 | if (!mq->mqrq_cur->req && mq->mqrq_prev->req) { | ||
132 | /* | ||
133 | * New MMC request arrived when MMC thread may be | ||
134 | * blocked on the previous request to be complete | ||
135 | * with no current request fetched | ||
136 | */ | ||
137 | spin_lock_irqsave(&cntx->lock, flags); | ||
138 | if (cntx->is_waiting_last_req) { | ||
139 | cntx->is_new_req = true; | ||
140 | wake_up_interruptible(&cntx->wait); | ||
141 | } | ||
142 | spin_unlock_irqrestore(&cntx->lock, flags); | ||
143 | } else if (!mq->mqrq_cur->req && !mq->mqrq_prev->req) | ||
126 | wake_up_process(mq->thread); | 144 | wake_up_process(mq->thread); |
127 | } | 145 | } |
128 | 146 | ||