From patchwork Tue Sep 6 13:17:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 75509 Delivered-To: patch@linaro.org Received: by 10.140.106.11 with SMTP id d11csp543567qgf; Tue, 6 Sep 2016 06:16:26 -0700 (PDT) X-Received: by 10.28.20.77 with SMTP id 74mr19719143wmu.1.1473167785982; Tue, 06 Sep 2016 06:16:25 -0700 (PDT) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id et1si20726742wjd.133.2016.09.06.06.16.25; Tue, 06 Sep 2016 06:16:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CF1544BA35; Tue, 6 Sep 2016 15:16:21 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KESTm3bW0Uoa; Tue, 6 Sep 2016 15:16:21 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BC2F84B9AD; Tue, 6 Sep 2016 15:16:20 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EEF0C4B9F9 for ; Tue, 6 Sep 2016 15:16:04 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JDe4Uj4OXXmq for ; Tue, 6 Sep 2016 15:16:03 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from conuserg-10.nifty.com (conuserg-10.nifty.com [210.131.2.77]) by theia.denx.de (Postfix) with ESMTPS id 35AC94B9AD for ; Tue, 6 Sep 2016 15:15:56 +0200 (CEST) Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id u86DFbiq013304; Tue, 6 Sep 2016 22:15:40 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com u86DFbiq013304 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1473167740; bh=eWlJiMEZnksRCFvVdkCZdEEkVrJe46FVWbgJhqxnX5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RyLCRoKK9Sbh1YYckK6fHVZgCNOnJl/FnHgOJS0RWAZzjO3zCvzU5YOtNgZQVUhiP l0xOJaU0rl/Jkol/crGFI9oqr4O2maCIbqFzEen5ZatPF/Eitxv/7M5eGlMUh+AeeD cYrsK9ykLfbYt5VWEs71NiVnGiBfhmRwk0ZHljNrhyzVTApqsHXvPotJ2WCm4TlFGw +NRpvKQfDFoLxJ5fBoq/GAniLK5yZvHqI1vpa8rz6tEHOAbrfWAT9LTHCT12wGIXrw TU3fEgH43qhXNta+8Cha7OaUxcDNtuFZ6wjU91Y7qtdEVabGlL8ghzuSe3NUGvm+6l urdjjkp2792QA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Tue, 6 Sep 2016 22:17:32 +0900 Message-Id: <1473167860-27465-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1473167860-27465-1-git-send-email-yamada.masahiro@socionext.com> References: <1473167860-27465-1-git-send-email-yamada.masahiro@socionext.com> Cc: Marek Vasut , Stephen Warren Subject: [U-Boot] [PATCH v3 1/8] mmc: squash lines for immediate return X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" These functions can be much simpler by squashing lines for immediate return. For *_bind() callbacks, they will be a simple wrapper function of an upper-level bind API. For mmc_set_{boot_bus_width,part_conf}, they will be a wrapper of mmc_switch(). Signed-off-by: Masahiro Yamada --- Changes in v3: None drivers/mmc/atmel_sdhci.c | 7 +------ drivers/mmc/exynos_dw_mmc.c | 7 +------ drivers/mmc/mmc_boot.c | 28 ++++++++-------------------- drivers/mmc/msm_sdhci.c | 7 +------ drivers/mmc/rockchip_dw_mmc.c | 7 +------ drivers/mmc/rockchip_sdhci.c | 7 +------ drivers/mmc/sandbox_mmc.c | 7 +------ drivers/mmc/zynq_sdhci.c | 7 +------ 8 files changed, 15 insertions(+), 62 deletions(-) -- 1.9.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/drivers/mmc/atmel_sdhci.c b/drivers/mmc/atmel_sdhci.c index dd6bd33..d8f8087 100644 --- a/drivers/mmc/atmel_sdhci.c +++ b/drivers/mmc/atmel_sdhci.c @@ -136,13 +136,8 @@ static int atmel_sdhci_probe(struct udevice *dev) static int atmel_sdhci_bind(struct udevice *dev) { struct atmel_sdhci_plat *plat = dev_get_platdata(dev); - int ret; - ret = sdhci_bind(dev, &plat->mmc, &plat->cfg); - if (ret) - return ret; - - return 0; + return sdhci_bind(dev, &plat->mmc, &plat->cfg); } static const struct udevice_id atmel_sdhci_ids[] = { diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index 57271f1..568fed7 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -284,13 +284,8 @@ static int exynos_dwmmc_probe(struct udevice *dev) static int exynos_dwmmc_bind(struct udevice *dev) { struct exynos_mmc_plat *plat = dev_get_platdata(dev); - int ret; - ret = dwmci_bind(dev, &plat->mmc, &plat->cfg); - if (ret) - return ret; - - return 0; + return dwmci_bind(dev, &plat->mmc, &plat->cfg); } static const struct udevice_id exynos_dwmmc_ids[] = { diff --git a/drivers/mmc/mmc_boot.c b/drivers/mmc/mmc_boot.c index 756a982..ac6f56f 100644 --- a/drivers/mmc/mmc_boot.c +++ b/drivers/mmc/mmc_boot.c @@ -85,16 +85,10 @@ int mmc_boot_partition_size_change(struct mmc *mmc, unsigned long bootsize, */ int mmc_set_boot_bus_width(struct mmc *mmc, u8 width, u8 reset, u8 mode) { - int err; - - err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BOOT_BUS_WIDTH, - EXT_CSD_BOOT_BUS_WIDTH_MODE(mode) | - EXT_CSD_BOOT_BUS_WIDTH_RESET(reset) | - EXT_CSD_BOOT_BUS_WIDTH_WIDTH(width)); - - if (err) - return err; - return 0; + return mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BOOT_BUS_WIDTH, + EXT_CSD_BOOT_BUS_WIDTH_MODE(mode) | + EXT_CSD_BOOT_BUS_WIDTH_RESET(reset) | + EXT_CSD_BOOT_BUS_WIDTH_WIDTH(width)); } /* @@ -106,16 +100,10 @@ int mmc_set_boot_bus_width(struct mmc *mmc, u8 width, u8 reset, u8 mode) */ int mmc_set_part_conf(struct mmc *mmc, u8 ack, u8 part_num, u8 access) { - int err; - - err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_PART_CONF, - EXT_CSD_BOOT_ACK(ack) | - EXT_CSD_BOOT_PART_NUM(part_num) | - EXT_CSD_PARTITION_ACCESS(access)); - - if (err) - return err; - return 0; + return mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_PART_CONF, + EXT_CSD_BOOT_ACK(ack) | + EXT_CSD_BOOT_PART_NUM(part_num) | + EXT_CSD_PARTITION_ACCESS(access)); } /* diff --git a/drivers/mmc/msm_sdhci.c b/drivers/mmc/msm_sdhci.c index 8d4399e..1b82991 100644 --- a/drivers/mmc/msm_sdhci.c +++ b/drivers/mmc/msm_sdhci.c @@ -190,13 +190,8 @@ static int msm_ofdata_to_platdata(struct udevice *dev) static int msm_sdc_bind(struct udevice *dev) { struct msm_sdhc_plat *plat = dev_get_platdata(dev); - int ret; - ret = sdhci_bind(dev, &plat->mmc, &plat->cfg); - if (ret) - return ret; - - return 0; + return sdhci_bind(dev, &plat->mmc, &plat->cfg); } static const struct udevice_id msm_mmc_ids[] = { diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c index 020a59b..859760b 100644 --- a/drivers/mmc/rockchip_dw_mmc.c +++ b/drivers/mmc/rockchip_dw_mmc.c @@ -142,13 +142,8 @@ static int rockchip_dwmmc_probe(struct udevice *dev) static int rockchip_dwmmc_bind(struct udevice *dev) { struct rockchip_mmc_plat *plat = dev_get_platdata(dev); - int ret; - ret = dwmci_bind(dev, &plat->mmc, &plat->cfg); - if (ret) - return ret; - - return 0; + return dwmci_bind(dev, &plat->mmc, &plat->cfg); } static const struct udevice_id rockchip_dwmmc_ids[] = { diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c index 624029b..c56e1a3 100644 --- a/drivers/mmc/rockchip_sdhci.c +++ b/drivers/mmc/rockchip_sdhci.c @@ -62,13 +62,8 @@ static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev) static int rockchip_sdhci_bind(struct udevice *dev) { struct rockchip_sdhc_plat *plat = dev_get_platdata(dev); - int ret; - ret = sdhci_bind(dev, &plat->mmc, &plat->cfg); - if (ret) - return ret; - - return 0; + return sdhci_bind(dev, &plat->mmc, &plat->cfg); } static const struct udevice_id arasan_sdhci_ids[] = { diff --git a/drivers/mmc/sandbox_mmc.c b/drivers/mmc/sandbox_mmc.c index 5f1333b..fdb29a5 100644 --- a/drivers/mmc/sandbox_mmc.c +++ b/drivers/mmc/sandbox_mmc.c @@ -112,7 +112,6 @@ int sandbox_mmc_bind(struct udevice *dev) { struct sandbox_mmc_plat *plat = dev_get_platdata(dev); struct mmc_config *cfg = &plat->cfg; - int ret; cfg->name = dev->name; cfg->host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS | MMC_MODE_8BIT; @@ -121,11 +120,7 @@ int sandbox_mmc_bind(struct udevice *dev) cfg->f_max = 52000000; cfg->b_max = U32_MAX; - ret = mmc_bind(dev, &plat->mmc, cfg); - if (ret) - return ret; - - return 0; + return mmc_bind(dev, &plat->mmc, cfg); } int sandbox_mmc_unbind(struct udevice *dev) diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c index 3815b94..b991102 100644 --- a/drivers/mmc/zynq_sdhci.c +++ b/drivers/mmc/zynq_sdhci.c @@ -63,13 +63,8 @@ static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev) static int arasan_sdhci_bind(struct udevice *dev) { struct arasan_sdhci_plat *plat = dev_get_platdata(dev); - int ret; - ret = sdhci_bind(dev, &plat->mmc, &plat->cfg); - if (ret) - return ret; - - return 0; + return sdhci_bind(dev, &plat->mmc, &plat->cfg); } static const struct udevice_id arasan_sdhci_ids[] = {