diff options
author | Simon Glass <sjg@chromium.org> | 2021-07-24 18:03:29 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-08-02 20:32:14 +0300 |
commit | 7e5f460ec457fe310156e399198a41eb0ce1e98c (patch) | |
tree | 7e89e4d15fcea2d2263c4b4af1be69905537ef42 /board | |
parent | 031725f8cdf33e836d19f35d3fe82c5baa5a2976 (diff) | |
download | u-boot-7e5f460ec457fe310156e399198a41eb0ce1e98c.tar.xz |
global: Convert simple_strtoul() with hex to hextoul()
It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.
Add a proper comment to simple_strtoul() while we are here.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'board')
34 files changed, 91 insertions, 95 deletions
diff --git a/board/BuS/eb_cpu5282/eb_cpu5282.c b/board/BuS/eb_cpu5282/eb_cpu5282.c index 144a08922b..5829299663 100644 --- a/board/BuS/eb_cpu5282/eb_cpu5282.c +++ b/board/BuS/eb_cpu5282/eb_cpu5282.c @@ -214,7 +214,7 @@ int drv_video_init(void) #ifdef CONFIG_SPLASH_SCREEN s = env_get("splashimage"); if (s != NULL) { - splash = simple_strtoul(s, NULL, 16); + splash = hextoul(s, NULL); vcxk_acknowledge_wait(); video_display_bitmap(splash, 0, 0); } diff --git a/board/Marvell/octeontx2/board.c b/board/Marvell/octeontx2/board.c index 9b973a4ace..4e8cb839f5 100644 --- a/board/Marvell/octeontx2/board.c +++ b/board/Marvell/octeontx2/board.c @@ -230,7 +230,7 @@ static int do_go_uboot(struct cmd_tbl *cmdtp, int flag, int argc, if (argc < 2) return CMD_RET_USAGE; - addr = simple_strtoul(argv[1], NULL, 16); + addr = hextoul(argv[1], NULL); fdt = board_fdt_blob_setup(); entry = (uboot_entry_t)addr; flush_cache((ulong)addr, 1 << 20); /* 1MiB should be enough */ diff --git a/board/amlogic/beelink-s922x/beelink-s922x.c b/board/amlogic/beelink-s922x/beelink-s922x.c index bb74426266..adae27fc7e 100644 --- a/board/amlogic/beelink-s922x/beelink-s922x.c +++ b/board/amlogic/beelink-s922x/beelink-s922x.c @@ -39,7 +39,7 @@ int misc_init_r(void) tmp[0] = efuse_mac_addr[i * 2]; tmp[1] = efuse_mac_addr[i * 2 + 1]; tmp[2] = '\0'; - mac_addr[i] = simple_strtoul(tmp, NULL, 16); + mac_addr[i] = hextoul(tmp, NULL); } if (is_valid_ethaddr(mac_addr)) diff --git a/board/amlogic/odroid-n2/odroid-n2.c b/board/amlogic/odroid-n2/odroid-n2.c index 88a60f34fe..c37ea65417 100644 --- a/board/amlogic/odroid-n2/odroid-n2.c +++ b/board/amlogic/odroid-n2/odroid-n2.c @@ -126,7 +126,7 @@ int misc_init_r(void) tmp[0] = efuse_mac_addr[i * 2]; tmp[1] = efuse_mac_addr[i * 2 + 1]; tmp[2] = '\0'; - mac_addr[i] = simple_strtoul(tmp, NULL, 16); + mac_addr[i] = hextoul(tmp, NULL); } if (is_valid_ethaddr(mac_addr)) diff --git a/board/amlogic/vim3/vim3.c b/board/amlogic/vim3/vim3.c index 18ef146218..5d9ac6458d 100644 --- a/board/amlogic/vim3/vim3.c +++ b/board/amlogic/vim3/vim3.c @@ -166,7 +166,7 @@ int misc_init_r(void) tmp[0] = efuse_mac_addr[i * 2]; tmp[1] = efuse_mac_addr[i * 2 + 1]; tmp[2] = '\0'; - mac_addr[i] = simple_strtoul(tmp, NULL, 16); + mac_addr[i] = hextoul(tmp, NULL); } if (is_valid_ethaddr(mac_addr)) diff --git a/board/bluewater/gurnard/gurnard.c b/board/bluewater/gurnard/gurnard.c index e217b95b4f..35c89850be 100644 --- a/board/bluewater/gurnard/gurnard.c +++ b/board/bluewater/gurnard/gurnard.c @@ -376,7 +376,7 @@ int board_late_init(void) /* Parse MAC address */ for (i = 0; i < 6; i++) { env_enetaddr[i] = env_str ? - simple_strtoul(env_str, &end, 16) : 0; + hextoul(env_str, &end) : 0; if (env_str) env_str = (*end) ? end+1 : end; } diff --git a/board/cavium/thunderx/atf.c b/board/cavium/thunderx/atf.c index 64aa198765..582af6f1f1 100644 --- a/board/cavium/thunderx/atf.c +++ b/board/cavium/thunderx/atf.c @@ -235,25 +235,25 @@ int do_atf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) char str[4 * sizeof(uint64_t)]; if ((argc == 5) && !strcmp(argv[1], "readmmc")) { - buffer = (void *)simple_strtoul(argv[2], NULL, 16); + buffer = (void *)hextoul(argv[2], NULL); offset = simple_strtoul(argv[3], NULL, 10); size = simple_strtoul(argv[4], NULL, 10); ret = atf_read_mmc(offset, buffer, size); } else if ((argc == 5) && !strcmp(argv[1], "readnor")) { - buffer = (void *)simple_strtoul(argv[2], NULL, 16); + buffer = (void *)hextoul(argv[2], NULL); offset = simple_strtoul(argv[3], NULL, 10); size = simple_strtoul(argv[4], NULL, 10); ret = atf_read_nor(offset, buffer, size); } else if ((argc == 5) && !strcmp(argv[1], "writemmc")) { - buffer = (void *)simple_strtoul(argv[2], NULL, 16); + buffer = (void *)hextoul(argv[2], NULL); offset = simple_strtoul(argv[3], NULL, 10); size = simple_strtoul(argv[4], NULL, 10); ret = atf_write_mmc(offset, buffer, size); } else if ((argc == 5) && !strcmp(argv[1], "writenor")) { - buffer = (void *)simple_strtoul(argv[2], NULL, 16); + buffer = (void *)hextoul(argv[2], NULL); offset = simple_strtoul(argv[3], NULL, 10); size = simple_strtoul(argv[4], NULL, 10); diff --git a/board/esd/meesc/meesc.c b/board/esd/meesc/meesc.c index eaa525eb00..a3eee63e37 100644 --- a/board/esd/meesc/meesc.c +++ b/board/esd/meesc/meesc.c @@ -208,7 +208,7 @@ void get_board_serial(struct tag_serialnr *serialnr) str = strchr(serial, '_'); if (str && (strlen(str) >= 4)) { serialnr->high = (*(str + 1) << 8) | *(str + 2); - serialnr->low = simple_strtoul(str + 3, NULL, 16); + serialnr->low = hextoul(str + 3, NULL); } } else { serialnr->high = 0; diff --git a/board/freescale/common/cmd_esbc_validate.c b/board/freescale/common/cmd_esbc_validate.c index 638aa3c19a..6c096266b4 100644 --- a/board/freescale/common/cmd_esbc_validate.c +++ b/board/freescale/common/cmd_esbc_validate.c @@ -40,7 +40,7 @@ static int do_esbc_validate(struct cmd_tbl *cmdtp, int flag, int argc, hash_str = argv[2]; /* First argument - header address -32/64bit */ - haddr = (uintptr_t)simple_strtoul(argv[1], NULL, 16); + haddr = (uintptr_t)hextoul(argv[1], NULL); /* With esbc_validate command, Image address must be * part of header. So, the function is called diff --git a/board/freescale/common/fsl_validate.c b/board/freescale/common/fsl_validate.c index 564a8b3b54..066aa9a7c3 100644 --- a/board/freescale/common/fsl_validate.c +++ b/board/freescale/common/fsl_validate.c @@ -767,7 +767,7 @@ static inline int str2longbe(const char *p, ulong *num) if (!p) { return 0; } else { - tmp = simple_strtoul(p, &endptr, 16); + tmp = hextoul(p, &endptr); if (sizeof(ulong) == 4) *num = cpu_to_be32(tmp); else diff --git a/board/freescale/common/sys_eeprom.c b/board/freescale/common/sys_eeprom.c index be0fda0638..9e73056a29 100644 --- a/board/freescale/common/sys_eeprom.c +++ b/board/freescale/common/sys_eeprom.c @@ -378,7 +378,7 @@ static void set_mac_address(unsigned int index, const char *string) } for (i = 0; *p && (i < 6); i++) { - e.mac[index][i] = simple_strtoul(p, &p, 16); + e.mac[index][i] = hextoul(p, &p); if (*p == ':') p++; } @@ -452,7 +452,7 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) set_date(argv[2]); break; case 'p': /* MAC table size */ - e.mac_count = simple_strtoul(argv[2], NULL, 16); + e.mac_count = hextoul(argv[2], NULL); update_crc(); break; case '0' ... '9': /* "mac 0" through "mac 22" */ diff --git a/board/freescale/lx2160a/eth_lx2160aqds.c b/board/freescale/lx2160a/eth_lx2160aqds.c index 437f0bc4cf..a2b6442b54 100644 --- a/board/freescale/lx2160a/eth_lx2160aqds.c +++ b/board/freescale/lx2160a/eth_lx2160aqds.c @@ -416,7 +416,7 @@ static inline void do_dpmac_config(int dpmac, const char *arg_dpmacid, env_dpmac, phy_num + 1, arg_dpmacid); else wriop_set_phy_address(dpmac, phy_num, - simple_strtoul(ret, NULL, 16)); + hextoul(ret, NULL)); } /*search mdio in dpmac arg*/ diff --git a/board/freescale/lx2160a/eth_lx2162aqds.c b/board/freescale/lx2160a/eth_lx2162aqds.c index b742c1ff52..3b04dea39c 100644 --- a/board/freescale/lx2160a/eth_lx2162aqds.c +++ b/board/freescale/lx2160a/eth_lx2162aqds.c @@ -437,7 +437,7 @@ static inline void do_dpmac_config(int dpmac, const char *arg_dpmacid, env_dpmac, phy_num + 1, arg_dpmacid); else wriop_set_phy_address(dpmac, phy_num, - simple_strtoul(ret, NULL, 16)); + hextoul(ret, NULL)); } /*search mdio in dpmac arg*/ diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c index 8273384f2d..cf4d9c11b8 100644 --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c @@ -281,7 +281,7 @@ int board_early_init_r(void) /* If a VSC7385 microcode image is present, then upload it. */ tmp = env_get("vscfw_addr"); if (tmp) { - vscfw_addr = simple_strtoul(tmp, NULL, 16); + vscfw_addr = hextoul(tmp, NULL); printf("uploading VSC7385 microcode from %x\n", vscfw_addr); if (vsc7385_upload_firmware((void *)vscfw_addr, CONFIG_VSC7385_IMAGE_SIZE)) diff --git a/board/freescale/p2041rdb/cpld.c b/board/freescale/p2041rdb/cpld.c index b042fe3bcb..a1908b8a57 100644 --- a/board/freescale/p2041rdb/cpld.c +++ b/board/freescale/p2041rdb/cpld.c @@ -100,8 +100,8 @@ int cpld_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) else cpld_set_defbank(); } else if (strcmp(argv[1], "lane_mux") == 0) { - u32 lane = simple_strtoul(argv[2], NULL, 16); - u8 val = (u8)simple_strtoul(argv[3], NULL, 16); + u32 lane = hextoul(argv[2], NULL); + u8 val = (u8)hextoul(argv[3], NULL); u8 reg = CPLD_READ(serdes_mux); switch (lane) { diff --git a/board/gateworks/gw_ventana/common.c b/board/gateworks/gw_ventana/common.c index c07eb627a2..4a15837473 100644 --- a/board/gateworks/gw_ventana/common.c +++ b/board/gateworks/gw_ventana/common.c @@ -1502,7 +1502,7 @@ void setup_board_gpio(int board, struct ventana_board_info *info) continue; s = hwconfig_subarg(arg, "padctrl", &len); if (s) { - ctrl = MUX_PAD_CTRL(simple_strtoul(s, NULL, 16) + ctrl = MUX_PAD_CTRL(hextoul(s, NULL) & 0x1ffff) | MUX_MODE_SION; } if (hwconfig_subarg_cmp(arg, "mode", "gpio")) { diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c index 468fb093b7..6a0382dee3 100644 --- a/board/gateworks/gw_ventana/gw_ventana.c +++ b/board/gateworks/gw_ventana/gw_ventana.c @@ -915,7 +915,7 @@ int fdt_fixup_sky2(void *blob, int np, struct pci_dev *dev) if (tmp) { for (j = 0; j < 6; j++) { mac_addr[j] = tmp ? - simple_strtoul(tmp, &end,16) : 0; + hextoul(tmp, &end) : 0; if (tmp) tmp = (*end) ? end+1 : end; } diff --git a/board/gdsys/common/osd.c b/board/gdsys/common/osd.c index 679f8f3019..dc548efbc7 100644 --- a/board/gdsys/common/osd.c +++ b/board/gdsys/common/osd.c @@ -284,9 +284,9 @@ static int osd_print(struct cmd_tbl *cmdtp, int flag, int argc, if (!(osd_screen_mask & (1 << screen))) continue; - x = simple_strtoul(argv[1], NULL, 16); - y = simple_strtoul(argv[2], NULL, 16); - color = simple_strtoul(argv[3], NULL, 16); + x = hextoul(argv[1], NULL); + y = hextoul(argv[2], NULL); + color = hextoul(argv[3], NULL); text = argv[4]; charcount = strlen(text); len = (charcount > bufsize) ? bufsize : charcount; @@ -416,13 +416,13 @@ int osd_write(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) char *rp; u16 *wp = buffer; unsigned count = (argc > 4) ? - simple_strtoul(argv[4], NULL, 16) : 1; + hextoul(argv[4], NULL) : 1; if (!(osd_screen_mask & (1 << screen))) continue; - x = simple_strtoul(argv[1], NULL, 16); - y = simple_strtoul(argv[2], NULL, 16); + x = hextoul(argv[1], NULL); + y = hextoul(argv[2], NULL); rp = argv[3]; @@ -431,7 +431,7 @@ int osd_write(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) memcpy(substr, rp, 4); substr[4] = 0; - *wp = simple_strtoul(substr, NULL, 16); + *wp = hextoul(substr, NULL); rp += 4; wp++; @@ -463,8 +463,8 @@ int osd_size(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) return 1; } - x = simple_strtoul(argv[1], NULL, 16); - y = simple_strtoul(argv[2], NULL, 16); + x = hextoul(argv[1], NULL); + y = hextoul(argv[2], NULL); if (!x || (x > 64) || (x > MAX_X_CHARS) || !y || (y > 32) || (y > MAX_Y_CHARS)) { diff --git a/board/gdsys/common/osd_cmd.c b/board/gdsys/common/osd_cmd.c index fe6249794e..6a9c0b4c24 100644 --- a/board/gdsys/common/osd_cmd.c +++ b/board/gdsys/common/osd_cmd.c @@ -30,10 +30,10 @@ static int do_osd_write(struct cmd_tbl *cmdtp, int flag, int argc, if (argc < 4 || (strlen(argv[3])) % 2) return CMD_RET_USAGE; - x = simple_strtoul(argv[1], NULL, 16); - y = simple_strtoul(argv[2], NULL, 16); + x = hextoul(argv[1], NULL); + y = hextoul(argv[2], NULL); hexstr = argv[3]; - count = (argc > 4) ? simple_strtoul(argv[4], NULL, 16) : 1; + count = (argc > 4) ? hextoul(argv[4], NULL) : 1; buflen = strlen(hexstr) / 2; @@ -80,9 +80,9 @@ static int do_osd_print(struct cmd_tbl *cmdtp, int flag, int argc, if (argc < 5) return CMD_RET_USAGE; - x = simple_strtoul(argv[1], NULL, 16); - y = simple_strtoul(argv[2], NULL, 16); - color = simple_strtoul(argv[3], NULL, 16); + x = hextoul(argv[1], NULL); + y = hextoul(argv[2], NULL); + color = hextoul(argv[3], NULL); text = argv[4]; for (uclass_first_device(UCLASS_VIDEO_OSD, &dev); @@ -109,8 +109,8 @@ static int do_osd_size(struct cmd_tbl *cmdtp, int flag, int argc, if (argc < 3) return CMD_RET_USAGE; - x = simple_strtoul(argv[1], NULL, 16); - y = simple_strtoul(argv[2], NULL, 16); + x = hextoul(argv[1], NULL); + y = hextoul(argv[2], NULL); for (uclass_first_device(UCLASS_VIDEO_OSD, &dev); dev; diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 016806a2a6..ff07260194 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -278,7 +278,7 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int flag, int argc, * use simple_strtoul because we need &end and * we know we got non numeric char at the end */ - bid = simple_strtoul(rest, &endp, 16); + bid = hextoul(rest, &endp); /* BoardId and HWkey are separated with a "_" */ if (*endp == '_') { rest = endp + 1; @@ -286,7 +286,7 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int flag, int argc, * use simple_strtoul because we need * &end */ - hwkey = simple_strtoul(rest, &endp, 16); + hwkey = hextoul(rest, &endp); rest = endp; while (*rest && !isxdigit(*rest)) rest++; diff --git a/board/kontron/sl28/cmds.c b/board/kontron/sl28/cmds.c index 046d3b4903..08a22b5d01 100644 --- a/board/kontron/sl28/cmds.c +++ b/board/kontron/sl28/cmds.c @@ -138,7 +138,7 @@ static int do_sl28_nvm(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_FAILURE; if (argc > 1) { - nvm = simple_strtoul(argv[1], &endp, 16); + nvm = hextoul(argv[1], &endp); if (*endp != '\0') { printf("ERROR: argument is not a valid number\n"); ret = -EINVAL; diff --git a/board/menlo/m53menlo/m53menlo.c b/board/menlo/m53menlo/m53menlo.c index c34baca602..2b331b32df 100644 --- a/board/menlo/m53menlo/m53menlo.c +++ b/board/menlo/m53menlo/m53menlo.c @@ -347,7 +347,7 @@ int board_late_init(void) if (!s) return 0; - addr = simple_strtoul(s, NULL, 16); + addr = hextoul(s, NULL); dst = malloc(CONFIG_SYS_VIDEO_LOGO_MAX_SIZE); if (!dst) return -ENOMEM; diff --git a/board/renesas/stout/cpld.c b/board/renesas/stout/cpld.c index ac8048c81c..b7c75f5aa6 100644 --- a/board/renesas/stout/cpld.c +++ b/board/renesas/stout/cpld.c @@ -133,7 +133,7 @@ static int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc, if (argc < 3) return CMD_RET_USAGE; - addr = simple_strtoul(argv[2], NULL, 16); + addr = hextoul(argv[2], NULL); if (!(addr == CPLD_ADDR_VERSION || addr == CPLD_ADDR_MODE || addr == CPLD_ADDR_MUX || addr == CPLD_ADDR_HDMI || addr == CPLD_ADDR_DIPSW || addr == CPLD_ADDR_RESET)) { @@ -144,7 +144,7 @@ static int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc, if (argc == 3 && strcmp(argv[1], "read") == 0) { printf("0x%x\n", cpld_read(addr)); } else if (argc == 4 && strcmp(argv[1], "write") == 0) { - val = simple_strtoul(argv[3], NULL, 16); + val = hextoul(argv[3], NULL); if (addr == CPLD_ADDR_MUX) { /* never mask SCIFA0 console */ val &= ~MUX_MSK_SCIFA0_USB; diff --git a/board/renesas/ulcb/cpld.c b/board/renesas/ulcb/cpld.c index ebb2d6f742..0c060a5323 100644 --- a/board/renesas/ulcb/cpld.c +++ b/board/renesas/ulcb/cpld.c @@ -111,7 +111,7 @@ static int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc, if (argc < 3) return CMD_RET_USAGE; - addr = simple_strtoul(argv[2], NULL, 16); + addr = hextoul(argv[2], NULL); if (!(addr == CPLD_ADDR_VERSION || addr == CPLD_ADDR_MODE || addr == CPLD_ADDR_MUX || addr == CPLD_ADDR_DIPSW6 || addr == CPLD_ADDR_RESET)) { @@ -122,7 +122,7 @@ static int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc, if (argc == 3 && strcmp(argv[1], "read") == 0) { printf("0x%x\n", cpld_read(dev, addr)); } else if (argc == 4 && strcmp(argv[1], "write") == 0) { - val = simple_strtoul(argv[3], NULL, 16); + val = hextoul(argv[3], NULL); cpld_write(dev, addr, val); } diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c index 2e3ae1a54d..fba678b426 100644 --- a/board/siemens/common/factoryset.c +++ b/board/siemens/common/factoryset.c @@ -243,7 +243,7 @@ int factoryset_read_eeprom(int i2c_addr) buf, MAX_STRING_LENGTH); cp1 = buf; for (i = 0; i < 6; i++) { - factory_dat.mac[i] = simple_strtoul((char *)cp1, NULL, 16); + factory_dat.mac[i] = hextoul((char *)cp1, NULL); cp1 += 3; } @@ -254,8 +254,7 @@ int factoryset_read_eeprom(int i2c_addr) if (ret > 0) { cp1 = buf; for (i = 0; i < 6; i++) { - factory_dat.mac_wlan[i] = simple_strtoul((char *)cp1, - NULL, 16); + factory_dat.mac_wlan[i] = hextoul((char *)cp1, NULL); cp1 += 3; } } @@ -266,15 +265,13 @@ int factoryset_read_eeprom(int i2c_addr) if (0 <= get_factory_record_val(cp, size, (uchar *)"USBD1", (uchar *)"vid", buf, MAX_STRING_LENGTH)) { - factory_dat.usb_vendor_id = simple_strtoul((char *)buf, - NULL, 16); + factory_dat.usb_vendor_id = hextoul((char *)buf, NULL); } if (0 <= get_factory_record_val(cp, size, (uchar *)"USBD1", (uchar *)"pid", buf, MAX_STRING_LENGTH)) { - factory_dat.usb_product_id = simple_strtoul((char *)buf, - NULL, 16); + factory_dat.usb_product_id = hextoul((char *)buf, NULL); } printf("DFU USB: VID = 0x%4x, PID = 0x%4x\n", factory_dat.usb_vendor_id, factory_dat.usb_product_id); @@ -294,8 +291,7 @@ int factoryset_read_eeprom(int i2c_addr) if (0 <= get_factory_record_val(cp, size, (uchar *)"DEV", (uchar *)"ver", buf, MAX_STRING_LENGTH)) { - factory_dat.version = simple_strtoul((char *)buf, - NULL, 16); + factory_dat.version = hextoul((char *)buf, NULL); debug("version number: %d\n", factory_dat.version); } /* Get ASN from factory set if available */ diff --git a/board/sifive/unmatched/hifive-platform-i2c-eeprom.c b/board/sifive/unmatched/hifive-platform-i2c-eeprom.c index ad2f3155d0..b230a71b3a 100644 --- a/board/sifive/unmatched/hifive-platform-i2c-eeprom.c +++ b/board/sifive/unmatched/hifive-platform-i2c-eeprom.c @@ -281,7 +281,7 @@ static void set_mac_address(char *string) } for (i = 0; *string && (i < MAC_ADDR_BYTES); i++) { - e.mac_addr[i] = simple_strtoul(string, &string, 16); + e.mac_addr[i] = hextoul(string, &string); if (*string == ':') string++; } diff --git a/board/synopsys/hsdk/env-lib.c b/board/synopsys/hsdk/env-lib.c index 235f29565f..e2258385ce 100644 --- a/board/synopsys/hsdk/env-lib.c +++ b/board/synopsys/hsdk/env-lib.c @@ -252,7 +252,7 @@ static int arg_read_set(const struct env_map_common *map, u32 i, int argc, char *endp = argv[1]; if (map[i].type == ENV_HEX) - map[i].val->val = simple_strtoul(argv[1], &endp, 16); + map[i].val->val = hextoul(argv[1], &endp); else map[i].val->val = simple_strtoul(argv[1], &endp, 10); diff --git a/board/ti/am64x/evm.c b/board/ti/am64x/evm.c index cdbb9a87bc..21c58c76d6 100644 --- a/board/ti/am64x/evm.c +++ b/board/ti/am64x/evm.c @@ -120,7 +120,7 @@ static void setup_serial(void) if (env_get("serial#")) return; - board_serial = simple_strtoul(ep->serial, &endp, 16); + board_serial = hextoul(ep->serial, &endp); if (*endp != '\0') { pr_err("Error: Can't set serial# to %s\n", ep->serial); return; diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c index 580f13c3ab..077d83420c 100644 --- a/board/ti/j721e/evm.c +++ b/board/ti/j721e/evm.c @@ -201,7 +201,7 @@ static void setup_serial(void) if (env_get("serial#")) return; - board_serial = simple_strtoul(ep->serial, &endp, 16); + board_serial = hextoul(ep->serial, &endp); if (*endp != '\0') { pr_err("Error: Can't set serial# to %s\n", ep->serial); return; diff --git a/board/varisys/common/sys_eeprom.c b/board/varisys/common/sys_eeprom.c index 251d9fd73e..1bf543619b 100644 --- a/board/varisys/common/sys_eeprom.c +++ b/board/varisys/common/sys_eeprom.c @@ -299,7 +299,7 @@ static void set_mac_address(unsigned int index, const char *string) } for (i = 0; *p && (i < 6); i++) { - e.mac[index][i] = simple_strtoul(p, &p, 16); + e.mac[index][i] = hextoul(p, &p); if (*p == ':') p++; } @@ -364,7 +364,7 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) set_date(argv[2]); break; case 'p': /* MAC table size */ - e.mac_count = simple_strtoul(argv[2], NULL, 16); + e.mac_count = hextoul(argv[2], NULL); update_crc(); break; case '0' ... '9': /* "mac 0" through "mac 22" */ diff --git a/board/xilinx/common/fru.c b/board/xilinx/common/fru.c index ccf48723ff..f6ca46c3ce 100644 --- a/board/xilinx/common/fru.c +++ b/board/xilinx/common/fru.c @@ -19,7 +19,7 @@ static int do_fru_capture(struct cmd_tbl *cmdtp, int flag, int argc, if (argc < cmdtp->maxargs) return CMD_RET_USAGE; - addr = simple_strtoul(argv[2], &endp, 16); + addr = hextoul(argv[2], &endp); if (*argv[1] == 0 || *endp != 0) return -1; @@ -41,7 +41,7 @@ static int do_fru_generate(struct cmd_tbl *cmdtp, int flag, int argc, if (argc < cmdtp->maxargs) return CMD_RET_USAGE; - addr = simple_strtoul(argv[2], NULL, 16); + addr = hextoul(argv[2], NULL); return fru_generate(addr, argv[3], argv[4], argv[5], argv[6], argv[7]); } diff --git a/board/xilinx/versal/cmds.c b/board/xilinx/versal/cmds.c index f5735d0c62..04d4cdb141 100644 --- a/board/xilinx/versal/cmds.c +++ b/board/xilinx/versal/cmds.c @@ -32,7 +32,7 @@ static int do_versal_load_pdi(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_USAGE; } - len = simple_strtoul(argv[3], NULL, 16); + len = hextoul(argv[3], NULL); if (!len) { debug("pdi_load: zero size\n"); return CMD_RET_USAGE; diff --git a/board/xilinx/zynq/cmds.c b/board/xilinx/zynq/cmds.c index 6c697caa62..024fac65f3 100644 --- a/board/xilinx/zynq/cmds.c +++ b/board/xilinx/zynq/cmds.c @@ -422,7 +422,7 @@ static int do_zynq_rsa(struct cmd_tbl *cmdtp, int flag, int argc, if (argc != cmdtp->maxargs) return CMD_RET_FAILURE; - src_ptr = simple_strtoul(argv[2], &endp, 16); + src_ptr = hextoul(argv[2], &endp); if (*argv[2] == 0 || *endp != 0) return CMD_RET_USAGE; @@ -453,26 +453,26 @@ static int zynq_decrypt_image(struct cmd_tbl *cmdtp, int flag, int argc, else return CMD_RET_USAGE; - srcaddr = simple_strtoul(argv[3], &endp, 16); + srcaddr = hextoul(argv[3], &endp); if (*argv[3] == 0 || *endp != 0) return CMD_RET_USAGE; - srclen = simple_strtoul(argv[4], &endp, 16); + srclen = hextoul(argv[4], &endp); if (*argv[4] == 0 || *endp != 0) return CMD_RET_USAGE; dstaddr = 0xFFFFFFFF; dstlen = srclen; } else { - srcaddr = simple_strtoul(argv[2], &endp, 16); + srcaddr = hextoul(argv[2], &endp); if (*argv[2] == 0 || *endp != 0) return CMD_RET_USAGE; - srclen = simple_strtoul(argv[3], &endp, 16); + srclen = hextoul(argv[3], &endp); if (*argv[3] == 0 || *endp != 0) return CMD_RET_USAGE; - dstaddr = simple_strtoul(argv[4], &endp, 16); + dstaddr = hextoul(argv[4], &endp); if (*argv[4] == 0 || *endp != 0) return CMD_RET_USAGE; - dstlen = simple_strtoul(argv[5], &endp, 16); + dstlen = hextoul(argv[5], &endp); if (*argv[5] == 0 || *endp != 0) return CMD_RET_USAGE; } diff --git a/board/xilinx/zynqmp/cmds.c b/board/xilinx/zynqmp/cmds.c index cf63ad97fa..b15c0f599b 100644 --- a/board/xilinx/zynqmp/cmds.c +++ b/board/xilinx/zynqmp/cmds.c @@ -40,7 +40,7 @@ static int do_zynqmp_verify_secure(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_USAGE; src_addr = simple_strtoull(argv[2], NULL, 16); - len = simple_strtoul(argv[3], NULL, 16); + len = hextoul(argv[3], NULL); if (argc == 5) key_ptr = (uint8_t *)(uintptr_t)simple_strtoull(argv[4], @@ -86,7 +86,7 @@ static int do_zynqmp_mmio_read(struct cmd_tbl *cmdtp, int flag, int argc, if (argc != cmdtp->maxargs) return CMD_RET_USAGE; - addr = simple_strtoul(argv[2], NULL, 16); + addr = hextoul(argv[2], NULL); ret = zynqmp_mmio_read(addr, &read_val); if (!ret) @@ -107,9 +107,9 @@ static int do_zynqmp_mmio_write(struct cmd_tbl *cmdtp, int flag, int argc, if (argc != cmdtp->maxargs) return CMD_RET_USAGE; - addr = simple_strtoul(argv[2], NULL, 16); - mask = simple_strtoul(argv[3], NULL, 16); - val = simple_strtoul(argv[4], NULL, 16); + addr = hextoul(argv[2], NULL); + mask = hextoul(argv[3], NULL); + val = hextoul(argv[4], NULL); ret = zynqmp_mmio_write(addr, mask, val); if (ret != 0) @@ -135,12 +135,12 @@ static int do_zynqmp_aes(struct cmd_tbl *cmdtp, int flag, int argc, if (argc < cmdtp->maxargs - 1) return CMD_RET_USAGE; - aes->srcaddr = simple_strtoul(argv[2], NULL, 16); - aes->ivaddr = simple_strtoul(argv[3], NULL, 16); - aes->len = simple_strtoul(argv[4], NULL, 16); - aes->op = simple_strtoul(argv[5], NULL, 16); - aes->keysrc = simple_strtoul(argv[6], NULL, 16); - aes->dstaddr = simple_strtoul(argv[7], NULL, 16); + aes->srcaddr = hextoul(argv[2], NULL); + aes->ivaddr = hextoul(argv[3], NULL); + aes->len = hextoul(argv[4], NULL); + aes->op = hextoul(argv[5], NULL); + aes->keysrc = hextoul(argv[6], NULL); + aes->dstaddr = hextoul(argv[7], NULL); flush_dcache_range((ulong)aes, (ulong)(aes) + roundup(sizeof(struct aes), ARCH_DMA_MINALIGN)); @@ -161,7 +161,7 @@ static int do_zynqmp_aes(struct cmd_tbl *cmdtp, int flag, int argc, if (argc < cmdtp->maxargs) return CMD_RET_USAGE; - aes->keyaddr = simple_strtoul(argv[8], NULL, 16); + aes->keyaddr = hextoul(argv[8], NULL); if (aes->keyaddr) flush_dcache_range(aes->keyaddr, (aes->keyaddr + @@ -187,7 +187,7 @@ static int do_zynqmp_tcm_init(struct cmd_tbl *cmdtp, int flag, int argc, if (argc != cmdtp->maxargs) return CMD_RET_USAGE; - mode = simple_strtoul(argv[2], NULL, 16); + mode = hextoul(argv[2], NULL); if (mode != TCM_LOCK && mode != TCM_SPLIT) { printf("Mode should be either 0(lock)/1(split)\n"); return CMD_RET_FAILURE; @@ -209,8 +209,8 @@ static int do_zynqmp_pmufw(struct cmd_tbl *cmdtp, int flag, int argc, if (argc != cmdtp->maxargs) return CMD_RET_USAGE; - addr = simple_strtoul(argv[2], NULL, 16); - size = simple_strtoul(argv[3], NULL, 16); + addr = hextoul(argv[2], NULL); + size = hextoul(argv[3], NULL); flush_dcache_range((ulong)addr, (ulong)(addr + size)); zynqmp_pmufw_load_config_object((const void *)(uintptr_t)addr, @@ -236,16 +236,16 @@ static int do_zynqmp_rsa(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_FAILURE; } - srcaddr = simple_strtoul(argv[2], NULL, 16); - srclen = simple_strtoul(argv[3], NULL, 16); + srcaddr = hextoul(argv[2], NULL); + srclen = hextoul(argv[3], NULL); if (srclen != RSA_KEY_SIZE) { puts("ERR: srclen should be equal to 0x200(512 bytes)\n"); return CMD_RET_USAGE; } - mod = simple_strtoul(argv[4], NULL, 16); - exp = simple_strtoul(argv[5], NULL, 16); - rsaop = simple_strtoul(argv[6], NULL, 16); + mod = hextoul(argv[4], NULL); + exp = hextoul(argv[5], NULL); + rsaop = hextoul(argv[6], NULL); if (!(rsaop == 0 || rsaop == 1)) { puts("ERR: rsaop should be either 0 or 1\n"); return CMD_RET_USAGE; @@ -299,11 +299,11 @@ static int do_zynqmp_sha3(struct cmd_tbl *cmdtp, int flag, return CMD_RET_FAILURE; } - srcaddr = simple_strtoul(argv[2], NULL, 16); - srclen = simple_strtoul(argv[3], NULL, 16); + srcaddr = hextoul(argv[2], NULL); + srclen = hextoul(argv[3], NULL); if (argc == 5) { - hashaddr = simple_strtoul(argv[4], NULL, 16); + hashaddr = hextoul(argv[4], NULL); flush_dcache_range(hashaddr, hashaddr + roundup(ZYNQMP_SHA3_SIZE, ARCH_DMA_MINALIGN)); |