Commit 96e52daa authored by Shawn Lin's avatar Shawn Lin Committed by Ulf Hansson

mmc: block: remove the check of packed for packed request routine

packed should always exist without calling its cleanup function
explicitly. Moreover, we have use it when preparing packed list.
So I don't believe we should ever fall into this check again when
doing mmc_blk_packed_hdr_wrq_prep or mmc_blk_end_packed_req,etc.
And the code of mmc_blk_end_packed_req is trying to use packed before
checking it which makes it quite weird. This patch is trying to
remove these two checks and move it to the mmc_blk_prep_packed_list.
If we find packed is null, then we should never use MMC_BLK_PACKED_CMD.
By doing this, we could fall back to non-packed request if finding null
packed, though it's impossible theoretically.

After removing these two BUG_ONs, we also remove all other similar
checks within the routine of mmc_blk_issue_rw_rq which checks the
error handling of packed request.
Signed-off-by: default avatarShawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 67d35960
...@@ -142,8 +142,6 @@ static inline void mmc_blk_clear_packed(struct mmc_queue_req *mqrq) ...@@ -142,8 +142,6 @@ static inline void mmc_blk_clear_packed(struct mmc_queue_req *mqrq)
{ {
struct mmc_packed *packed = mqrq->packed; struct mmc_packed *packed = mqrq->packed;
BUG_ON(!packed);
mqrq->cmd_type = MMC_PACKED_NONE; mqrq->cmd_type = MMC_PACKED_NONE;
packed->nr_entries = MMC_PACKED_NR_ZERO; packed->nr_entries = MMC_PACKED_NR_ZERO;
packed->idx_failure = MMC_PACKED_NR_IDX; packed->idx_failure = MMC_PACKED_NR_IDX;
...@@ -1443,8 +1441,6 @@ static int mmc_blk_packed_err_check(struct mmc_card *card, ...@@ -1443,8 +1441,6 @@ static int mmc_blk_packed_err_check(struct mmc_card *card,
int err, check, status; int err, check, status;
u8 *ext_csd; u8 *ext_csd;
BUG_ON(!packed);
packed->retries--; packed->retries--;
check = mmc_blk_err_check(card, areq); check = mmc_blk_err_check(card, areq);
err = get_card_status(card, &status, 0); err = get_card_status(card, &status, 0);
...@@ -1673,6 +1669,18 @@ static u8 mmc_blk_prep_packed_list(struct mmc_queue *mq, struct request *req) ...@@ -1673,6 +1669,18 @@ static u8 mmc_blk_prep_packed_list(struct mmc_queue *mq, struct request *req)
u8 max_packed_rw = 0; u8 max_packed_rw = 0;
u8 reqs = 0; u8 reqs = 0;
/*
* We don't need to check packed for any further
* operation of packed stuff as we set MMC_PACKED_NONE
* and return zero for reqs if geting null packed. Also
* we clean the flag of MMC_BLK_PACKED_CMD to avoid doing
* it again when removing blk req.
*/
if (!mqrq->packed) {
md->flags &= (~MMC_BLK_PACKED_CMD);
goto no_packed;
}
if (!(md->flags & MMC_BLK_PACKED_CMD)) if (!(md->flags & MMC_BLK_PACKED_CMD))
goto no_packed; goto no_packed;
...@@ -1782,8 +1790,6 @@ static void mmc_blk_packed_hdr_wrq_prep(struct mmc_queue_req *mqrq, ...@@ -1782,8 +1790,6 @@ static void mmc_blk_packed_hdr_wrq_prep(struct mmc_queue_req *mqrq,
u8 hdr_blocks; u8 hdr_blocks;
u8 i = 1; u8 i = 1;
BUG_ON(!packed);
mqrq->cmd_type = MMC_PACKED_WRITE; mqrq->cmd_type = MMC_PACKED_WRITE;
packed->blocks = 0; packed->blocks = 0;
packed->idx_failure = MMC_PACKED_NR_IDX; packed->idx_failure = MMC_PACKED_NR_IDX;
...@@ -1887,8 +1893,6 @@ static int mmc_blk_end_packed_req(struct mmc_queue_req *mq_rq) ...@@ -1887,8 +1893,6 @@ static int mmc_blk_end_packed_req(struct mmc_queue_req *mq_rq)
int idx = packed->idx_failure, i = 0; int idx = packed->idx_failure, i = 0;
int ret = 0; int ret = 0;
BUG_ON(!packed);
while (!list_empty(&packed->list)) { while (!list_empty(&packed->list)) {
prq = list_entry_rq(packed->list.next); prq = list_entry_rq(packed->list.next);
if (idx == i) { if (idx == i) {
...@@ -1917,8 +1921,6 @@ static void mmc_blk_abort_packed_req(struct mmc_queue_req *mq_rq) ...@@ -1917,8 +1921,6 @@ static void mmc_blk_abort_packed_req(struct mmc_queue_req *mq_rq)
struct request *prq; struct request *prq;
struct mmc_packed *packed = mq_rq->packed; struct mmc_packed *packed = mq_rq->packed;
BUG_ON(!packed);
while (!list_empty(&packed->list)) { while (!list_empty(&packed->list)) {
prq = list_entry_rq(packed->list.next); prq = list_entry_rq(packed->list.next);
list_del_init(&prq->queuelist); list_del_init(&prq->queuelist);
...@@ -1935,8 +1937,6 @@ static void mmc_blk_revert_packed_req(struct mmc_queue *mq, ...@@ -1935,8 +1937,6 @@ static void mmc_blk_revert_packed_req(struct mmc_queue *mq,
struct request_queue *q = mq->queue; struct request_queue *q = mq->queue;
struct mmc_packed *packed = mq_rq->packed; struct mmc_packed *packed = mq_rq->packed;
BUG_ON(!packed);
while (!list_empty(&packed->list)) { while (!list_empty(&packed->list)) {
prq = list_entry_rq(packed->list.prev); prq = list_entry_rq(packed->list.prev);
if (prq->queuelist.prev != &packed->list) { if (prq->queuelist.prev != &packed->list) {
......
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