aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/queue.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2017-05-19 09:37:27 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2017-06-20 04:30:24 -0400
commit67e69d5220c904238f94bb2e6001d7c590f5a0bb (patch)
tree3b2133b028340c2db774021a3f1d08d0d22cc413 /drivers/mmc/core/queue.c
parent921579b22f99170c6bc2d57f2720b54e017e99cc (diff)
mmc: block: remove req back pointer
Just as we can use blk_mq_rq_from_pdu() to get the per-request tag we can use blk_mq_rq_to_pdu() to get a request from a tag. Introduce a static inline helper so we are on the clear what is happening. Suggested-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/core/queue.c')
-rw-r--r--drivers/mmc/core/queue.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
index d6c7b4cde4db..ba689a2ffc51 100644
--- a/drivers/mmc/core/queue.c
+++ b/drivers/mmc/core/queue.c
@@ -184,8 +184,6 @@ static int mmc_init_request(struct request_queue *q, struct request *req,
184 struct mmc_card *card = mq->card; 184 struct mmc_card *card = mq->card;
185 struct mmc_host *host = card->host; 185 struct mmc_host *host = card->host;
186 186
187 mq_rq->req = req;
188
189 if (card->bouncesz) { 187 if (card->bouncesz) {
190 mq_rq->bounce_buf = kmalloc(card->bouncesz, gfp); 188 mq_rq->bounce_buf = kmalloc(card->bouncesz, gfp);
191 if (!mq_rq->bounce_buf) 189 if (!mq_rq->bounce_buf)
@@ -223,8 +221,6 @@ static void mmc_exit_request(struct request_queue *q, struct request *req)
223 221
224 kfree(mq_rq->sg); 222 kfree(mq_rq->sg);
225 mq_rq->sg = NULL; 223 mq_rq->sg = NULL;
226
227 mq_rq->req = NULL;
228} 224}
229 225
230/** 226/**
@@ -373,12 +369,13 @@ unsigned int mmc_queue_map_sg(struct mmc_queue *mq, struct mmc_queue_req *mqrq)
373 unsigned int sg_len; 369 unsigned int sg_len;
374 size_t buflen; 370 size_t buflen;
375 struct scatterlist *sg; 371 struct scatterlist *sg;
372 struct request *req = mmc_queue_req_to_req(mqrq);
376 int i; 373 int i;
377 374
378 if (!mqrq->bounce_buf) 375 if (!mqrq->bounce_buf)
379 return blk_rq_map_sg(mq->queue, mqrq->req, mqrq->sg); 376 return blk_rq_map_sg(mq->queue, req, mqrq->sg);
380 377
381 sg_len = blk_rq_map_sg(mq->queue, mqrq->req, mqrq->bounce_sg); 378 sg_len = blk_rq_map_sg(mq->queue, req, mqrq->bounce_sg);
382 379
383 mqrq->bounce_sg_len = sg_len; 380 mqrq->bounce_sg_len = sg_len;
384 381
@@ -400,7 +397,7 @@ void mmc_queue_bounce_pre(struct mmc_queue_req *mqrq)
400 if (!mqrq->bounce_buf) 397 if (!mqrq->bounce_buf)
401 return; 398 return;
402 399
403 if (rq_data_dir(mqrq->req) != WRITE) 400 if (rq_data_dir(mmc_queue_req_to_req(mqrq)) != WRITE)
404 return; 401 return;
405 402
406 sg_copy_to_buffer(mqrq->bounce_sg, mqrq->bounce_sg_len, 403 sg_copy_to_buffer(mqrq->bounce_sg, mqrq->bounce_sg_len,
@@ -416,7 +413,7 @@ void mmc_queue_bounce_post(struct mmc_queue_req *mqrq)
416 if (!mqrq->bounce_buf) 413 if (!mqrq->bounce_buf)
417 return; 414 return;
418 415
419 if (rq_data_dir(mqrq->req) != READ) 416 if (rq_data_dir(mmc_queue_req_to_req(mqrq)) != READ)
420 return; 417 return;
421 418
422 sg_copy_from_buffer(mqrq->bounce_sg, mqrq->bounce_sg_len, 419 sg_copy_from_buffer(mqrq->bounce_sg, mqrq->bounce_sg_len,