From 9b643e312d528f291966c1f30b0d90bf3b1d43dc Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 16 Sep 2017 14:10:41 +0900 Subject: treewide: replace with error() with pr_err() 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: // @@@@ -error +pr_err (...) // Signed-off-by: Masahiro Yamada Reviewed-by: Simon Glass [trini: Re-run Coccinelle] Signed-off-by: Tom Rini --- cmd/fastboot.c | 2 +- cmd/nvedit.c | 6 +++--- cmd/regulator.c | 2 +- cmd/thordown.c | 6 +++--- cmd/tpm_test.c | 6 +++--- cmd/usb_gadget_sdp.c | 4 ++-- cmd/usb_mass_storage.c | 6 +++--- 7 files changed, 16 insertions(+), 16 deletions(-) (limited to 'cmd') diff --git a/cmd/fastboot.c b/cmd/fastboot.c index 488822a2ee..8adcca592d 100644 --- a/cmd/fastboot.c +++ b/cmd/fastboot.c @@ -27,7 +27,7 @@ static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) ret = board_usb_init(controller_index, USB_INIT_DEVICE); if (ret) { - error("USB init failed: %d", ret); + pr_err("USB init failed: %d", ret); return CMD_RET_FAILURE; } diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 4033d90c8e..228e904e1d 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -927,7 +927,7 @@ NXTARG: ; H_MATCH_KEY | H_MATCH_IDENT, &ptr, size, argc, argv); if (len < 0) { - error("Cannot export environment: errno = %d\n", errno); + pr_err("Cannot export environment: errno = %d\n", errno); return 1; } sprintf(buf, "%zX", (size_t)len); @@ -947,7 +947,7 @@ NXTARG: ; H_MATCH_KEY | H_MATCH_IDENT, &res, ENV_SIZE, argc, argv); if (len < 0) { - error("Cannot export environment: errno = %d\n", errno); + pr_err("Cannot export environment: errno = %d\n", errno); return 1; } @@ -1082,7 +1082,7 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag, if (himport_r(&env_htab, ptr, size, sep, del ? 0 : H_NOCLEAR, crlf_is_lf, 0, NULL) == 0) { - error("Environment import failed: errno = %d\n", errno); + pr_err("Environment import failed: errno = %d\n", errno); return 1; } gd->flags |= GD_FLG_ENV_READY; diff --git a/cmd/regulator.c b/cmd/regulator.c index 2ef5bc9a82..b605255180 100644 --- a/cmd/regulator.c +++ b/cmd/regulator.c @@ -71,7 +71,7 @@ static int curr_dev_and_platdata(struct udevice **devp, *uc_pdata = dev_get_uclass_platdata(*devp); if (!*uc_pdata) { - error("Regulator: %s - missing platform data!", currdev->name); + pr_err("Regulator: %s - missing platform data!", currdev->name); return CMD_RET_FAILURE; } diff --git a/cmd/thordown.c b/cmd/thordown.c index 436b7f5631..1bb5fc2ec2 100644 --- a/cmd/thordown.c +++ b/cmd/thordown.c @@ -33,7 +33,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int controller_index = simple_strtoul(usb_controller, NULL, 0); ret = board_usb_init(controller_index, USB_INIT_DEVICE); if (ret) { - error("USB init failed: %d", ret); + pr_err("USB init failed: %d", ret); ret = CMD_RET_FAILURE; goto exit; } @@ -42,14 +42,14 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ret = thor_init(); if (ret) { - error("THOR DOWNLOAD failed: %d", ret); + pr_err("THOR DOWNLOAD failed: %d", ret); ret = CMD_RET_FAILURE; goto exit; } ret = thor_handle(); if (ret) { - error("THOR failed: %d", ret); + pr_err("THOR failed: %d", ret); ret = CMD_RET_FAILURE; goto exit; } diff --git a/cmd/tpm_test.c b/cmd/tpm_test.c index 3306405948..37ad2ff33d 100644 --- a/cmd/tpm_test.c +++ b/cmd/tpm_test.c @@ -303,12 +303,12 @@ static int test_readonly(void) index_0 += 1; if (tpm_nv_write_value(INDEX0, (uint8_t *)&index_0, sizeof(index_0) != TPM_SUCCESS)) { - error("\tcould not write index 0\n"); + pr_err("\tcould not write index 0\n"); } tpm_nv_write_value_lock(INDEX0); if (tpm_nv_write_value(INDEX0, (uint8_t *)&index_0, sizeof(index_0)) == TPM_SUCCESS) - error("\tindex 0 is not locked\n"); + pr_err("\tindex 0 is not locked\n"); printf("\tdone\n"); return 0; @@ -471,7 +471,7 @@ static int test_write_limit(void) case TPM_MAXNVWRITES: assert(i >= TPM_MAX_NV_WRITES_NOOWNER); default: - error("\tunexpected error code %d (0x%x)\n", + pr_err("\tunexpected error code %d (0x%x)\n", result, result); } } diff --git a/cmd/usb_gadget_sdp.c b/cmd/usb_gadget_sdp.c index b1d8b2858e..ae4d73c125 100644 --- a/cmd/usb_gadget_sdp.c +++ b/cmd/usb_gadget_sdp.c @@ -28,13 +28,13 @@ static int do_sdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ret = sdp_init(controller_index); if (ret) { - error("SDP init failed: %d", ret); + pr_err("SDP init failed: %d", ret); goto exit; } /* This command typically does not return but jumps to an image */ sdp_handle(controller_index); - error("SDP ended"); + pr_err("SDP ended"); exit: g_dnl_unregister(); diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c index 3353f95c74..cfeecb7068 100644 --- a/cmd/usb_mass_storage.c +++ b/cmd/usb_mass_storage.c @@ -162,21 +162,21 @@ static int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag, controller_index = (unsigned int)(simple_strtoul( usb_controller, NULL, 0)); if (board_usb_init(controller_index, USB_INIT_DEVICE)) { - error("Couldn't init USB controller."); + pr_err("Couldn't init USB controller."); rc = CMD_RET_FAILURE; goto cleanup_ums_init; } rc = fsg_init(ums, ums_count); if (rc) { - error("fsg_init failed"); + pr_err("fsg_init failed"); rc = CMD_RET_FAILURE; goto cleanup_board; } rc = g_dnl_register("usb_dnl_ums"); if (rc) { - error("g_dnl_register failed"); + pr_err("g_dnl_register failed"); rc = CMD_RET_FAILURE; goto cleanup_board; } -- cgit v1.2.3