Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 284499
b: refs/heads/master
c: a8ad82c
h: refs/heads/master
i:
  284497: db0e850
  284495: 48c8218
v: v3
  • Loading branch information
Sujit Reddy Thumma authored and Chris Ball committed Jan 12, 2012
1 parent a5179a2 commit 34ce9b2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4137e50494cb3496fbb6ccd27aa7b6d7c9634c1e
refs/heads/master: a8ad82cc1b22d04916d9cdb1dc75052e80ac803c
17 changes: 16 additions & 1 deletion trunk/drivers/mmc/card/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ enum mmc_blk_status {
MMC_BLK_ABORT,
MMC_BLK_DATA_ERR,
MMC_BLK_ECC_ERR,
MMC_BLK_NOMEDIUM,
};

module_param(perdev_minors, int, 0444);
Expand Down Expand Up @@ -639,6 +640,7 @@ static int get_card_status(struct mmc_card *card, u32 *status, int retries)
return err;
}

#define ERR_NOMEDIUM 3
#define ERR_RETRY 2
#define ERR_ABORT 1
#define ERR_CONTINUE 0
Expand Down Expand Up @@ -706,6 +708,9 @@ static int mmc_blk_cmd_recovery(struct mmc_card *card, struct request *req,
u32 status, stop_status = 0;
int err, retry;

if (mmc_card_removed(card))
return ERR_NOMEDIUM;

/*
* Try to get card status which indicates both the card state
* and why there was no response. If the first attempt fails,
Expand All @@ -722,8 +727,12 @@ static int mmc_blk_cmd_recovery(struct mmc_card *card, struct request *req,
}

/* We couldn't get a response from the card. Give up. */
if (err)
if (err) {
/* Check if the card is removed */
if (mmc_detect_card_removed(card->host))
return ERR_NOMEDIUM;
return ERR_ABORT;
}

/* Flag ECC errors */
if ((status & R1_CARD_ECC_FAILED) ||
Expand Down Expand Up @@ -996,6 +1005,8 @@ static int mmc_blk_err_check(struct mmc_card *card,
return MMC_BLK_RETRY;
case ERR_ABORT:
return MMC_BLK_ABORT;
case ERR_NOMEDIUM:
return MMC_BLK_NOMEDIUM;
case ERR_CONTINUE:
break;
}
Expand Down Expand Up @@ -1329,6 +1340,8 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
if (!ret)
goto start_new_req;
break;
case MMC_BLK_NOMEDIUM:
goto cmd_abort;
}

if (ret) {
Expand All @@ -1345,6 +1358,8 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)

cmd_abort:
spin_lock_irq(&md->lock);
if (mmc_card_removed(card))
req->cmd_flags |= REQ_QUIET;
while (ret)
ret = __blk_end_request(req, -EIO, blk_rq_cur_bytes(req));
spin_unlock_irq(&md->lock);
Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/mmc/card/queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
*/
static int mmc_prep_request(struct request_queue *q, struct request *req)
{
struct mmc_queue *mq = q->queuedata;

/*
* We only like normal block requests and discards.
*/
Expand All @@ -37,6 +39,9 @@ static int mmc_prep_request(struct request_queue *q, struct request *req)
return BLKPREP_KILL;
}

if (mq && mmc_card_removed(mq->card))
return BLKPREP_KILL;

req->cmd_flags |= REQ_DONTPREP;

return BLKPREP_OK;
Expand Down

0 comments on commit 34ce9b2

Please sign in to comment.