diff options
Diffstat (limited to 'drivers/mmc/card')
| -rw-r--r-- | drivers/mmc/card/block.c | 8 | ||||
| -rw-r--r-- | drivers/mmc/card/queue.c | 18 |
2 files changed, 17 insertions, 9 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 85f0e8cd875b..1f552c6e7579 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
| @@ -85,7 +85,14 @@ static void mmc_blk_put(struct mmc_blk_data *md) | |||
| 85 | mutex_lock(&open_lock); | 85 | mutex_lock(&open_lock); |
| 86 | md->usage--; | 86 | md->usage--; |
| 87 | if (md->usage == 0) { | 87 | if (md->usage == 0) { |
| 88 | int devmaj = MAJOR(disk_devt(md->disk)); | ||
| 88 | int devidx = MINOR(disk_devt(md->disk)) >> MMC_SHIFT; | 89 | int devidx = MINOR(disk_devt(md->disk)) >> MMC_SHIFT; |
| 90 | |||
| 91 | if (!devmaj) | ||
| 92 | devidx = md->disk->first_minor >> MMC_SHIFT; | ||
| 93 | |||
| 94 | blk_cleanup_queue(md->queue.queue); | ||
| 95 | |||
| 89 | __clear_bit(devidx, dev_use); | 96 | __clear_bit(devidx, dev_use); |
| 90 | 97 | ||
| 91 | put_disk(md->disk); | 98 | put_disk(md->disk); |
| @@ -613,6 +620,7 @@ static int mmc_blk_probe(struct mmc_card *card) | |||
| 613 | return 0; | 620 | return 0; |
| 614 | 621 | ||
| 615 | out: | 622 | out: |
| 623 | mmc_cleanup_queue(&md->queue); | ||
| 616 | mmc_blk_put(md); | 624 | mmc_blk_put(md); |
| 617 | 625 | ||
| 618 | return err; | 626 | return err; |
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index 49e582356c65..c5a7a855f4b1 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
| @@ -90,9 +90,10 @@ static void mmc_request(struct request_queue *q) | |||
| 90 | struct request *req; | 90 | struct request *req; |
| 91 | 91 | ||
| 92 | if (!mq) { | 92 | if (!mq) { |
| 93 | printk(KERN_ERR "MMC: killing requests for dead queue\n"); | 93 | while ((req = blk_fetch_request(q)) != NULL) { |
| 94 | while ((req = blk_fetch_request(q)) != NULL) | 94 | req->cmd_flags |= REQ_QUIET; |
| 95 | __blk_end_request_all(req, -EIO); | 95 | __blk_end_request_all(req, -EIO); |
| 96 | } | ||
| 96 | return; | 97 | return; |
| 97 | } | 98 | } |
| 98 | 99 | ||
| @@ -223,17 +224,18 @@ void mmc_cleanup_queue(struct mmc_queue *mq) | |||
| 223 | struct request_queue *q = mq->queue; | 224 | struct request_queue *q = mq->queue; |
| 224 | unsigned long flags; | 225 | unsigned long flags; |
| 225 | 226 | ||
| 226 | /* Mark that we should start throwing out stragglers */ | ||
| 227 | spin_lock_irqsave(q->queue_lock, flags); | ||
| 228 | q->queuedata = NULL; | ||
| 229 | spin_unlock_irqrestore(q->queue_lock, flags); | ||
| 230 | |||
| 231 | /* Make sure the queue isn't suspended, as that will deadlock */ | 227 | /* Make sure the queue isn't suspended, as that will deadlock */ |
| 232 | mmc_queue_resume(mq); | 228 | mmc_queue_resume(mq); |
| 233 | 229 | ||
| 234 | /* Then terminate our worker thread */ | 230 | /* Then terminate our worker thread */ |
| 235 | kthread_stop(mq->thread); | 231 | kthread_stop(mq->thread); |
| 236 | 232 | ||
| 233 | /* Empty the queue */ | ||
| 234 | spin_lock_irqsave(q->queue_lock, flags); | ||
| 235 | q->queuedata = NULL; | ||
| 236 | blk_start_queue(q); | ||
| 237 | spin_unlock_irqrestore(q->queue_lock, flags); | ||
| 238 | |||
| 237 | if (mq->bounce_sg) | 239 | if (mq->bounce_sg) |
| 238 | kfree(mq->bounce_sg); | 240 | kfree(mq->bounce_sg); |
| 239 | mq->bounce_sg = NULL; | 241 | mq->bounce_sg = NULL; |
| @@ -245,8 +247,6 @@ void mmc_cleanup_queue(struct mmc_queue *mq) | |||
| 245 | kfree(mq->bounce_buf); | 247 | kfree(mq->bounce_buf); |
| 246 | mq->bounce_buf = NULL; | 248 | mq->bounce_buf = NULL; |
| 247 | 249 | ||
| 248 | blk_cleanup_queue(mq->queue); | ||
| 249 | |||
| 250 | mq->card = NULL; | 250 | mq->card = NULL; |
| 251 | } | 251 | } |
| 252 | EXPORT_SYMBOL(mmc_cleanup_queue); | 252 | EXPORT_SYMBOL(mmc_cleanup_queue); |
