Clean-up: squash lines for immediate return
Subsystems (21)
v3 cover Clean-up: squash lines for immediate return
ret = [expression];
if (ret)
return ret;
return 0;
... is equivalent to:
return [expression];
First, I sent a tree-wide patch:
http://patchwork.ozlabs.org/patch/665199/
In the review of v1, Stephen suggested that twee-wide conversion with something like Coccinelle can break code uniformity.
I took a closer look once again, I found many hunks we should not change.
So, here is an updated series.
I limited this refactoring to cases, I think, really beneficial.
(Mostly, they well be simple wrappers with this series.)
I also split patches per-subsystem
for easier review and Acked-by
(or NACK if reviewers found no good reason to change).
Masahiro Yamada (8):
mmc: squash lines for immediate return
video: squash lines for immediate return
usb: replace ehci_*_remove() with usb_deregister()
usb: squash lines for immediate return
x86: squash lines for immediate return
libfdt: simplify fdt_del_mem_rsv() arch,board: squash lines for immediate return
drivers: squash lines for immediate return
arch/arm/cpu/arm920t/imx/timer.c | 6 +----- arch/arm/cpu/armv7/am33xx/sys_info.c | 4 +--- arch/arm/cpu/sa1100/timer.c | 5 +---- arch/arm/mach-zynq/cpu.c | 8 ++------ arch/blackfin/cpu/interrupts.c | 5 +---- arch/m68k/lib/time.c | 4 +--- arch/powerpc/cpu/mpc512x/cpu.c | 6 +----- arch/powerpc/cpu/mpc83xx/cpu.c | 6 +----- arch/x86/cpu/baytrail/valleyview.c | 8 +------- arch/x86/cpu/ivybridge/ivybridge.c | 8 +------- arch/x86/cpu/qemu/qemu.c | 8 +------- arch/x86/cpu/queensbay/tnc.c | 8 +------- arch/xtensa/lib/time.c | 5 +---- board/amcc/bamboo/bamboo.c | 6 +----- board/amcc/bubinga/bubinga.c | 5 +---- board/amcc/canyonlands/canyonlands.c | 6 +----- board/corscience/tricorder/tricorder-eeprom.c | 20 +++++-------------- board/freescale/common/zm7300.c | 4 +--- board/samsung/goni/goni.c | 8 +------- board/ti/omap5_uevm/evm.c | 5 +---- common/usb.c | 20 +++++++------------ common/usb_kbd.c | 5 +---- common/usb_storage.c | 9 +++------ drivers/block/sym53c8xx.c | 5 ++--- drivers/ddr/fsl/ddr1_dimm_params.c | 12 ++---------- drivers/ddr/fsl/ddr2_dimm_params.c | 12 ++---------- drivers/ddr/marvell/a38x/ddr3_a38x.c | 6 +----- 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 +------ drivers/power/axp809.c | 8 +------- drivers/rtc/m48t35ax.c | 4 +--- drivers/usb/host/ehci-atmel.c | 13 +------------ drivers/usb/host/ehci-fsl.c | 13 +------------ drivers/usb/host/ehci-generic.c | 7 +------ drivers/usb/host/ehci-marvell.c | 13 +------------ drivers/usb/host/ehci-mx6.c | 13 +------------ drivers/usb/host/ehci-pci.c | 13 +------------ drivers/usb/host/ehci-tegra.c | 13 +------------ drivers/usb/host/ehci-zynq.c | 13 +------------ drivers/usb/host/xhci-fsl.c | 7 +------ drivers/video/bridge/ptn3460.c | 7 +------ drivers/video/broadwell_igd.c | 5 +---- drivers/video/exynos/exynos_dp_lowlevel.c | 6 +----- drivers/video/tegra124/display.c | 8 +------- drivers/video/vidconsole-uclass.c | 6 +----- lib/libfdt/fdt_rw.c | 6 +----- 52 files changed, 75 insertions(+), 361 deletions(-)
Signature · 1 line
1.9.1
PATCH v3 1/8 mmc: squash lines for immediate return
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().
---
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(-)
drivers/mmc/atmel_sdhci.c +1 -6
@@ -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[] = {
drivers/mmc/exynos_dw_mmc.c +1 -6
@@ -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[] = {
drivers/mmc/mmc_boot.c +8 -20
@@ -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)); }/*
drivers/mmc/msm_sdhci.c +1 -6
@@ -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[] = {
drivers/mmc/rockchip_dw_mmc.c +1 -6
@@ -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[] = {
drivers/mmc/rockchip_sdhci.c +1 -6
@@ -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[] = {
drivers/mmc/sandbox_mmc.c +1 -6
@@ -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)
drivers/mmc/zynq_sdhci.c +1 -6
@@ -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[] = {
Signature · 1 line
1.9.1
PATCH v3 1/8 mmc: squash lines for immediate return
Quoted 10 lines · Masahiro Yamada
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 <[email protected]>
Best Regards,
Jaehoon Chung
Quoted 200 lines
---
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(-)drivers/mmc/atmel_sdhci.c +1
-6@@ -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[] = {drivers/mmc/exynos_dw_mmc.c +1
-6@@ -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[] = {drivers/mmc/mmc_boot.c +8
-20@@ -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)); }/* drivers/mmc/msm_sdhci.c +1
-6@@ -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[] = {drivers/mmc/rockchip_dw_mmc.c +1
-6@@ -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[] = {drivers/mmc/rockchip_sdhci.c +1
-6@@ -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[] = {drivers/mmc/sandbox_mmc.c +1
-6@@ -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)drivers/mmc/zynq_sdhci.c +1
-6@@ -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[] = {
PATCH v3 1/8 mmc: squash lines for immediate return
In reply to Masahiro YamadaQuoted 11 lines · Masahiro Yamada
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 <[email protected]>Reviewed-by Jaehoon Chung <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160923/8bdb2660/attachment-0001.sig>
PATCH v3 2/8 video: squash lines for immediate return
In reply to Masahiro YamadaFor vidconsole_post_probe(), it is common coding style to let a probe method return the value of a register function.
The others will become simple wrapper functions.
---
Changes in v3:
- Two more fixes
- s/resister/register/
drivers/video/bridge/ptn3460.c | 7 +------ drivers/video/broadwell_igd.c | 5 +---- drivers/video/exynos/exynos_dp_lowlevel.c | 6 +----- drivers/video/tegra124/display.c | 8 +------- drivers/video/vidconsole-uclass.c | 6 +----- 5 files changed, 5 insertions(+), 27 deletions(-)
drivers/video/bridge/ptn3460.c +1 -6
@@ -11,14 +11,9 @@static int ptn3460_attach (struct udevice *dev) { -int ret; -debug ("%s: %s\n" , __func__, dev->name); - ret =video_bridge_set_active (dev, true); -if (ret) -return ret; -return 0 ; +return video_bridge_set_active (dev, true); }struct video_bridge_ops ptn3460_ops = {
drivers/video/broadwell_igd.c +1 -4
@@ -323,10 +323,7 @@ err:static unsigned long gtt_read (struct broadwell_igd_priv *priv,unsigned long reg) { -u32 val; - - val =readl (priv->regs + reg); -return val; +return readl (priv->regs + reg); } static void gtt_write(struct broadwell_igd_priv *priv, unsigned long reg,
drivers/video/exynos/exynos_dp_lowlevel.c +1 -5
@@ -881,11 +881,7 @@ void exynos_dp_set_lane_count(struct exynos_dp *dp_regs, unsigned char count)unsigned int exynos_dp_get_lane_count (struct exynos_dp *dp_regs) { -unsigned int reg; - - reg =readl (&dp_regs->lane_count_set); - -return reg; +return readl (&dp_regs->lane_count_set); } unsigned char exynos_dp_get_lanex_pre_emphasis(struct exynos_dp *dp_regs,
drivers/video/tegra124/display.c +1 -7
@@ -326,13 +326,7 @@ static int display_update_config_from_edid(struct udevice *dp_dev,int *panel_bppp, struct display_timing *timing) { - int ret; - - ret =display_read_timing (dp_dev, timing); -if (ret) -return ret; - -return 0 ; + return display_read_timing(dp_dev, timing); } static int display_init(struct udevice *dev, void *lcdbase,
drivers/video/vidconsole-uclass.c +1 -5
@@ -190,7 +190,6 @@ static int vidconsole_post_probe(struct udevice *dev) {struct vidconsole_priv *priv =dev_get_uclass_priv (dev);struct stdio_dev *sdev = &priv->sdev; -int ret;if (!priv->tab_width_frac) priv->tab_width_frac =VID_TO_POS (priv->x_charsize) *8 ;
@@ -206,11 +205,8 @@ static int vidconsole_post_probe(struct udevice *dev) sdev->putc = vidconsole_putc; sdev->puts = vidconsole_puts; sdev->priv = dev; - ret =stdio_register (sdev); -if (ret) -return ret; -return 0 ; +return stdio_register (sdev); }UCLASS_DRIVER (vidconsole) = {
Signature · 1 line
1.9.1
PATCH v3 2/8 video: squash lines for immediate return
Quoted 13 lines · Masahiro Yamada
For
vidconsole_post_probe(), it is common coding style to let a probe method return the value of a register function.The others will become simple wrapper functions.
Signed-off-by Masahiro Yamada <[email protected]>---
Changes in v3:
- Two more fixes
- s/resister/register/
Quoted 6 lines
drivers/video/bridge/ptn3460.c | 7 +------ drivers/video/broadwell_igd.c | 5 +---- drivers/video/exynos/exynos_dp_lowlevel.c | 6 +----- drivers/video/tegra124/display.c | 8 +------- drivers/video/vidconsole-uclass.c | 6 +----- 5 files changed, 5 insertions(+), 27 deletions(-)
PATCH v3 2/8 video: squash lines for immediate return
In reply to Masahiro YamadaQuoted 4 lines · Masahiro Yamada
For
vidconsole_post_probe(), it is common coding style to let a probe method return the value of a register function.The others will become simple wrapper functions.
drivers/video/tegra124/display.c:
PATCH v3 2/8 video: squash lines for immediate return
In reply to Masahiro YamadaQuoted 9 lines · Masahiro Yamada
For
vidconsole_post_probe(), it is common coding style to let a probe method return the value of a register function.The others will become simple wrapper functions.
Signed-off-by Masahiro Yamada <[email protected]>Reviewed-by Simon Glass <[email protected]>Acked-by Stephen Warren <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160923/c5935594/attachment.sig>
PATCH v3 3/8 usb: replace ehci_*_remove() with usb_deregister()
In reply to Masahiro YamadaThe remove callbacks of EHCI drivers are often just a wrapper of ehci_deregister.
---
Changes in v3:
- added
drivers/usb/host/ehci-atmel.c | 13 +------------ drivers/usb/host/ehci-fsl.c | 13 +------------ drivers/usb/host/ehci-generic.c | 7 +------ drivers/usb/host/ehci-marvell.c | 13 +------------ drivers/usb/host/ehci-mx6.c | 13 +------------ drivers/usb/host/ehci-pci.c | 13 +------------ drivers/usb/host/ehci-tegra.c | 13 +------------ drivers/usb/host/ehci-zynq.c | 13 +------------ 8 files changed, 8 insertions(+), 90 deletions(-)
drivers/usb/host/ehci-atmel.c +1 -12
@@ -128,17 +128,6 @@ static int ehci_atmel_probe(struct udevice *dev)return ehci_register (dev, hccr, hcor,NULL ,0 ,USB_INIT_HOST ); } -static int ehci_atmel_remove (struct udevice *dev) -{ -int ret; - - ret =ehci_deregister (dev); -if (ret) -return ret; - -return 0 ; -} -static const struct udevice_id ehci_usb_ids[] = { { .compatible ="atmel,at91sam9g45-ehci" , }, { }
@@ -149,7 +138,7 @@ U_BOOT_DRIVER(ehci_atmel) = { .id = UCLASS_USB, .of_match = ehci_usb_ids, .probe = ehci_atmel_probe, - .remove = ehci_atmel_remove, + .remove = ehci_deregister, .ops = &ehci_usb_ops, .platdata_auto_alloc_size = sizeof(struct usb_platdata), .priv_auto_alloc_size = sizeof(struct ehci_atmel_priv),
drivers/usb/host/ehci-fsl.c +1 -12
@@ -118,17 +118,6 @@ static int ehci_fsl_probe(struct udevice *dev)return ehci_register (dev, hccr, hcor, &fsl_ehci_ops,0 ,USB_INIT_HOST ); } -static int ehci_fsl_remove (struct udevice *dev) -{ -int ret; - - ret =ehci_deregister (dev); -if (ret) -return ret; - -return 0 ; -} -static const struct udevice_id ehci_usb_ids[] = { { .compatible ="fsl-usb2-mph" , }, { .compatible ="fsl-usb2-dr" , },
@@ -141,7 +130,7 @@ U_BOOT_DRIVER(ehci_fsl) = { .of_match = ehci_usb_ids, .ofdata_to_platdata = ehci_fsl_ofdata_to_platdata, .probe = ehci_fsl_probe, - .remove = ehci_fsl_remove, + .remove = ehci_deregister, .ops = &ehci_usb_ops, .platdata_auto_alloc_size = sizeof(struct usb_platdata), .priv_auto_alloc_size = sizeof(struct ehci_fsl_priv),
drivers/usb/host/ehci-generic.c +1 -6
@@ -44,11 +44,6 @@ static int ehci_usb_probe(struct udevice *dev)return ehci_register (dev, hccr, hcor,NULL ,0 ,USB_INIT_HOST ); } -static int ehci_usb_remove (struct udevice *dev) -{ -return ehci_deregister (dev); -} -static const struct udevice_id ehci_usb_ids[] = { { .compatible ="generic-ehci" }, { }
@@ -59,7 +54,7 @@ U_BOOT_DRIVER(ehci_generic) = { .id = UCLASS_USB, .of_match = ehci_usb_ids, .probe = ehci_usb_probe, - .remove = ehci_usb_remove, + .remove = ehci_deregister, .ops = &ehci_usb_ops, .priv_auto_alloc_size = sizeof(struct generic_ehci), .flags = DM_FLAG_ALLOC_PRIV_DMA,
drivers/usb/host/ehci-marvell.c +1 -12
@@ -94,17 +94,6 @@ static int ehci_mvebu_probe(struct udevice *dev)return ehci_register (dev, hccr, hcor,NULL ,0 ,USB_INIT_HOST ); } -static int ehci_mvebu_remove (struct udevice *dev) -{ -int ret; - - ret =ehci_deregister (dev); -if (ret) -return ret; - -return 0 ; -} -static const struct udevice_id ehci_usb_ids[] = { { .compatible ="marvell,orion-ehci" , }, { }
@@ -115,7 +104,7 @@ U_BOOT_DRIVER(ehci_mvebu) = { .id = UCLASS_USB, .of_match = ehci_usb_ids, .probe = ehci_mvebu_probe, - .remove = ehci_mvebu_remove, + .remove = ehci_deregister, .ops = &ehci_usb_ops, .platdata_auto_alloc_size = sizeof(struct usb_platdata), .priv_auto_alloc_size = sizeof(struct ehci_mvebu_priv),
drivers/usb/host/ehci-mx6.c +1 -12
@@ -451,17 +451,6 @@ static int ehci_usb_probe(struct udevice *dev)return ehci_register (dev, hccr, hcor, &mx6_ehci_ops,0 , priv->init_type); } -static int ehci_usb_remove (struct udevice *dev) -{ -int ret; - - ret =ehci_deregister (dev); -if (ret) -return ret; - -return 0 ; -} -static const struct udevice_id mx6_usb_ids[] = { { .compatible ="fsl,imx27-usb" }, { }
@@ -472,7 +461,7 @@ U_BOOT_DRIVER(usb_mx6) = { .id = UCLASS_USB, .of_match = mx6_usb_ids, .probe = ehci_usb_probe, - .remove = ehci_usb_remove, + .remove = ehci_deregister, .ops = &ehci_usb_ops, .platdata_auto_alloc_size = sizeof(struct usb_platdata), .priv_auto_alloc_size = sizeof(struct ehci_mx6_priv_data),
drivers/usb/host/ehci-pci.c +1 -12
@@ -126,17 +126,6 @@ static int ehci_pci_probe(struct udevice *dev)return ehci_register (dev, hccr, hcor,NULL ,0 ,USB_INIT_HOST ); } -static int ehci_pci_remove (struct udevice *dev) -{ -int ret; - - ret =ehci_deregister (dev); -if (ret) -return ret; - -return 0 ; -} -static const struct udevice_id ehci_pci_ids[] = { { .compatible ="ehci-pci" }, { }
@@ -146,7 +135,7 @@ U_BOOT_DRIVER(ehci_pci) = { .name = "ehci_pci", .id = UCLASS_USB, .probe = ehci_pci_probe, - .remove = ehci_pci_remove, + .remove = ehci_deregister, .of_match = ehci_pci_ids, .ops = &ehci_usb_ops, .platdata_auto_alloc_size = sizeof(struct usb_platdata),
drivers/usb/host/ehci-tegra.c +1 -12
@@ -846,17 +846,6 @@ static int ehci_usb_probe(struct udevice *dev) plat->init_type); } -static int ehci_usb_remove (struct udevice *dev) -{ -int ret; - - ret =ehci_deregister (dev); -if (ret) -return ret; - -return 0 ; -} -static const struct udevice_id ehci_usb_ids[] = { { .compatible ="nvidia,tegra20-ehci" , .data =USB_CTLR_T20 }, { .compatible ="nvidia,tegra30-ehci" , .data =USB_CTLR_T30 },
@@ -871,7 +860,7 @@ U_BOOT_DRIVER(usb_ehci) = { .of_match = ehci_usb_ids, .ofdata_to_platdata = ehci_usb_ofdata_to_platdata, .probe = ehci_usb_probe, - .remove = ehci_usb_remove, + .remove = ehci_deregister, .ops = &ehci_usb_ops, .platdata_auto_alloc_size = sizeof(struct usb_platdata), .priv_auto_alloc_size = sizeof(struct fdt_usb),
drivers/usb/host/ehci-zynq.c +1 -12
@@ -73,17 +73,6 @@ static int ehci_zynq_probe(struct udevice *dev)return ehci_register (dev, hccr, hcor,NULL ,0 , plat->init_type); } -static int ehci_zynq_remove (struct udevice *dev) -{ -int ret; - - ret =ehci_deregister (dev); -if (ret) -return ret; - -return 0 ; -} -static const struct udevice_id ehci_zynq_ids[] = { { .compatible ="xlnx,zynq-usb-2.20a" }, { }
@@ -95,7 +84,7 @@ U_BOOT_DRIVER(ehci_zynq) = { .of_match = ehci_zynq_ids, .ofdata_to_platdata = ehci_zynq_ofdata_to_platdata, .probe = ehci_zynq_probe, - .remove = ehci_zynq_remove, + .remove = ehci_deregister, .ops = &ehci_usb_ops, .platdata_auto_alloc_size = sizeof(struct usb_platdata), .priv_auto_alloc_size = sizeof(struct zynq_ehci_priv),
Signature · 1 line
1.9.1
PATCH v3 3/8 usb: replace ehci_*_remove() with usb_deregister()
Quoted 2 lines · Masahiro Yamada
The remove callbacks of EHCI drivers are often just a wrapper of
ehci_deregister.
PATCH v3 3/8 usb: replace ehci_*_remove() with usb_deregister()
In reply to Masahiro YamadaQuoted 5 lines · Masahiro Yamada
The remove callbacks of EHCI drivers are often just a wrapper of
ehci_deregister.Signed-off-by Masahiro Yamada <[email protected]>Acked-by Stephen Warren <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160923/444d75b6/attachment.sig>
PATCH v3 4/8 usb: squash lines for immediate return
In reply to Masahiro YamadaThis makes functions much simpler.
---
Changes in v3: None
common/usb.c | 20 +++++++------------- common/usb_kbd.c | 5 +---- common/usb_storage.c | 9 +++------ drivers/usb/host/xhci-fsl.c | 7 +------ 4 files changed, 12 insertions(+), 29 deletions(-)
common/usb.c +7 -13
@@ -557,12 +557,10 @@ int usb_clear_halt(struct usb_device *dev, int pipe)static int usb_get_descriptor (struct usb_device *dev,unsigned char type,unsigned char index,void *buf,int size) { -int res; - res =usb_control_msg (dev,usb_rcvctrlpipe (dev,0 ), -USB_REQ_GET_DESCRIPTOR ,USB_DIR_IN , - (type <<8 ) + index,0 , - buf, size,USB_CNTL_TIMEOUT ); -return res; +return usb_control_msg (dev,usb_rcvctrlpipe (dev,0 ), +USB_REQ_GET_DESCRIPTOR ,USB_DIR_IN , + (type <<8 ) + index,0 , buf, size, +USB_CNTL_TIMEOUT ); }/**********************************************************************
@@ -612,14 +610,10 @@ int usb_get_configuration_no(struct usb_device *dev, int cfgno,*/ static int usb_set_address (struct usb_device *dev) { -int res; -debug ("set address %d\n" , dev->devnum); - res =usb_control_msg (dev,usb_snddefctrl (dev), -USB_REQ_SET_ADDRESS ,0 , - (dev->devnum),0 , -NULL ,0 ,USB_CNTL_TIMEOUT ); -return res; + +return usb_control_msg (dev,usb_snddefctrl (dev),USB_REQ_SET_ADDRESS , +0 , (dev->devnum),0 ,NULL ,0 ,USB_CNTL_TIMEOUT ); }/********************************************************************
common/usb_kbd.c +1 -4
@@ -605,11 +605,8 @@ int usb_kbd_deregister(int force)static int usb_kbd_probe (struct udevice *dev) {struct usb_device *udev =dev_get_parent_priv (dev); -int ret; - - ret =probe_usb_keyboard (udev); -return ret; +return probe_usb_keyboard (udev); }static int usb_kbd_remove (struct udevice *dev)
common/usb_storage.c +3 -6
@@ -708,13 +708,10 @@ static int usb_stor_CBI_get_status(ccb *srb, struct us_data *us)/* clear a stall on an endpoint - special for BBB devices */ static int usb_stor_BBB_clear_endpt_stall (struct us_data *us,__u8 endpt) { -int result; -/* ENDPOINT_HALT = 0, so set value to 0 */ - result =usb_control_msg (us->pusb_dev,usb_sndctrlpipe (us->pusb_dev,0 ), -USB_REQ_CLEAR_FEATURE ,USB_RECIP_ENDPOINT , -0 , endpt,NULL ,0 ,USB_CNTL_TIMEOUT *5 ); -return result; +return usb_control_msg (us->pusb_dev,usb_sndctrlpipe (us->pusb_dev,0 ), +USB_REQ_CLEAR_FEATURE ,USB_RECIP_ENDPOINT ,0 , + endpt,NULL ,0 ,USB_CNTL_TIMEOUT *5 ); }static int usb_stor_BBB_transport (ccb *srb,struct us_data *us)
drivers/usb/host/xhci-fsl.c +1 -6
@@ -129,15 +129,10 @@ static int xhci_fsl_probe(struct udevice *dev)static int xhci_fsl_remove (struct udevice *dev) {struct xhci_fsl_priv *priv =dev_get_priv (dev); -int ret;fsl_xhci_core_exit (&priv->ctx); - ret =xhci_deregister (dev); -if (ret) -return ret; - -return 0 ; +return xhci_deregister (dev); }static const struct udevice_id xhci_usb_ids[] = {
Signature · 1 line
1.9.1
PATCH v3 4/8 usb: squash lines for immediate return
Quoted 3 lines · Masahiro Yamada
This makes functions much simpler.
Signed-off-by Masahiro Yamada <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160923/6cc3f712/attachment.sig>
PATCH v3 5/8 x86: squash lines for immediate return
In reply to Masahiro Yamadaarch_cpu_init() can be simpler by this refactoring.
---
Changes in v3: None
arch/x86/cpu/baytrail/valleyview.c | 8 +------- arch/x86/cpu/ivybridge/ivybridge.c | 8 +------- arch/x86/cpu/qemu/qemu.c | 8 +------- arch/x86/cpu/queensbay/tnc.c | 8 +------- 4 files changed, 4 insertions(+), 28 deletions(-)
arch/x86/cpu/baytrail/valleyview.c +1 -7
@@ -25,15 +25,9 @@ int cpu_mmc_init(bd_t *bis)#ifndef CONFIG_EFI_APP int arch_cpu_init (void ) { -int ret; -post_code (POST_CPU_INIT ); - ret =x86_cpu_init_f (); -if (ret) -return ret; - -return 0 ; +return x86_cpu_init_f (); }int arch_misc_init (void )
arch/x86/cpu/ivybridge/ivybridge.c +1 -7
@@ -10,13 +10,7 @@int arch_cpu_init (void ) { -int ret; -post_code (POST_CPU_INIT ); - ret =x86_cpu_init_f (); -if (ret) -return ret; - -return 0 ; +return x86_cpu_init_f (); }
arch/x86/cpu/qemu/qemu.c +1 -7
@@ -139,15 +139,9 @@ static void qemu_chipset_init(void)int arch_cpu_init (void ) { -int ret; -post_code (POST_CPU_INIT ); - ret =x86_cpu_init_f (); -if (ret) -return ret; - -return 0 ; +return x86_cpu_init_f (); }#ifndef CONFIG_EFI_STUB
arch/x86/cpu/queensbay/tnc.c +1 -7
@@ -94,15 +94,9 @@ static int __maybe_unused disable_igd(void)int arch_cpu_init (void ) { -int ret; -post_code (POST_CPU_INIT ); - ret =x86_cpu_init_f (); -if (ret) -return ret; - -return 0 ; +return x86_cpu_init_f (); }int arch_early_init_r (void )
Signature · 1 line
1.9.1
PATCH v3 5/8 x86: squash lines for immediate return
Quoted 5 lines · Masahiro Yamada
arch_cpu_init()can be simpler by this refactoring.Signed-off-by Masahiro Yamada <[email protected]>Reviewed-by Bin Meng <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160923/17b30c54/attachment.sig>
PATCH v3 6/8 libfdt: simplify fdt_del_mem_rsv()
In reply to Masahiro YamadaThe variable "err" is unneeded.
[ Device Tree Compiler commit: 36fd7331fb11276c09a6affc0d8cd4977f2fe100 ]
---
Changes in v3: None
lib/libfdt/fdt_rw.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
lib/libfdt/fdt_rw.c +1 -5
@@ -148,17 +148,13 @@ int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size)int fdt_del_mem_rsv (void *fdt,int n) {struct fdt_reserve_entry *re =_fdt_mem_rsv_w (fdt, n); -int err;FDT_RW_CHECK_HEADER (fdt);if (n >=fdt_num_mem_rsv (fdt))return -FDT_ERR_NOTFOUND ; - err =_fdt_splice_mem_rsv (fdt, re,1 ,0 ); -if (err) -return err; -return 0 ; +return _fdt_splice_mem_rsv (fdt, re,1 ,0 ); } static int _fdt_resize_property(void *fdt, int nodeoffset, const char *name,
Signature · 1 line
1.9.1
PATCH v3 6/8 libfdt: simplify fdt_del_mem_rsv()
Quoted 4 lines · Masahiro Yamada
The variable "err" is unneeded.
[ Device Tree Compiler commit:
36fd7331fb11276c09a6affc0d8cd4977f2fe100]
Quoted 8 lines
Signed-off-by Masahiro Yamada <[email protected]>Signed-off-by David Gibson <[email protected]>---
Changes in v3: None
lib/libfdt/fdt_rw.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
PATCH v3 6/8 libfdt: simplify fdt_del_mem_rsv()
In reply to Masahiro YamadaQuoted 7 lines · Masahiro Yamada
The variable "err" is unneeded.
[ Device Tree Compiler commit:
36fd7331fb11276c09a6affc0d8cd4977f2fe100]Signed-off-by Masahiro Yamada <[email protected]>Signed-off-by David Gibson <[email protected]>Acked-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160923/ef22935b/attachment.sig>
PATCH v3 7/8 arch, board: squash lines for immediate return
In reply to Masahiro YamadaRemove unneeded variables and assignments.
---
Changes in v3:
- More fixes
arch/arm/cpu/arm920t/imx/timer.c | 6 +----- arch/arm/cpu/armv7/am33xx/sys_info.c | 4 +--- arch/arm/cpu/sa1100/timer.c | 5 +---- arch/arm/mach-zynq/cpu.c | 8 ++------ arch/blackfin/cpu/interrupts.c | 5 +---- arch/m68k/lib/time.c | 4 +--- arch/powerpc/cpu/mpc512x/cpu.c | 6 +----- arch/powerpc/cpu/mpc83xx/cpu.c | 6 +----- arch/xtensa/lib/time.c | 5 +---- board/amcc/bamboo/bamboo.c | 6 +----- board/amcc/bubinga/bubinga.c | 5 +---- board/amcc/canyonlands/canyonlands.c | 6 +----- board/corscience/tricorder/tricorder-eeprom.c | 20 +++++--------------- board/freescale/common/zm7300.c | 4 +--- board/samsung/goni/goni.c | 8 +------- board/ti/omap5_uevm/evm.c | 5 +---- 16 files changed, 21 insertions(+), 82 deletions(-)
arch/arm/cpu/arm920t/imx/timer.c +1 -5
@@ -78,11 +78,7 @@ unsigned long long get_ticks(void)*/ ulong get_tbclk (void ) { -ulong tbclk; - - tbclk =CONFIG_SYS_HZ ; - -return tbclk; +return CONFIG_SYS_HZ ; }/*
arch/arm/cpu/armv7/am33xx/sys_info.c +1 -3
@@ -65,9 +65,7 @@ u32 get_device_type(void)*/ u32 get_sysboot_value (void ) { -int mode; - mode =readl (&cstat->statusreg) & (SYSBOOT_MASK ); -return mode; +return readl (&cstat->statusreg) &SYSBOOT_MASK ; }#ifdef CONFIG_DISPLAY_CPUINFO
arch/arm/cpu/sa1100/timer.c +1 -4
@@ -66,8 +66,5 @@ unsigned long long get_ticks(void)*/ ulong get_tbclk (void ) { -ulong tbclk; - - tbclk =CONFIG_SYS_HZ ; -return tbclk; +return CONFIG_SYS_HZ ; }
arch/arm/mach-zynq/cpu.c +2 -6
@@ -43,12 +43,8 @@ int arch_cpu_init(void)unsigned int zynq_get_silicon_version (void ) { -unsigned int ver; - - ver = (readl (&devcfg_base->mctrl) & -ZYNQ_SILICON_VER_MASK ) >>ZYNQ_SILICON_VER_SHIFT ; - -return ver; +return (readl (&devcfg_base->mctrl) &ZYNQ_SILICON_VER_MASK ) + >>ZYNQ_SILICON_VER_SHIFT ; }void reset_cpu (ulong addr)
arch/blackfin/cpu/interrupts.c +1 -4
@@ -47,10 +47,7 @@ unsigned long long get_ticks(void)*/ ulong get_tbclk (void ) { -ulong tbclk; - - tbclk =CONFIG_SYS_HZ ; -return tbclk; +return CONFIG_SYS_HZ ; }void enable_interrupts (void )
arch/m68k/lib/time.c +1 -3
@@ -192,7 +192,5 @@ unsigned long usec2ticks(unsigned long usec)*/ ulong get_tbclk (void ) { -ulong tbclk; - tbclk =CONFIG_SYS_HZ ; -return tbclk; +return CONFIG_SYS_HZ ; }
arch/powerpc/cpu/mpc512x/cpu.c +1 -5
@@ -95,11 +95,7 @@ do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])*/ unsigned long get_tbclk (void ) { -ulong tbclk; - - tbclk = (gd->bus_clk +3L ) /4L ; - -return tbclk; +return (gd->bus_clk +3L ) /4L ; }
arch/powerpc/cpu/mpc83xx/cpu.c +1 -5
@@ -173,11 +173,7 @@ do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])unsigned long get_tbclk (void ) { -ulong tbclk; - - tbclk = (gd->bus_clk +3L ) /4L ; - -return tbclk; +return (gd->bus_clk +3L ) /4L ; }
arch/xtensa/lib/time.c +1 -4
@@ -104,10 +104,7 @@ unsigned long long get_ticks(void)*/ ulong get_tbclk (void ) { -ulong tbclk; - - tbclk =CONFIG_SYS_HZ ; -return tbclk; +return CONFIG_SYS_HZ ; }#if XCHAL_HAVE_CCOUNT
board/amcc/bamboo/bamboo.c +1 -5
@@ -438,11 +438,7 @@ int checkboard(void)phys_size_t initdram (int board_type) { -long dram_size; - - dram_size =spd_sdram (); - -return dram_size; +return spd_sdram (); }/*----------------------------------------------------------------------------+
board/amcc/bubinga/bubinga.c +1 -4
@@ -57,8 +57,5 @@ int checkboard(void)------------------------------------------------------------------------- */ phys_size_t initdram (int board_type) { -long int ret; - - ret =spd_sdram (); -return ret; +return spd_sdram (); }
board/amcc/canyonlands/canyonlands.c +1 -5
@@ -63,11 +63,7 @@ u32 ddr_clktr(u32 default_val) {*/ static inline int board_fpga_read (int offset) { -int data; - - data =in_8 ((void *)(CONFIG_SYS_FPGA_BASE + offset)); - -return data; +return in_8 ((void *)(CONFIG_SYS_FPGA_BASE + offset)); }static inline void board_fpga_write (int offset,int data)
board/corscience/tricorder/tricorder-eeprom.c +5 -15
@@ -190,13 +190,8 @@ int do_tricorder_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])if (argc ==3 ) {ulong dev_addr =simple_strtoul (argv[2 ],NULL ,16 ); -if (strcmp (argv[1 ],"read" ) ==0 ) { -int rcode; - - rcode =tricorder_eeprom_read (dev_addr); - -return rcode; - } +if (strcmp (argv[1 ],"read" ) ==0 ) +return tricorder_eeprom_read (dev_addr); }else if (argc ==6 || argc ==7 ) {ulong dev_addr =simple_strtoul (argv[2 ],NULL ,16 );char *name = argv[3 ];
@@ -207,14 +202,9 @@ int do_tricorder_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])if (argc ==7 ) interface = argv[6 ]; -if (strcmp (argv[1 ],"write" ) ==0 ) { -int rcode; - - rcode =tricorder_eeprom_write (dev_addr, name, version, - serial, interface); - -return rcode; - } +if (strcmp (argv[1 ],"write" ) ==0 ) +return tricorder_eeprom_write (dev_addr, name, version, + serial, interface); }return CMD_RET_USAGE ;
board/freescale/common/zm7300.c +1 -3
@@ -140,9 +140,7 @@ int dpm_wrp(u8 r, u8 d)/* Uses the DPM command RRP */ u8 zm_read (uchar reg) { -u8 d; - d =dpm_rrp (reg); -return d; +return dpm_rrp (reg); }/* ZM_write --
board/samsung/goni/goni.c +1 -7
@@ -45,17 +45,11 @@ void i2c_init_board(void)int power_init_board (void ) { -int ret; -/* * For PMIC the I2C bus is named as I2C5, but it is connected * to logical I2C adapter 0 */ - ret =pmic_init (I2C_0 ); -if (ret) -return ret; - -return 0 ; +return pmic_init (I2C_0 ); }int dram_init (void )
board/ti/omap5_uevm/evm.c +1 -4
@@ -245,10 +245,7 @@ int ehci_hcd_init(int index, enum usb_init_type init,int ehci_hcd_stop (void ) { -int ret; - - ret =omap_ehci_hcd_stop (); -return ret; +return omap_ehci_hcd_stop (); }void usb_hub_reset_devices (int port)
Signature · 1 line
1.9.1
PATCH v3 7/8 arch, board: squash lines for immediate return
On 6 September 2016 at 22:17, Masahiro Yamada <[email protected]
Quoted 42 lines
wrote:
Remove unneeded variables and assignments.
Signed-off-by Masahiro Yamada <[email protected]>---
Changes in v3:
- More fixesarch/arm/cpu/arm920t/imx/timer.c | 6 +----- arch/arm/cpu/armv7/am33xx/sys_info.c | 4 +--- arch/arm/cpu/sa1100/timer.c | 5 +---- arch/arm/mach-zynq/cpu.c | 8 ++------ arch/blackfin/cpu/interrupts.c | 5 +---- arch/m68k/lib/time.c | 4 +--- arch/powerpc/cpu/mpc512x/cpu.c | 6 +----- arch/powerpc/cpu/mpc83xx/cpu.c | 6 +----- arch/xtensa/lib/time.c | 5 +---- board/amcc/bamboo/bamboo.c | 6 +----- board/amcc/bubinga/bubinga.c | 5 +---- board/amcc/canyonlands/canyonlands.c | 6 +----- board/corscience/tricorder/tricorder-eeprom.c | 20 +++++--------------- board/freescale/common/zm7300.c | 4 +--- board/samsung/goni/goni.c | 8 +------- board/ti/omap5_uevm/evm.c | 5 +---- 16 files changed, 21 insertions(+), 82 deletions(-)board/samsung/goni/goni.c +0
-2@@ -45,17 +45,11 @@ void i2c_init_board(void)int power_init_board (void ) { -int ret; -/* * For PMIC the I2C bus is named as I2C5, but it is connected * to logical I2C adapter 0
board/samsung/goni/goni.c void i2c_init_board(void) · line 55
Quoted 10 lines
board/samsung/goni/goni.c +1
-5*/ - ret =pmic_init (I2C_0 ); -if (ret) -return ret; - -return 0 ; +return pmic_init (I2C_0 ); }int dram_init (void )
Thanks,
Minkyu Kang.
Signature · 1 line
from. prom.
PATCH v3 7/8 arch, board: squash lines for immediate return
In reply to Masahiro YamadaQuoted 301 lines · Masahiro Yamada
Remove unneeded variables and assignments.
Signed-off-by Masahiro Yamada <[email protected]>---
Changes in v3:
- More fixesarch/arm/cpu/arm920t/imx/timer.c | 6 +----- arch/arm/cpu/armv7/am33xx/sys_info.c | 4 +--- arch/arm/cpu/sa1100/timer.c | 5 +---- arch/arm/mach-zynq/cpu.c | 8 ++------ arch/blackfin/cpu/interrupts.c | 5 +---- arch/m68k/lib/time.c | 4 +--- arch/powerpc/cpu/mpc512x/cpu.c | 6 +----- arch/powerpc/cpu/mpc83xx/cpu.c | 6 +----- arch/xtensa/lib/time.c | 5 +---- board/amcc/bamboo/bamboo.c | 6 +----- board/amcc/bubinga/bubinga.c | 5 +---- board/amcc/canyonlands/canyonlands.c | 6 +----- board/corscience/tricorder/tricorder-eeprom.c | 20 +++++--------------- board/freescale/common/zm7300.c | 4 +--- board/samsung/goni/goni.c | 8 +------- board/ti/omap5_uevm/evm.c | 5 +---- 16 files changed, 21 insertions(+), 82 deletions(-)arch/arm/cpu/arm920t/imx/timer.c +1
-5@@ -78,11 +78,7 @@ unsigned long long get_ticks(void)*/ ulong get_tbclk (void ) { -ulong tbclk; - - tbclk =CONFIG_SYS_HZ ; - -return tbclk; +return CONFIG_SYS_HZ ; }/* arch/arm/cpu/armv7/am33xx/sys_info.c +1
-3@@ -65,9 +65,7 @@ u32 get_device_type(void)*/ u32 get_sysboot_value (void ) { -int mode; - mode =readl (&cstat->statusreg) & (SYSBOOT_MASK ); -return mode; +return readl (&cstat->statusreg) &SYSBOOT_MASK ; }#ifdef CONFIG_DISPLAY_CPUINFO arch/arm/cpu/sa1100/timer.c +1
-4@@ -66,8 +66,5 @@ unsigned long long get_ticks(void)*/ ulong get_tbclk (void ) { -ulong tbclk; - - tbclk =CONFIG_SYS_HZ ; -return tbclk; +return CONFIG_SYS_HZ ; }arch/arm/mach-zynq/cpu.c +2
-6@@ -43,12 +43,8 @@ int arch_cpu_init(void)unsigned int zynq_get_silicon_version (void ) { -unsigned int ver; - - ver = (readl (&devcfg_base->mctrl) & -ZYNQ_SILICON_VER_MASK ) >>ZYNQ_SILICON_VER_SHIFT ; - -return ver; +return (readl (&devcfg_base->mctrl) &ZYNQ_SILICON_VER_MASK ) + >>ZYNQ_SILICON_VER_SHIFT ; }void reset_cpu (ulong addr)arch/blackfin/cpu/interrupts.c +1
-4@@ -47,10 +47,7 @@ unsigned long long get_ticks(void)*/ ulong get_tbclk (void ) { -ulong tbclk; - - tbclk =CONFIG_SYS_HZ ; -return tbclk; +return CONFIG_SYS_HZ ; }void enable_interrupts (void )arch/m68k/lib/time.c +1
-3@@ -192,7 +192,5 @@ unsigned long usec2ticks(unsigned long usec)*/ ulong get_tbclk (void ) { -ulong tbclk; - tbclk =CONFIG_SYS_HZ ; -return tbclk; +return CONFIG_SYS_HZ ; }arch/powerpc/cpu/mpc512x/cpu.c +1
-5@@ -95,11 +95,7 @@ do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])*/ unsigned long get_tbclk (void ) { -ulong tbclk; - - tbclk = (gd->bus_clk +3L ) /4L ; - -return tbclk; +return (gd->bus_clk +3L ) /4L ; }arch/powerpc/cpu/mpc83xx/cpu.c +1
-5@@ -173,11 +173,7 @@ do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])unsigned long get_tbclk (void ) { -ulong tbclk; - - tbclk = (gd->bus_clk +3L ) /4L ; - -return tbclk; +return (gd->bus_clk +3L ) /4L ; }arch/xtensa/lib/time.c +1
-4@@ -104,10 +104,7 @@ unsigned long long get_ticks(void)*/ ulong get_tbclk (void ) { -ulong tbclk; - - tbclk =CONFIG_SYS_HZ ; -return tbclk; +return CONFIG_SYS_HZ ; }#if XCHAL_HAVE_CCOUNT board/amcc/bamboo/bamboo.c +1
-5@@ -438,11 +438,7 @@ int checkboard(void)phys_size_t initdram (int board_type) { -long dram_size; - - dram_size =spd_sdram (); - -return dram_size; +return spd_sdram (); }/*----------------------------------------------------------------------------+ board/amcc/bubinga/bubinga.c +1
-4@@ -57,8 +57,5 @@ int checkboard(void)------------------------------------------------------------------------- */ phys_size_t initdram (int board_type) { -long int ret; - - ret =spd_sdram (); -return ret; +return spd_sdram (); }board/amcc/canyonlands/canyonlands.c +1
-5@@ -63,11 +63,7 @@ u32 ddr_clktr(u32 default_val) {*/ static inline int board_fpga_read (int offset) { -int data; - - data =in_8 ((void *)(CONFIG_SYS_FPGA_BASE + offset)); - -return data; +return in_8 ((void *)(CONFIG_SYS_FPGA_BASE + offset)); }static inline void board_fpga_write (int offset,int data)board/corscience/tricorder/tricorder-eeprom.c +5
-15@@ -190,13 +190,8 @@ int do_tricorder_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])if (argc ==3 ) {ulong dev_addr =simple_strtoul (argv[2 ],NULL ,16 ); -if (strcmp (argv[1 ],"read" ) ==0 ) { -int rcode; - - rcode =tricorder_eeprom_read (dev_addr); - -return rcode; - } +if (strcmp (argv[1 ],"read" ) ==0 ) +return tricorder_eeprom_read (dev_addr); }else if (argc ==6 || argc ==7 ) {ulong dev_addr =simple_strtoul (argv[2 ],NULL ,16 );char *name = argv[3 ];@@ -207,14 +202,9 @@ int do_tricorder_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])if (argc ==7 ) interface = argv[6 ]; -if (strcmp (argv[1 ],"write" ) ==0 ) { -int rcode; - - rcode =tricorder_eeprom_write (dev_addr, name, version, - serial, interface); - -return rcode; - } +if (strcmp (argv[1 ],"write" ) ==0 ) +return tricorder_eeprom_write (dev_addr, name, version, + serial, interface); }return CMD_RET_USAGE ;board/freescale/common/zm7300.c +1
-3@@ -140,9 +140,7 @@ int dpm_wrp(u8 r, u8 d)/* Uses the DPM command RRP */ u8 zm_read (uchar reg) { -u8 d; - d =dpm_rrp (reg); -return d; +return dpm_rrp (reg); }/* ZM_write -- board/samsung/goni/goni.c +1
-7@@ -45,17 +45,11 @@ void i2c_init_board(void)int power_init_board (void ) { -int ret; -/* * For PMIC the I2C bus is named as I2C5, but it is connected * to logical I2C adapter 0 */ - ret =pmic_init (I2C_0 ); -if (ret) -return ret; - -return 0 ; +return pmic_init (I2C_0 ); }int dram_init (void )board/ti/omap5_uevm/evm.c +0
-0@@ -245,10 +245,7 @@ int ehci_hcd_init(int index, enum usb_init_type init,
board/ti/omap5_uevm/evm.c int ehci_hcd_init(int index, enum usb_init_type init, · line 251
Quoted 10 lines
board/ti/omap5_uevm/evm.c +1
-4int ehci_hcd_stop (void ) { -int ret; - - ret =omap_ehci_hcd_stop (); -return ret; +return omap_ehci_hcd_stop (); }void usb_hub_reset_devices (int port)
Many thanks,
Angelo Dureghello
PATCH v3 7/8 arch, board: squash lines for immediate return
In reply to Masahiro YamadaQuoted 5 lines · Masahiro Yamada
Remove unneeded variables and assignments.
Signed-off-by Masahiro Yamada <[email protected]>Reviewed-by Minkyu Kang <[email protected]>Reviewed-by Angelo Dureghello <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160923/b0cf456c/attachment.sig>
PATCH v3 8/8 drivers: squash lines for immediate return
In reply to Masahiro YamadaRemove unneeded variables and assignments.
---
Changes in v3:
- more changes
drivers/block/sym53c8xx.c | 5 ++--- drivers/ddr/fsl/ddr1_dimm_params.c | 12 ++---------- drivers/ddr/fsl/ddr2_dimm_params.c | 12 ++---------- drivers/ddr/marvell/a38x/ddr3_a38x.c | 6 +----- drivers/power/axp809.c | 8 +------- drivers/rtc/m48t35ax.c | 4 +--- 6 files changed, 9 insertions(+), 38 deletions(-)
drivers/block/sym53c8xx.c +2 -3
@@ -284,9 +284,8 @@ void scsi_low_level_init(int busdevfunc)*/ unsigned long swap_script (unsigned long val) { -unsigned long tmp; - tmp = ((val>>24 )&0xff ) | ((val>>8 )&0xff00 ) | ((val<<8 )&0xff0000 ) | ((val<<24 )&0xff000000 ); -return tmp; +return ((val >>24 ) &0xff ) | ((val >>8 ) &0xff00 ) | + ((val <<8 ) &0xff0000 ) | ((val <<24 ) &0xff000000 ); }
drivers/ddr/fsl/ddr1_dimm_params.c +2 -10
@@ -108,22 +108,14 @@ static unsigned int byte40_table_ps[8] = {static unsigned int compute_trfc_ps_from_spd (unsigned char trctrfc_ext,unsigned char trfc) { -unsigned int trfc_ps; - - trfc_ps = (((trctrfc_ext &0x1 ) *256 ) + trfc) *1000 +return ((trctrfc_ext &0x1 ) *256 + trfc) *1000 + byte40_table_ps[(trctrfc_ext >>1 ) &0x7 ]; - -return trfc_ps; }static unsigned int compute_trc_ps_from_spd (unsigned char trctrfc_ext,unsigned char trc) { -unsigned int trc_ps; - - trc_ps = trc *1000 + byte40_table_ps[(trctrfc_ext >>4 ) &0x7 ]; - -return trc_ps; +return trc *1000 + byte40_table_ps[(trctrfc_ext >>4 ) &0x7 ]; }/*
drivers/ddr/fsl/ddr2_dimm_params.c +2 -10
@@ -107,22 +107,14 @@ static unsigned int byte40_table_ps[8] = {static unsigned int compute_trfc_ps_from_spd (unsigned char trctrfc_ext,unsigned char trfc) { -unsigned int trfc_ps; - - trfc_ps = (((trctrfc_ext &0x1 ) *256 ) + trfc) *1000 +return (((trctrfc_ext &0x1 ) *256 ) + trfc) *1000 + byte40_table_ps[(trctrfc_ext >>1 ) &0x7 ]; - -return trfc_ps; }static unsigned int compute_trc_ps_from_spd (unsigned char trctrfc_ext,unsigned char trc) { -unsigned int trc_ps; - - trc_ps = trc *1000 + byte40_table_ps[(trctrfc_ext >>4 ) &0x7 ]; - -return trc_ps; +return trc *1000 + byte40_table_ps[(trctrfc_ext >>4 ) &0x7 ]; }/*
drivers/ddr/marvell/a38x/ddr3_a38x.c +1 -5
@@ -706,11 +706,7 @@ int ddr3_tip_ext_write(u32 dev_num, u32 if_id, u32 reg_addr,int ddr3_silicon_pre_init (void ) { -int result; - - result =ddr3_silicon_init (); - -return result; +return ddr3_silicon_init (); }int ddr3_post_run_alg (void )
drivers/power/axp809.c +1 -7
@@ -217,13 +217,7 @@ int axp_set_sw(bool on)int axp_init (void ) { -int ret; - - ret =pmic_bus_init (); -if (ret) -return ret; - -return 0 ; +return pmic_bus_init (); }int do_poweroff (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[])
drivers/rtc/m48t35ax.c +1 -3
@@ -127,10 +127,8 @@ void rtc_reset (void)static uchar rtc_read (uchar reg) { -uchar val; - val = *(unsigned char *) +return *(unsigned char *) ((CONFIG_SYS_NVRAM_BASE_ADDR +CONFIG_SYS_NVRAM_SIZE -8 ) + reg); -return val; }static void rtc_write (uchar reg,uchar val)
Signature · 1 line
1.9.1
PATCH v3 8/8 drivers: squash lines for immediate return
Quoted 3 lines · Masahiro Yamada
Remove unneeded variables and assignments.
Signed-off-by Masahiro Yamada <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160923/9b3db6ed/attachment.sig>