Skip to content

Commit

Permalink
treewide: replace with error() with pr_err()
Browse files Browse the repository at this point in the history
U-Boot widely uses error() as a bit noisier variant of printf().

This macro causes name conflict with the following line in
include/linux/compiler-gcc.h:

  # define __compiletime_error(message) __attribute__((error(message)))

This prevents us from using __compiletime_error(), and makes it
difficult to fully sync BUILD_BUG macros with Linux.  (Notice
Linux's BUILD_BUG_ON_MSG is implemented by using compiletime_assert().)

Let's convert error() into now treewide-available pr_err().

Done with the help of Coccinelle, excluing tools/ directory.

The semantic patch I used is as follows:

// <smpl>
@@@@
-error
+pr_err
 (...)
// </smpl>

Signed-off-by: Masahiro Yamada <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
[trini: Re-run Coccinelle]
Signed-off-by: Tom Rini <[email protected]>
  • Loading branch information
masahir0y authored and trini committed Oct 4, 2017
1 parent b44b302 commit 9b643e3
Show file tree
Hide file tree
Showing 128 changed files with 560 additions and 560 deletions.
2 changes: 1 addition & 1 deletion arch/arm/mach-omap2/am33xx/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ int arch_misc_init(void)
#if defined(CONFIG_DM_ETH) && defined(CONFIG_USB_ETHER)
ret = usb_ether_init();
if (ret) {
error("USB ether init failed\n");
pr_err("USB ether init failed\n");
return ret;
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-omap2/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ static u32 omap_mmc_get_part_size(const char *part)

dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) {
error("invalid mmc device\n");
pr_err("invalid mmc device\n");
return 0;
}

res = part_get_info_by_name(dev_desc, part, &info);
if (res < 0) {
error("cannot find partition: '%s'\n", part);
pr_err("cannot find partition: '%s'\n", part);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-rockchip/rk3188-board-spl.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void board_init_f(ulong dummy)
*/
pmu = syscon_get_first_range(ROCKCHIP_SYSCON_PMU);
if (IS_ERR(pmu))
error("pmu syscon returned %ld\n", PTR_ERR(pmu));
pr_err("pmu syscon returned %ld\n", PTR_ERR(pmu));
SAVE_SP_ADDR = readl(&pmu->sys_reg[2]);

ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-rockchip/rk3188-board.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int board_late_init(void)

grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
if (IS_ERR(grf)) {
error("grf syscon returned %ld\n", PTR_ERR(grf));
pr_err("grf syscon returned %ld\n", PTR_ERR(grf));
} else {
/* enable noc remap to mimic legacy loaders */
rk_clrsetreg(&grf->soc_con0,
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-rockchip/rk3368-board-spl.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ void board_init_f(ulong dummy)
/* Set up our preloader console */
ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
if (ret) {
error("%s: pinctrl init failed: %d\n", __func__, ret);
pr_err("%s: pinctrl init failed: %d\n", __func__, ret);
hang();
}

ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART0);
if (ret) {
error("%s: failed to set up console UART\n", __func__);
pr_err("%s: failed to set up console UART\n", __func__);
hang();
}

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-socfpga/reset_manager_arria10.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ void socfpga_emac_manage_reset(ulong emacbase, u32 state)
emacmask = ALT_RSTMGR_PER0MODRST_EMAC2_SET_MSK;
break;
default:
error("emac base address unexpected! %lx", emacbase);
pr_err("emac base address unexpected! %lx", emacbase);
hang();
break;
}
Expand Down
8 changes: 4 additions & 4 deletions arch/arm/mach-tegra/ivc.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ static int check_ivc_params(ulong qbase1, ulong qbase2, uint32_t nframes,
(TEGRA_IVC_ALIGN - 1));

if ((uint64_t)nframes * (uint64_t)frame_size >= 0x100000000) {
error("tegra_ivc: nframes * frame_size overflows\n");
pr_err("tegra_ivc: nframes * frame_size overflows\n");
return -EINVAL;
}

Expand All @@ -503,12 +503,12 @@ static int check_ivc_params(ulong qbase1, ulong qbase2, uint32_t nframes,
*/
if ((qbase1 & (TEGRA_IVC_ALIGN - 1)) ||
(qbase2 & (TEGRA_IVC_ALIGN - 1))) {
error("tegra_ivc: channel start not aligned\n");
pr_err("tegra_ivc: channel start not aligned\n");
return -EINVAL;
}

if (frame_size & (TEGRA_IVC_ALIGN - 1)) {
error("tegra_ivc: frame size not adequately aligned\n");
pr_err("tegra_ivc: frame size not adequately aligned\n");
return -EINVAL;
}

Expand All @@ -521,7 +521,7 @@ static int check_ivc_params(ulong qbase1, ulong qbase2, uint32_t nframes,
}

if (ret) {
error("tegra_ivc: queue regions overlap\n");
pr_err("tegra_ivc: queue regions overlap\n");
return ret;
}

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-tegra/tegra124/xusb-padctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ static int tegra_xusb_padctl_disable(struct tegra_xusb_padctl *padctl)
u32 value;

if (padctl->enable == 0) {
error("unbalanced enable/disable");
pr_err("unbalanced enable/disable");
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-tegra/tegra186/nvtboot_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ int dram_init(void)

node = fdt_path_offset(nvtboot_blob, "/memory");
if (node < 0) {
error("Can't find /memory node in nvtboot DTB");
pr_err("Can't find /memory node in nvtboot DTB");
hang();
}
prop = fdt_getprop(nvtboot_blob, node, "reg", &len);
if (!prop) {
error("Can't find /memory/reg property in nvtboot DTB");
pr_err("Can't find /memory/reg property in nvtboot DTB");
hang();
}

Expand Down
6 changes: 3 additions & 3 deletions arch/arm/mach-tegra/tegra20/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ static int tegra_plle_train(void)
} while (--timeout);

if (timeout == 0) {
error("timeout waiting for PLLE to become ready");
pr_err("timeout waiting for PLLE to become ready");
return -ETIMEDOUT;
}

Expand Down Expand Up @@ -697,7 +697,7 @@ int tegra_plle_enable(void)
if ((value & PLLE_MISC_PLL_READY) == 0) {
err = tegra_plle_train();
if (err < 0) {
error("failed to train PLLE: %d", err);
pr_err("failed to train PLLE: %d", err);
return err;
}
}
Expand Down Expand Up @@ -726,7 +726,7 @@ int tegra_plle_enable(void)
} while (--timeout);

if (timeout == 0) {
error("timeout waiting for PLLE to lock");
pr_err("timeout waiting for PLLE to lock");
return -ETIMEDOUT;
}

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-tegra/tegra210/xusb-padctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static int tegra_xusb_padctl_disable(struct tegra_xusb_padctl *padctl)
u32 value;

if (padctl->enable == 0) {
error("unbalanced enable/disable");
pr_err("unbalanced enable/disable");
return 0;
}

Expand Down
6 changes: 3 additions & 3 deletions arch/arm/mach-tegra/tegra30/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ static int tegra_plle_train(void)
} while (--timeout);

if (timeout == 0) {
error("timeout waiting for PLLE to become ready");
pr_err("timeout waiting for PLLE to become ready");
return -ETIMEDOUT;
}

Expand Down Expand Up @@ -726,7 +726,7 @@ int tegra_plle_enable(void)
if ((value & PLLE_MISC_PLL_READY) == 0) {
err = tegra_plle_train();
if (err < 0) {
error("failed to train PLLE: %d", err);
pr_err("failed to train PLLE: %d", err);
return err;
}
}
Expand Down Expand Up @@ -772,7 +772,7 @@ int tegra_plle_enable(void)
} while (--timeout);

if (timeout == 0) {
error("timeout waiting for PLLE to lock");
pr_err("timeout waiting for PLLE to lock");
return -ETIMEDOUT;
}

Expand Down
22 changes: 11 additions & 11 deletions arch/arm/mach-tegra/xusb-padctl-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ tegra_xusb_padctl_group_parse_dt(struct tegra_xusb_padctl *padctl,

len = ofnode_read_string_count(node, "nvidia,lanes");
if (len < 0) {
error("failed to parse \"nvidia,lanes\" property");
pr_err("failed to parse \"nvidia,lanes\" property");
return -EINVAL;
}

Expand All @@ -94,7 +94,7 @@ tegra_xusb_padctl_group_parse_dt(struct tegra_xusb_padctl *padctl,
ret = ofnode_read_string_index(node, "nvidia,lanes", i,
&group->pins[i]);
if (ret) {
error("failed to read string from \"nvidia,lanes\" property");
pr_err("failed to read string from \"nvidia,lanes\" property");
return -EINVAL;
}
}
Expand All @@ -104,7 +104,7 @@ tegra_xusb_padctl_group_parse_dt(struct tegra_xusb_padctl *padctl,
ret = ofnode_read_string_index(node, "nvidia,function", 0,
&group->func);
if (ret) {
error("failed to parse \"nvidia,func\" property");
pr_err("failed to parse \"nvidia,func\" property");
return -EINVAL;
}

Expand Down Expand Up @@ -157,14 +157,14 @@ tegra_xusb_padctl_group_apply(struct tegra_xusb_padctl *padctl,

lane = tegra_xusb_padctl_find_lane(padctl, group->pins[i]);
if (!lane) {
error("no lane for pin %s", group->pins[i]);
pr_err("no lane for pin %s", group->pins[i]);
continue;
}

func = tegra_xusb_padctl_lane_find_function(padctl, lane,
group->func);
if (func < 0) {
error("function %s invalid for lane %s: %d",
pr_err("function %s invalid for lane %s: %d",
group->func, lane->name, func);
continue;
}
Expand Down Expand Up @@ -206,7 +206,7 @@ tegra_xusb_padctl_config_apply(struct tegra_xusb_padctl *padctl,

err = tegra_xusb_padctl_group_apply(padctl, group);
if (err < 0) {
error("failed to apply group %s: %d",
pr_err("failed to apply group %s: %d",
group->name, err);
continue;
}
Expand All @@ -232,7 +232,7 @@ tegra_xusb_padctl_config_parse_dt(struct tegra_xusb_padctl *padctl,

err = tegra_xusb_padctl_group_parse_dt(padctl, group, subnode);
if (err < 0) {
error("failed to parse group %s", group->name);
pr_err("failed to parse group %s", group->name);
return err;
}

Expand All @@ -250,7 +250,7 @@ static int tegra_xusb_padctl_parse_dt(struct tegra_xusb_padctl *padctl,

err = ofnode_read_resource(node, 0, &padctl->regs);
if (err < 0) {
error("registers not found");
pr_err("registers not found");
return err;
}

Expand All @@ -261,7 +261,7 @@ static int tegra_xusb_padctl_parse_dt(struct tegra_xusb_padctl *padctl,
err = tegra_xusb_padctl_config_parse_dt(padctl, config,
subnode);
if (err < 0) {
error("failed to parse entry %s: %d",
pr_err("failed to parse entry %s: %d",
config->name, err);
continue;
}
Expand Down Expand Up @@ -289,7 +289,7 @@ int tegra_xusb_process_nodes(ofnode nodes[], unsigned int count,

err = tegra_xusb_padctl_parse_dt(&padctl, nodes[i]);
if (err < 0) {
error("failed to parse DT: %d", err);
pr_err("failed to parse DT: %d", err);
continue;
}

Expand All @@ -298,7 +298,7 @@ int tegra_xusb_process_nodes(ofnode nodes[], unsigned int count,

err = tegra_xusb_padctl_config_apply(&padctl, &padctl.config);
if (err < 0) {
error("failed to apply pinmux: %d", err);
pr_err("failed to apply pinmux: %d", err);
continue;
}

Expand Down
6 changes: 3 additions & 3 deletions arch/x86/cpu/tangier/sdram.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static int sfi_table_check(struct sfi_table_header *sbh)
chksum += *pos++;

if (chksum)
error("sfi: Invalid checksum\n");
pr_err("sfi: Invalid checksum\n");

/* Checksum is OK if zero */
return chksum ? -EILSEQ : 0;
Expand Down Expand Up @@ -76,7 +76,7 @@ static struct sfi_table_simple *sfi_search_mmap(void)
/* Find SYST table */
sb = sfi_get_table_by_sig(SFI_BASE_ADDR, SFI_SIG_SYST);
if (!sb) {
error("sfi: failed to locate SYST table\n");
pr_err("sfi: failed to locate SYST table\n");
return NULL;
}

Expand All @@ -90,7 +90,7 @@ static struct sfi_table_simple *sfi_search_mmap(void)
return (struct sfi_table_simple *)sbh;
}

error("sfi: failed to locate SFI MMAP table\n");
pr_err("sfi: failed to locate SFI MMAP table\n");
return NULL;
}

Expand Down
6 changes: 3 additions & 3 deletions board/nvidia/jetson-tk1/jetson-tk1.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static int as3722_sd_enable(struct udevice *pmic, unsigned int sd)

err = pmic_clrsetbits(pmic, AS3722_SD_CONTROL, 0, 1 << sd);
if (err) {
error("failed to update SD control register: %d", err);
pr_err("failed to update SD control register: %d", err);
return err;
}

Expand All @@ -70,13 +70,13 @@ int tegra_pcie_board_init(void)

ret = as3722_sd_enable(dev, 4);
if (ret < 0) {
error("failed to enable SD4: %d\n", ret);
pr_err("failed to enable SD4: %d\n", ret);
return ret;
}

ret = as3722_sd_set_voltage(dev, 4, 0x24);
if (ret < 0) {
error("failed to set SD4 voltage: %d\n", ret);
pr_err("failed to set SD4 voltage: %d\n", ret);
return ret;
}

Expand Down
2 changes: 1 addition & 1 deletion board/samsung/common/exynos5-dt.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ int board_usb_init(int index, enum usb_init_type init)
samsung_get_base_usb3_phy();

if (!phy) {
error("usb3 phy not supported");
pr_err("usb3 phy not supported");
return -ENODEV;
}

Expand Down
2 changes: 1 addition & 1 deletion board/samsung/common/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ void draw_logo(void)

addr = panel_info.logo_addr;
if (!addr) {
error("There is no logo data.");
pr_err("There is no logo data.");
return;
}

Expand Down
4 changes: 2 additions & 2 deletions board/samsung/goni/goni.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ int board_mmc_init(bd_t *bis)

ret = s5p_mmc_init(0, 4);
if (ret)
error("MMC: Failed to init MMC:0.\n");
pr_err("MMC: Failed to init MMC:0.\n");

/*
* SD card (T_FLASH) detect and init
Expand All @@ -127,7 +127,7 @@ int board_mmc_init(bd_t *bis)

ret_sd = s5p_mmc_init(2, 4);
if (ret_sd)
error("MMC: Failed to init SD card (MMC:2).\n");
pr_err("MMC: Failed to init SD card (MMC:2).\n");
}

return ret & ret_sd;
Expand Down
Loading

0 comments on commit 9b643e3

Please sign in to comment.