aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/card/block.c
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2008-06-29 06:19:47 -0400
committerPierre Ossman <drzeus@drzeus.cx>2008-07-15 08:14:45 -0400
commit979ce7208a679b8d012450610d5d5aa75aab3af9 (patch)
treec4e791f94e677703e2aada63f5d2031c0881ccff /drivers/mmc/card/block.c
parent2134a922c6e75c779983cad5d8aae832275f5a0d (diff)
mmc_block: wait for card even on failures
Many failures are non-permanent, but the card might need some time to finish what it is doing before becoming responsive again. Make sure we wait for it to finish programming before dealing with the error. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/card/block.c')
-rw-r--r--drivers/mmc/card/block.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index f9ad960d7c1a..4b0f8220f153 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -2,7 +2,7 @@
2 * Block driver for media (i.e., flash cards) 2 * Block driver for media (i.e., flash cards)
3 * 3 *
4 * Copyright 2002 Hewlett-Packard Company 4 * Copyright 2002 Hewlett-Packard Company
5 * Copyright 2005-2007 Pierre Ossman 5 * Copyright 2005-2008 Pierre Ossman
6 * 6 *
7 * Use consistent with the GNU GPL is permitted, 7 * Use consistent with the GNU GPL is permitted,
8 * provided that this copyright notice is 8 * provided that this copyright notice is
@@ -296,22 +296,24 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
296 296
297 mmc_queue_bounce_post(mq); 297 mmc_queue_bounce_post(mq);
298 298
299 /*
300 * Check for errors here, but don't jump to cmd_err
301 * until later as we need to wait for the card to leave
302 * programming mode even when things go wrong.
303 */
299 if (brq.cmd.error) { 304 if (brq.cmd.error) {
300 printk(KERN_ERR "%s: error %d sending read/write command\n", 305 printk(KERN_ERR "%s: error %d sending read/write command\n",
301 req->rq_disk->disk_name, brq.cmd.error); 306 req->rq_disk->disk_name, brq.cmd.error);
302 goto cmd_err;
303 } 307 }
304 308
305 if (brq.data.error) { 309 if (brq.data.error) {
306 printk(KERN_ERR "%s: error %d transferring data\n", 310 printk(KERN_ERR "%s: error %d transferring data\n",
307 req->rq_disk->disk_name, brq.data.error); 311 req->rq_disk->disk_name, brq.data.error);
308 goto cmd_err;
309 } 312 }
310 313
311 if (brq.stop.error) { 314 if (brq.stop.error) {
312 printk(KERN_ERR "%s: error %d sending stop command\n", 315 printk(KERN_ERR "%s: error %d sending stop command\n",
313 req->rq_disk->disk_name, brq.stop.error); 316 req->rq_disk->disk_name, brq.stop.error);
314 goto cmd_err;
315 } 317 }
316 318
317 if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) { 319 if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) {
@@ -344,6 +346,9 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
344#endif 346#endif
345 } 347 }
346 348
349 if (brq.cmd.error || brq.data.error || brq.stop.error)
350 goto cmd_err;
351
347 /* 352 /*
348 * A block was successfully transferred. 353 * A block was successfully transferred.
349 */ 354 */