From patchwork Tue Jan 24 10:17:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9534767 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 75EE3604A4 for ; Tue, 24 Jan 2017 10:18:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6731D24DA2 for ; Tue, 24 Jan 2017 10:18:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C01025D99; Tue, 24 Jan 2017 10:18:13 +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 0995826AE3 for ; Tue, 24 Jan 2017 10:18:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750939AbdAXKSM (ORCPT ); Tue, 24 Jan 2017 05:18:12 -0500 Received: from mail-lf0-f50.google.com ([209.85.215.50]:36203 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750932AbdAXKSL (ORCPT ); Tue, 24 Jan 2017 05:18:11 -0500 Received: by mail-lf0-f50.google.com with SMTP id z134so108124968lff.3 for ; Tue, 24 Jan 2017 02:18:10 -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=Pz6iO21qQtL7RmH1/kw98a7PmY6Q3PGJ+uqoyejdsPw=; b=AJET63nRl2OBYruTz4YrD+h8oUwEFEqphQoUAK4AaKMDyxPoytlTLGoVOm2YWicn+Q 8tkm3w4snORm7ITiGRASmtQchOUEfAgG+nAx8TB8JW98b8nWcXbnawshGQCXHbPjqdg/ B6j0XtTNdZyfKTc0ZDmrZRKYs55vBwSNZ4k2w= 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=Pz6iO21qQtL7RmH1/kw98a7PmY6Q3PGJ+uqoyejdsPw=; b=T00tnN7GDQlIgVccLfHAxuqQUCtqprnRPVIKygcpwbXuCSdQPwIxKYZhIxAT24T/SQ J33os8i1pnRJoTrOf14XNa7Nm9vLsU6bqA3gX27qYjB2q0d37TDGKkZRabpIRazT62HU QeuKH9rAlSrJwC5jIRiWftPbmlvrph6PGwwXkFr3eY0JsD/2sug+y6929Ut9ubeQlcUf 8e2s6a6d6kYmjPY8v4jAxA0us8lb2cijjzltSyVDzI/TdHdcGBRCKlX2gEGMVviw1cV6 fswYP3zhCWHdEHbK3C608ere6shB4fBVCml7YAIkMxqfzqe51W/QlX4XorJjBHN7TBDe lv2w== X-Gm-Message-State: AIkVDXKz8FemamvX+niIa2KUQTg4Hlbt99fGrS08GM070HDbmY9BDJRGOcCxOPCFqVgmZyoA X-Received: by 10.46.71.207 with SMTP id u198mr13067403lja.42.1485253089606; Tue, 24 Jan 2017 02:18:09 -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.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jan 2017 02:18:08 -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 1/6] mmc: block: break out mmc_blk_rw_cmd_abort() Date: Tue, 24 Jan 2017 11:17:52 +0100 Message-Id: <20170124101757.19676-2-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 first step toward breaking apart the very complex function mmc_blk_issue_rw_rq() we break out the command abort code. This code assumes "ret" is != 0 and then repeatedly hammers blk_end_request() until the request to the block layer to end the request succeeds. Signed-off-by: Linus Walleij --- drivers/mmc/core/block.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 7bd03381810d..14efe92a14ef 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -1598,6 +1598,17 @@ static int mmc_blk_cmd_err(struct mmc_blk_data *md, struct mmc_card *card, return ret; } +static void mmc_blk_rw_cmd_abort(struct mmc_card *card, struct request *req) +{ + int ret = 1; + + if (mmc_card_removed(card)) + req->rq_flags |= RQF_QUIET; + while (ret) + ret = blk_end_request(req, -EIO, + blk_rq_cur_bytes(req)); +} + static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) { struct mmc_blk_data *md = mq->blkdata; @@ -1737,11 +1748,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) return 1; cmd_abort: - if (mmc_card_removed(card)) - req->rq_flags |= RQF_QUIET; - while (ret) - ret = blk_end_request(req, -EIO, - blk_rq_cur_bytes(req)); + mmc_blk_rw_cmd_abort(card, req); start_new_req: if (rqc) {