From a8ad82cc1b22d04916d9cdb1dc75052e80ac803c Mon Sep 17 00:00:00 2001 From: Sujit Reddy Thumma Date: Thu, 8 Dec 2011 14:05:50 +0530 Subject: mmc: card: Kill block requests if card is removed Kill block requests when the host realizes that the card is removed from the slot and is sure that subsequent requests are bound to fail. Do this silently so that the block layer doesn't output unnecessary error messages. Signed-off-by: Sujit Reddy Thumma Acked-by: Adrian Hunter Signed-off-by: Chris Ball --- drivers/mmc/card/queue.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/mmc/card/queue.c') diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index dcad59cbfef1..2517547b4366 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c @@ -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. */ @@ -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; -- cgit v1.2.3