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: 9534769 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 921C96042D for ; Tue, 24 Jan 2017 10:18:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 834EB24DA2 for ; Tue, 24 Jan 2017 10:18:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 77E4326BE9; Tue, 24 Jan 2017 10:18:16 +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 1955424DA2 for ; Tue, 24 Jan 2017 10:18:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750932AbdAXKSP (ORCPT ); Tue, 24 Jan 2017 05:18:15 -0500 Received: from mail-lf0-f48.google.com ([209.85.215.48]:32843 "EHLO mail-lf0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750836AbdAXKSO (ORCPT ); Tue, 24 Jan 2017 05:18:14 -0500 Received: by mail-lf0-f48.google.com with SMTP id x1so21438761lff.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=aB67J7eA/9VpTaepxVEdPl47Utq1KjwlawzxjTn0VBpyxV+vaHovEYQ83BSgkmA5E1 BkRFmYNmp7RjClNJmNCoZTZIXfin04gLx2k7/ssgpySkLFqYJJapUSVbzUdlqH99LRlb 4yZl67XjBWSVbCheBsY/G6i+nE2JqnTWtKPYeEahfQznVt27bUmxXPpsSQHN/FSJ9kG+ 0FMKKoj0LhcJODezAh8eqxPrVEGgh4cNsnsj/bstAZOZ9XDBArkYlezbtDr+pi845F78 EjbaX6DsKSKCR9hnKSWkF5Hf/+24zb7tiU+xS26qih8UMPG5OkG8h/Z0jzebnpZKJKDy MHRg== X-Gm-Message-State: AIkVDXIz/8To5+eoQAvvEbgO/Lki4k12AKZtLuzN1oic6ItPvGgFHuA8ylwiTZkVL+IBudi7 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-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@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; }