From patchwork Tue Jan 24 10:17:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9534771 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 822436042D for ; Tue, 24 Jan 2017 10:18:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 736C324DA2 for ; Tue, 24 Jan 2017 10:18:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 686A126AE3; Tue, 24 Jan 2017 10:18:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 618BC25D99 for ; Tue, 24 Jan 2017 10:18:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750931AbdAXKSP (ORCPT ); Tue, 24 Jan 2017 05:18:15 -0500 Received: from mail-lf0-f47.google.com ([209.85.215.47]:32843 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750843AbdAXKSO (ORCPT ); Tue, 24 Jan 2017 05:18:14 -0500 Received: by mail-lf0-f47.google.com with SMTP id x1so21438760lff.0 for ; Tue, 24 Jan 2017 02:18:13 -0800 (PST) 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=gMw2d3WlT4rETEPf9o1ShAwGeEdYqxfb2joEfYkc2uk=; b=hqUAVOlU1jwNT9W1Y2XgEtqaIGCi/S4WH9Ox60bA1mJ404nZ7efmF9b5xKJ4Ap+cmm UYiRTKO5eq2kxGJyAw1bLF8q0Lqsif45oQp/M1N2qkHboAHNOnAAyL/lY8o7xDeqKsrI q+m/RT6x6USAHKmwIKmSito7Oe+5r+yJ5DVwU= 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=gMw2d3WlT4rETEPf9o1ShAwGeEdYqxfb2joEfYkc2uk=; b=CNNPH4tqLs6iLdvPi4O62Hyf3CHfzomMI3vnaICwaQ/PKL2aD9zMMc/nqE03UZDJO5 mHD5J4VgymEK3ysrvGDgRS1/Os/z5dXX1aP/g1xqMapsmsSPtCZjxrz3nEsy9STIZFSL ReR2nOjvLCEtyPgzzHGT+1NSGHYftjyyLElRx2vE4j/rU60hZcRKVTBQzx3QVT1Ujvut s+pxvB2STl6XrUUafJgbsWSWVvX88qgrtaMEbQMeuEDAtUmy/VwQov58pEXPdnXMZ0P+ aAyTpQ4XUQEaoUGWKOQN3xX3nnhLlLrWzRhed0ZqHGORmmrqQPRrKCYtTp/u9xmuaOB5 z2Lg== X-Gm-Message-State: AIkVDXJDnfDNh3lUQ6sJ3Ic8bqlApDPz6edwS4NzOWoVAACIj60PJBAPfOY/qGIFVzVYJsE3 X-Received: by 10.25.72.209 with SMTP id v200mr11225224lfa.74.1485253092842; Tue, 24 Jan 2017 02:18:12 -0800 (PST) Received: from gnarp.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id o91sm7410797lfg.17.2017.01.24.02.18.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jan 2017 02:18:11 -0800 (PST) From: Linus Walleij To: linux-mmc@vger.kernel.org, linux-block@vger.kernel.org, Ulf Hansson Cc: Chunyan Zhang , Baolin Wang , Paolo Valente , Linus Walleij Subject: [PATCH 2/6] mmc: block: break out mmc_blk_rw_start_new() Date: Tue, 24 Jan 2017 11:17:53 +0100 Message-Id: <20170124101757.19676-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170124101757.19676-1-linus.walleij@linaro.org> References: <20170124101757.19676-1-linus.walleij@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As a step toward breaking apart the very complex function mmc_blk_issue_rw_rq() we break out the code to start a new request. Signed-off-by: Linus Walleij --- drivers/mmc/core/block.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 14efe92a14ef..b60d1fb3a07a 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -1609,6 +1609,22 @@ static void mmc_blk_rw_cmd_abort(struct mmc_card *card, struct request *req) blk_rq_cur_bytes(req)); } +static void mmc_blk_rw_start_new(struct mmc_queue *mq, struct mmc_card *card, + struct request *req) +{ + if (!req) + return; + + if (mmc_card_removed(card)) { + req->rq_flags |= RQF_QUIET; + blk_end_request_all(req, -EIO); + } else { + mmc_blk_rw_rq_prep(mq->mqrq_cur, card, 0, mq); + mmc_start_req(card->host, + &mq->mqrq_cur->mmc_active, NULL); + } +} + static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) { struct mmc_blk_data *md = mq->blkdata; @@ -1751,16 +1767,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) mmc_blk_rw_cmd_abort(card, req); start_new_req: - if (rqc) { - if (mmc_card_removed(card)) { - rqc->rq_flags |= RQF_QUIET; - blk_end_request_all(rqc, -EIO); - } else { - mmc_blk_rw_rq_prep(mq->mqrq_cur, card, 0, mq); - mmc_start_req(card->host, - &mq->mqrq_cur->mmc_active, NULL); - } - } + mmc_blk_rw_start_new(mq, card, rqc); return 0; }