Commit db435505 authored by Linus Walleij's avatar Linus Walleij Committed by Ulf Hansson

mmc: block: inline the command abort and start new goto:s

The goto statements sprinkled over the mmc_blk_issue_rw_rq()
function has grown over the years and makes the code pretty hard
to read.

Inline the calls such that:

goto cmd_abort; ->
mmc_blk_rw_cmd_abort(card, req);
mmc_blk_rw_start_new(mq, card, rqc);
return;

goto start_new_req; ->
mmc_blk_rw_start_new(mq, card, rqc);
return;

After this it is more clear how we exit the do {} while
loop in this function, and it gets possible to split the
code apart.
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent a04848c7
...@@ -1696,10 +1696,15 @@ static void mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) ...@@ -1696,10 +1696,15 @@ static void mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
break; break;
case MMC_BLK_CMD_ERR: case MMC_BLK_CMD_ERR:
ret = mmc_blk_cmd_err(md, card, brq, req, ret); ret = mmc_blk_cmd_err(md, card, brq, req, ret);
if (mmc_blk_reset(md, card->host, type)) if (mmc_blk_reset(md, card->host, type)) {
goto cmd_abort; mmc_blk_rw_cmd_abort(card, req);
if (!ret) mmc_blk_rw_start_new(mq, card, rqc);
goto start_new_req; return;
}
if (!ret) {
mmc_blk_rw_start_new(mq, card, rqc);
return;
}
break; break;
case MMC_BLK_RETRY: case MMC_BLK_RETRY:
retune_retry_done = brq->retune_retry_done; retune_retry_done = brq->retune_retry_done;
...@@ -1709,15 +1714,20 @@ static void mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) ...@@ -1709,15 +1714,20 @@ static void mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
case MMC_BLK_ABORT: case MMC_BLK_ABORT:
if (!mmc_blk_reset(md, card->host, type)) if (!mmc_blk_reset(md, card->host, type))
break; break;
goto cmd_abort; mmc_blk_rw_cmd_abort(card, req);
mmc_blk_rw_start_new(mq, card, rqc);
return;
case MMC_BLK_DATA_ERR: { case MMC_BLK_DATA_ERR: {
int err; int err;
err = mmc_blk_reset(md, card->host, type); err = mmc_blk_reset(md, card->host, type);
if (!err) if (!err)
break; break;
if (err == -ENODEV) if (err == -ENODEV) {
goto cmd_abort; mmc_blk_rw_cmd_abort(card, req);
mmc_blk_rw_start_new(mq, card, rqc);
return;
}
/* Fall through */ /* Fall through */
} }
case MMC_BLK_ECC_ERR: case MMC_BLK_ECC_ERR:
...@@ -1735,15 +1745,21 @@ static void mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) ...@@ -1735,15 +1745,21 @@ static void mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
*/ */
ret = blk_end_request(req, -EIO, ret = blk_end_request(req, -EIO,
brq->data.blksz); brq->data.blksz);
if (!ret) if (!ret) {
goto start_new_req; mmc_blk_rw_start_new(mq, card, rqc);
return;
}
break; break;
case MMC_BLK_NOMEDIUM: case MMC_BLK_NOMEDIUM:
goto cmd_abort; mmc_blk_rw_cmd_abort(card, req);
mmc_blk_rw_start_new(mq, card, rqc);
return;
default: default:
pr_err("%s: Unhandled return value (%d)", pr_err("%s: Unhandled return value (%d)",
req->rq_disk->disk_name, status); req->rq_disk->disk_name, status);
goto cmd_abort; mmc_blk_rw_cmd_abort(card, req);
mmc_blk_rw_start_new(mq, card, rqc);
return;
} }
if (ret) { if (ret) {
...@@ -1758,14 +1774,6 @@ static void mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) ...@@ -1758,14 +1774,6 @@ static void mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
mq_rq->brq.retune_retry_done = retune_retry_done; mq_rq->brq.retune_retry_done = retune_retry_done;
} }
} while (ret); } while (ret);
return;
cmd_abort:
mmc_blk_rw_cmd_abort(card, req);
start_new_req:
mmc_blk_rw_start_new(mq, card, rqc);
} }
void mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) void mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment