From patchwork Tue Mar 28 08:40:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9648367 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 59D3D60349 for ; Tue, 28 Mar 2017 08:41:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E7BF20855 for ; Tue, 28 Mar 2017 08:41:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 430A725E13; Tue, 28 Mar 2017 08:41:31 +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 A0CBB25E13 for ; Tue, 28 Mar 2017 08:41:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754537AbdC1Il3 (ORCPT ); Tue, 28 Mar 2017 04:41:29 -0400 Received: from mail-lf0-f53.google.com ([209.85.215.53]:36277 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754563AbdC1Il2 (ORCPT ); Tue, 28 Mar 2017 04:41:28 -0400 Received: by mail-lf0-f53.google.com with SMTP id x137so33901294lff.3 for ; Tue, 28 Mar 2017 01:40:46 -0700 (PDT) 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=OVqwl5e3oquAlH330rQL6dUGpLarK9OGsT6SIBGJd2g=; b=hOzxp2vP7q4IiA2ackHAwJw+gn8FeT7PrpODYKWwGeiNSn0wmKscB4DMqq9zY4laoM mL520wCgrrQK7KShEfbkQ+zNyDN9Jrdf5/is9cKiuOXGGmWjZmxQLKCcJzk8NUjbS3cR Ey2FdWNjwGdj66xcL6+6F8h7hayBWaUjHSMyU= 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=OVqwl5e3oquAlH330rQL6dUGpLarK9OGsT6SIBGJd2g=; b=imcDQHYqgOc68rEV/gbnQ4uMW8VHbbpDE00B/0uMbjC5Yr7nUHeUXc86P3xgqH8r8X MNtmuP1M3jwo56uEGcB/p7+a8tlfe/ZaPhBAvRrYUqYB8Tf3Mi8ckCGW3pvKtlnMHFPp uvm1fg7hwEfPBoMA3uvIJ2s0Heu6S9XVn5xBGtnto1wy0CmCm57fm5cBZdNWN/bwRDOJ +aiJVaVeMDSZNMo0XEm3jxUhDxblL1WmlV6kbb20rAEtn9ON9tWA6qLJmz6++hdpeQwk eF5NiDX6efPs5wbLhDtYxNr9a4gKC1Wk3nZVHnyg9w+dBLFOxy0PIWMHToAmnfIxTxDk pQtw== X-Gm-Message-State: AFeK/H3W9nU6Nt1iY0MKxSVba7RHAyw1gG5LySBDDJELqOblGIZDmp+pByVJTSEQN2CinwpU X-Received: by 10.25.21.37 with SMTP id l37mr12092745lfi.146.1490690445808; Tue, 28 Mar 2017 01:40:45 -0700 (PDT) Received: from localhost.localdomain (c-357171d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.113.53]) by smtp.gmail.com with ESMTPSA id s13sm539590ljd.3.2017.03.28.01.40.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Mar 2017 01:40:44 -0700 (PDT) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter Cc: Bartlomiej Zolnierkiewicz , Linus Walleij Subject: [PATCH 1/3] mmc: core: move some code in mmc_start_areq() Date: Tue, 28 Mar 2017 10:40:29 +0200 Message-Id: <20170328084031.11995-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170328084031.11995-1-linus.walleij@linaro.org> References: <20170328084031.11995-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 "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(). Reviewed-by: Bartlomiej Zolnierkiewicz Signed-off-by: Linus Walleij --- 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 926e0fde07d7..b8468950e59d 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);