mmc: block: break out mmc_blk_rw_cmd_abort()
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 24 Jan 2017 10:17:52 +0000 (11:17 +0100)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 13 Feb 2017 12:20:37 +0000 (13:20 +0100)
As a first step toward breaking apart the very complex function
mmc_blk_issue_rw_rq() we break out the command abort code.
This code assumes "ret" is != 0 and then repeatedly hammers
blk_end_request() until the request to the block layer to end
the request succeeds.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/block.c

index 7bd03381810d6f17a9410fac626b8cc363941b3c..14efe92a14efc648e8e886b3cc897c01335b03cd 100644 (file)
@@ -1598,6 +1598,17 @@ static int mmc_blk_cmd_err(struct mmc_blk_data *md, struct mmc_card *card,
        return ret;
 }
 
+static void mmc_blk_rw_cmd_abort(struct mmc_card *card, struct request *req)
+{
+       int ret = 1;
+
+       if (mmc_card_removed(card))
+               req->rq_flags |= RQF_QUIET;
+       while (ret)
+               ret = blk_end_request(req, -EIO,
+                                     blk_rq_cur_bytes(req));
+}
+
 static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
 {
        struct mmc_blk_data *md = mq->blkdata;
@@ -1737,11 +1748,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
        return 1;
 
  cmd_abort:
-       if (mmc_card_removed(card))
-               req->rq_flags |= RQF_QUIET;
-       while (ret)
-               ret = blk_end_request(req, -EIO,
-                               blk_rq_cur_bytes(req));
+       mmc_blk_rw_cmd_abort(card, req);
 
  start_new_req:
        if (rqc) {