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: 92320 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp1624269obz; Tue, 24 Jan 2017 02:18:13 -0800 (PST) X-Received: by 10.84.179.99 with SMTP id a90mr9675925plc.139.1485253093552; Tue, 24 Jan 2017 02:18:13 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m1si7259622pfb.261.2017.01.24.02.18.13; Tue, 24 Jan 2017 02:18:13 -0800 (PST) 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 S1750939AbdAXKSM (ORCPT + 5 others); 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 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(-) -- 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 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) {