From patchwork Fri May 19 13:37:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 100191 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp319163qge; Fri, 19 May 2017 06:37:51 -0700 (PDT) X-Received: by 10.98.34.22 with SMTP id i22mr10799133pfi.103.1495201071034; Fri, 19 May 2017 06:37:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495201071; cv=none; d=google.com; s=arc-20160816; b=tJLVIzbKyRR09luLbIICKjMKE5JxiEOtbjtW8mtGKMbwbi0z+HH8B3S9RPC4lezXa9 9A5o/R0YXPN7xIETi+ME2NiJxf4/RlVjcEe8Nchimw4R9bkRJAx6oNDM+dMU7asCXhra 0nuugFCIfwLl7WUcvoRzaCHc0Vcn5Ci/IFM/wViJF3gpZPwbpoZwQx63NUERmf7DDgww zQbEr3J/AAIx1Y6b8lfJgAlyxUBsrKgk0qam3K8gPimALkkgjvFo73cdfpuDMVoB43yt mSYJB1R6ZsYwR7QiiWZtkA/5j2KzMnCfKSF98tJNcEbjDCJ6L4X373t8fGun4b+YeJDy HDUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=nMO5UxG1e5O0/yH90jzbJmGILxpN0vvonhg6VVWJ5uc=; b=sLa2h8GCbYydFzqAOx8a16gbRSmJGTp5fwXMrOxIsg23oIL61wClsp0yZAa9v58sZV qKQvmiHUOz+QL1KXgcsgiahNvjgnYRLuQKoaBEGo7QF+vC0Qp1ChJXDFKI3m3YeYowv6 2tXLkl3CDBITQh9R5prEQk9gkbwHyHwQHBobGBN9IMpD1nAFI/IQAj2hveEpC4pqmgXE 4zwSWvBhswnh2N3kkZl5qaZlKFasIsvES1GKjIvtS2zRvuqqx1gKKGkEvcj6Biw1wx/z cEyqozNFURiG2ZKbSh2HM2pOjKN2ATseJXXfLGM+c6QukleTZ66jftqi5GYmLbVFbFms LNag== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si8689720plb.270.2017.05.19.06.37.50; Fri, 19 May 2017 06:37:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752997AbdESNht (ORCPT + 6 others); Fri, 19 May 2017 09:37:49 -0400 Received: from mail-lf0-f44.google.com ([209.85.215.44]:36474 "EHLO mail-lf0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752338AbdESNhs (ORCPT ); Fri, 19 May 2017 09:37:48 -0400 Received: by mail-lf0-f44.google.com with SMTP id h4so1206976lfj.3 for ; Fri, 19 May 2017 06:37:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0ZBVtWtNwaiqPI+Dv653nKDEQ8TOX7Oh4OhnYWzcsnk=; b=VwYMuQpLEYQyujRbV7jbBZzkwK0IiVpBq0JY2rJNtWL3dE6TlHyeX4Z7ABEck9l6V4 VRVfDYtcBbE3JCkm+1gOOWboPQFzTN9+3PL2baLmR97Sw8PASX955K5dHU6aKPJP5GaI 1tEguIwfE0pEsB/mz5VIEz6VqkxO59alOhmAQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0ZBVtWtNwaiqPI+Dv653nKDEQ8TOX7Oh4OhnYWzcsnk=; b=Qg93f/zLBNIBzXgY0W6eiOc97pP4ARsyF0q+3tEZT3nZ/+P1Vx3WVcCZBpAxqHHrTs df3VVGYc+meVM7jw6fTPRvtZRweXWjij1f3NIPdhS/hLCVWAWZoNeKVzxt4lGE5p6vcX BnaYFqOTSL7MFZvcB+j62tNyfPsvPy/t3PYGUyOZsOH/hY6hKFwvGvp6P2Hvv/uM7Cbd CDJ/6Izf644IX7Om8ua4vgqaT9d1otRqK7Czcg/E0S271kstA09DIJNg9iDiA/SbyN6E c9wKHgSktmYItDrYE0PfTrgnV8mapnv4RQQUFbdQDPYYJ3bkmiNTzn8KnNrCtGqMzPeB WC5w== X-Gm-Message-State: AODbwcA/LekWpHF6U0mBMgD70Na4uuE+uEuQtKWJpLsZ+BU48n28O3Ny 8JxicJkimfgw0Buv X-Received: by 10.25.202.27 with SMTP id a27mr2218272lfg.70.1495201066739; Fri, 19 May 2017 06:37:46 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 19sm1514130ljf.32.2017.05.19.06.37.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 May 2017 06:37:45 -0700 (PDT) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter Cc: linux-block@vger.kernel.org, Jens Axboe , Christoph Hellwig , Arnd Bergmann , Bartlomiej Zolnierkiewicz , Paolo Valente , Avri Altman , Linus Walleij Subject: [PATCH 1/6] mmc: block: remove req back pointer Date: Fri, 19 May 2017 15:37:27 +0200 Message-Id: <20170519133732.27470-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170519133732.27470-1-linus.walleij@linaro.org> References: <20170519133732.27470-1-linus.walleij@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org 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 Signed-off-by: Linus Walleij --- drivers/mmc/core/block.c | 8 ++++---- drivers/mmc/core/queue.c | 13 +++++-------- drivers/mmc/core/queue.h | 8 +++++++- 3 files changed, 16 insertions(+), 13 deletions(-) -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index e9737987956f..553ab4d1db94 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -1366,7 +1366,7 @@ static enum mmc_blk_status mmc_blk_err_check(struct mmc_card *card, struct mmc_queue_req *mq_mrq = container_of(areq, struct mmc_queue_req, areq); struct mmc_blk_request *brq = &mq_mrq->brq; - struct request *req = mq_mrq->req; + struct request *req = mmc_queue_req_to_req(mq_mrq); int need_retune = card->host->need_retune; bool ecc_err = false; bool gen_err = false; @@ -1473,7 +1473,7 @@ static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq, struct mmc_blk_data *md = mq->blkdata; struct mmc_card *card = md->queue.card; struct mmc_blk_request *brq = &mqrq->brq; - struct request *req = mqrq->req; + struct request *req = mmc_queue_req_to_req(mqrq); /* * Reliable writes are used to implement Forced Unit Access and @@ -1578,7 +1578,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, { u32 readcmd, writecmd; struct mmc_blk_request *brq = &mqrq->brq; - struct request *req = mqrq->req; + struct request *req = mmc_queue_req_to_req(mqrq); struct mmc_blk_data *md = mq->blkdata; bool do_rel_wr, do_data_tag; @@ -1760,7 +1760,7 @@ static void mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *new_req) */ mq_rq = container_of(old_areq, struct mmc_queue_req, areq); brq = &mq_rq->brq; - old_req = mq_rq->req; + old_req = mmc_queue_req_to_req(mq_rq); type = rq_data_dir(old_req) == READ ? MMC_BLK_READ : MMC_BLK_WRITE; mmc_queue_bounce_post(mq_rq); diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c index c18c41289ecf..4bf9978b707a 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, struct mmc_card *card = mq->card; struct mmc_host *host = card->host; - mq_rq->req = req; - if (card->bouncesz) { mq_rq->bounce_buf = kmalloc(card->bouncesz, gfp); if (!mq_rq->bounce_buf) @@ -223,8 +221,6 @@ static void mmc_exit_request(struct request_queue *q, struct request *req) kfree(mq_rq->sg); mq_rq->sg = NULL; - - mq_rq->req = NULL; } /** @@ -374,12 +370,13 @@ unsigned int mmc_queue_map_sg(struct mmc_queue *mq, struct mmc_queue_req *mqrq) unsigned int sg_len; size_t buflen; struct scatterlist *sg; + struct request *req = mmc_queue_req_to_req(mqrq); int i; if (!mqrq->bounce_buf) - return blk_rq_map_sg(mq->queue, mqrq->req, mqrq->sg); + return blk_rq_map_sg(mq->queue, req, mqrq->sg); - sg_len = blk_rq_map_sg(mq->queue, mqrq->req, mqrq->bounce_sg); + sg_len = blk_rq_map_sg(mq->queue, req, mqrq->bounce_sg); mqrq->bounce_sg_len = sg_len; @@ -401,7 +398,7 @@ void mmc_queue_bounce_pre(struct mmc_queue_req *mqrq) if (!mqrq->bounce_buf) return; - if (rq_data_dir(mqrq->req) != WRITE) + if (rq_data_dir(mmc_queue_req_to_req(mqrq)) != WRITE) return; sg_copy_to_buffer(mqrq->bounce_sg, mqrq->bounce_sg_len, @@ -417,7 +414,7 @@ void mmc_queue_bounce_post(struct mmc_queue_req *mqrq) if (!mqrq->bounce_buf) return; - if (rq_data_dir(mqrq->req) != READ) + if (rq_data_dir(mmc_queue_req_to_req(mqrq)) != READ) return; sg_copy_from_buffer(mqrq->bounce_sg, mqrq->bounce_sg_len, diff --git a/drivers/mmc/core/queue.h b/drivers/mmc/core/queue.h index dfe481a8b5ed..2793020a3c8c 100644 --- a/drivers/mmc/core/queue.h +++ b/drivers/mmc/core/queue.h @@ -12,6 +12,13 @@ static inline struct mmc_queue_req *req_to_mmc_queue_req(struct request *rq) return blk_mq_rq_to_pdu(rq); } +struct mmc_queue_req; + +static inline struct request *mmc_queue_req_to_req(struct mmc_queue_req *mqr) +{ + return blk_mq_rq_from_pdu(mqr); +} + struct task_struct; struct mmc_blk_data; struct mmc_blk_ioc_data; @@ -26,7 +33,6 @@ struct mmc_blk_request { }; struct mmc_queue_req { - struct request *req; struct mmc_blk_request brq; struct scatterlist *sg; char *bounce_buf;