From patchwork Thu Feb 9 15:33:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9564967 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 93BEA60236 for ; Thu, 9 Feb 2017 15:41:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8344A2853A for ; Thu, 9 Feb 2017 15:41:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 781DE2853D; Thu, 9 Feb 2017 15:41: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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI 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 DE75D2853C for ; Thu, 9 Feb 2017 15:41:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752003AbdBIPlM (ORCPT ); Thu, 9 Feb 2017 10:41:12 -0500 Received: from mail-lf0-f54.google.com ([209.85.215.54]:33559 "EHLO mail-lf0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751226AbdBIPlL (ORCPT ); Thu, 9 Feb 2017 10:41:11 -0500 Received: by mail-lf0-f54.google.com with SMTP id x1so4695465lff.0 for ; Thu, 09 Feb 2017 07:41: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=yBj/RX3s/9Y2Y+Vve3S0fDZgFW5S2nqVcsZ/8X7wZkM=; b=Ul/BN0vsgKgsV0MNBnhg5Xy6T/2QYA0+Zz5w+b1ZDXCLtqxPXpR7YbU+uRwT9AUj11 R4zcZ7qXgqGJN08Azcw7KLYJF2wKDNO58ARbsy83D8GZ5Xuyn0Ugx/w3dV1lwKX4aMSX UPgiIVoOaWYLxom3q7neamluJL0ZLOhuhNOQY= 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=yBj/RX3s/9Y2Y+Vve3S0fDZgFW5S2nqVcsZ/8X7wZkM=; b=OdkBxjt2Um/MVurh/EUgICBxjsQshLTggAWiTzmjIpKQ9U5489vkCSx6GHXI5pPuh/ H8kwAC6vEifvhFmzXqzmSMopw/efBppE6px6LN/XZsDiJomYjnCgtoq+6o7O+1U2kPYF AcSu85v5FFIuw+pT46G4do2gsLIuur7yIfTNq2I45SX/4JuQ1je93pfPTFPCSDFtxOZR ia9L3iRWKuxMIeBHZ1fgdi23rQVN8GkvNMv3LPpCy/ExLVaOfR8qk/gJI3W9/+A506o9 3tR1exclKHhWJcunwha7SXWC2cOoof1n5XzNf9IJRFjbxlcW/bnwsLVOF0gTaEO/724n b4mA== X-Gm-Message-State: AMke39nUacahFCEICX3mydrJRmf6JU80fIO+eb+m2FL52yF/Aeury31HjT7jTGoMgw3lMiKb X-Received: by 10.46.20.14 with SMTP id u14mr1403048ljd.30.1486654467651; Thu, 09 Feb 2017 07:34:27 -0800 (PST) Received: from gnarp.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id e86sm3670614lji.32.2017.02.09.07.34.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Feb 2017 07:34:26 -0800 (PST) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter , Paolo Valente Cc: Chunyan Zhang , Baolin Wang , linux-block@vger.kernel.org, Jens Axboe , Christoph Hellwig , Arnd Bergmann , Linus Walleij Subject: [PATCH 01/16] mmc: core: move some code in mmc_start_areq() Date: Thu, 9 Feb 2017 16:33:48 +0100 Message-Id: <20170209153403.9730-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170209153403.9730-1-linus.walleij@linaro.org> References: <20170209153403.9730-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 "previous" is a better name for the variable storing the previous asynchronous request, better than the opaque name "data" atleast. We see that we assign the return status to the returned variable on all code paths, so we might as well just do that immediately after calling mmc_finalize_areq(). Signed-off-by: Linus Walleij Reviewed-by: Bartlomiej Zolnierkiewicz --- drivers/mmc/core/core.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 41b4cd01fccc..53065d1cebf7 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -683,7 +683,7 @@ struct mmc_async_req *mmc_start_areq(struct mmc_host *host, { enum mmc_blk_status status; int start_err = 0; - struct mmc_async_req *data = host->areq; + struct mmc_async_req *previous = host->areq; /* Prepare a new request */ if (areq) @@ -691,13 +691,12 @@ struct mmc_async_req *mmc_start_areq(struct mmc_host *host, /* Finalize previous request */ status = mmc_finalize_areq(host); + if (ret_stat) + *ret_stat = status; /* The previous request is still going on... */ - if (status == MMC_BLK_NEW_REQUEST) { - if (ret_stat) - *ret_stat = status; + if (status == MMC_BLK_NEW_REQUEST) return NULL; - } /* Fine so far, start the new request! */ if (status == MMC_BLK_SUCCESS && areq) @@ -716,9 +715,7 @@ struct mmc_async_req *mmc_start_areq(struct mmc_host *host, else host->areq = areq; - if (ret_stat) - *ret_stat = status; - return data; + return previous; } EXPORT_SYMBOL(mmc_start_areq);