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: 9534765 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 2AD156042D 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 1525024DA2 for ; Tue, 24 Jan 2017 10:18:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09D2C26BE9; 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 B2E5424DA2 for ; Tue, 24 Jan 2017 10:18:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750937AbdAXKSM (ORCPT ); Tue, 24 Jan 2017 05:18:12 -0500 Received: from mail-lf0-f42.google.com ([209.85.215.42]:34554 "EHLO mail-lf0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750935AbdAXKSL (ORCPT ); Tue, 24 Jan 2017 05:18:11 -0500 Received: by mail-lf0-f42.google.com with SMTP id v186so108164563lfa.1 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=fVCEQOrGkRPXtvXBBmkbbD33lDDpXfEJL68a3wd8J8nzN6GxO/9xt57qQQDLg7NwDd gTWVZR18sYLilfz/bvV6o/dLekCo0CNfIGJ139MyicQLewW3hHP+GxxNklbEuPrQhOXD viy5olkxLtN9Z7k3MGH8rgGbt5JRR+mGkGOHOY4A/Il5WXXKurLuTz/X04bNv4Hxu9X4 GmkxLHGqzEjp+uQtEleOESccL2Jsl1uHMsDCpPvEPsrVMxRfV6fJtlTn9Ss2il4uz4hC 9GZluW+ROUUc7+a9AYUOHYFT82x9DLsVbu7FZXzjBplOhmnaVD02DTLmIjmUMuaTZwyh jiSw== X-Gm-Message-State: AIkVDXLMBj6vVFZeSwVR01iU2Yaywp6jYk02js3wDNJgYgSrAfbUslNF3wANIZq/AQcK9XdI 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-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 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) {