summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-07-24 18:03:30 +0300
committerTom Rini <trini@konsulko.com>2021-08-02 20:32:14 +0300
commit0b1284eb52578e15ec611adc5fee1a9ae68dadea (patch)
tree2d83815e93fc16decbaa5671fd660ade0ec74532 /cmd
parent7e5f460ec457fe310156e399198a41eb0ce1e98c (diff)
downloadu-boot-0b1284eb52578e15ec611adc5fee1a9ae68dadea.tar.xz
global: Convert simple_strtoul() with decimal to dectoul()
It is a pain to have to specify the value 10 in each call. Add a new dectoul() function and update the code to use it. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/avb.c2
-rw-r--r--cmd/axi.c8
-rw-r--r--cmd/bind.c4
-rw-r--r--cmd/binop.c2
-rw-r--r--cmd/blk_common.c4
-rw-r--r--cmd/bmp.c4
-rw-r--r--cmd/clk.c2
-rw-r--r--cmd/clone.c2
-rw-r--r--cmd/cros_ec.c4
-rw-r--r--cmd/demo.c2
-rw-r--r--cmd/exit.c2
-rw-r--r--cmd/flash.c6
-rw-r--r--cmd/gpio.c4
-rw-r--r--cmd/gpt.c2
-rw-r--r--cmd/i2c.c8
-rw-r--r--cmd/led.c2
-rw-r--r--cmd/legacy_led.c2
-rw-r--r--cmd/load.c6
-rw-r--r--cmd/log.c4
-rw-r--r--cmd/mbr.c2
-rw-r--r--cmd/mem.c4
-rw-r--r--cmd/mmc.c40
-rw-r--r--cmd/mp.c2
-rw-r--r--cmd/nand.c2
-rw-r--r--cmd/nvedit.c2
-rw-r--r--cmd/optee_rpmb.c2
-rw-r--r--cmd/osd.c4
-rw-r--r--cmd/pcap.c2
-rw-r--r--cmd/pstore.c2
-rw-r--r--cmd/pwm.c10
-rw-r--r--cmd/remoteproc.c6
-rw-r--r--cmd/rtc.c2
-rw-r--r--cmd/sata.c2
-rw-r--r--cmd/sleep.c2
-rw-r--r--cmd/sound.c4
-rw-r--r--cmd/spi.c10
-rw-r--r--cmd/ti/pd.c4
-rw-r--r--cmd/tpm-common.c2
-rw-r--r--cmd/ufs.c2
-rw-r--r--cmd/usb.c6
-rw-r--r--cmd/w1.c8
41 files changed, 95 insertions, 95 deletions
diff --git a/cmd/avb.c b/cmd/avb.c
index 02b4b1f022..783f51b816 100644
--- a/cmd/avb.c
+++ b/cmd/avb.c
@@ -366,7 +366,7 @@ int do_avb_read_pvalue(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
name = argv[1];
- bytes = simple_strtoul(argv[2], &endp, 10);
+ bytes = dectoul(argv[2], &endp);
if (*endp && *endp != '\n')
return CMD_RET_USAGE;
diff --git a/cmd/axi.c b/cmd/axi.c
index c676819b81..0c80fef053 100644
--- a/cmd/axi.c
+++ b/cmd/axi.c
@@ -120,7 +120,7 @@ static int do_axi_show_bus(struct cmd_tbl *cmdtp, int flag, int argc,
int i;
/* show specific bus */
- i = simple_strtoul(argv[1], NULL, 10);
+ i = dectoul(argv[1], NULL);
struct udevice *bus;
int ret;
@@ -153,7 +153,7 @@ static int do_axi_bus_num(struct cmd_tbl *cmdtp, int flag, int argc,
printf("Current bus is %d\n", bus_no);
} else {
- bus_no = simple_strtoul(argv[1], NULL, 10);
+ bus_no = dectoul(argv[1], NULL);
printf("Setting bus to %d\n", bus_no);
ret = axi_set_cur_bus(bus_no);
@@ -193,7 +193,7 @@ static int do_axi_md(struct cmd_tbl *cmdtp, int flag, int argc,
}
if ((flag & CMD_FLAG_REPEAT) == 0) {
- size = simple_strtoul(argv[1], NULL, 10);
+ size = dectoul(argv[1], NULL);
/*
* Address is specified since argc >= 3
@@ -273,7 +273,7 @@ static int do_axi_mw(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc <= 3 || argc >= 6)
return CMD_RET_USAGE;
- size = simple_strtoul(argv[1], NULL, 10);
+ size = dectoul(argv[1], NULL);
switch (size) {
case 8:
diff --git a/cmd/bind.c b/cmd/bind.c
index af2f22cc4c..07c629eff7 100644
--- a/cmd/bind.c
+++ b/cmd/bind.c
@@ -218,13 +218,13 @@ static int do_bind_unbind(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
ret = unbind_by_node_path(argv[1]);
} else if (!by_node && bind) {
- int index = (argc > 2) ? simple_strtoul(argv[2], NULL, 10) : 0;
+ int index = (argc > 2) ? dectoul(argv[2], NULL) : 0;
if (argc != 4)
return CMD_RET_USAGE;
ret = bind_by_class_index(argv[1], index, argv[3]);
} else if (!by_node && !bind) {
- int index = (argc > 2) ? simple_strtoul(argv[2], NULL, 10) : 0;
+ int index = (argc > 2) ? dectoul(argv[2], NULL) : 0;
if (argc == 3)
ret = unbind_by_class_index(argv[1], index);
diff --git a/cmd/binop.c b/cmd/binop.c
index bb5adc3e05..592e914690 100644
--- a/cmd/binop.c
+++ b/cmd/binop.c
@@ -89,7 +89,7 @@ static int do_binop(struct cmd_tbl *cmdtp, int flag, int argc,
else
return CMD_RET_USAGE;
- len = simple_strtoul(lenarg, NULL, 10);
+ len = dectoul(lenarg, NULL);
src1 = malloc(len);
src2 = malloc(len);
diff --git a/cmd/blk_common.c b/cmd/blk_common.c
index 0898798dec..4e442f2918 100644
--- a/cmd/blk_common.c
+++ b/cmd/blk_common.c
@@ -40,7 +40,7 @@ int blk_common_cmd(int argc, char *const argv[], enum if_type if_type,
return CMD_RET_USAGE;
case 3:
if (strncmp(argv[1], "dev", 3) == 0) {
- int dev = (int)simple_strtoul(argv[2], NULL, 10);
+ int dev = (int)dectoul(argv[2], NULL);
if (!blk_show_device(if_type, dev)) {
*cur_devnump = dev;
@@ -50,7 +50,7 @@ int blk_common_cmd(int argc, char *const argv[], enum if_type if_type,
}
return 0;
} else if (strncmp(argv[1], "part", 4) == 0) {
- int dev = (int)simple_strtoul(argv[2], NULL, 10);
+ int dev = (int)dectoul(argv[2], NULL);
if (blk_print_part_devnum(if_type, dev)) {
printf("\n%s device %d not available\n",
diff --git a/cmd/bmp.c b/cmd/bmp.c
index f4fe97d89d..071ba90b43 100644
--- a/cmd/bmp.c
+++ b/cmd/bmp.c
@@ -131,11 +131,11 @@ static int do_bmp_display(struct cmd_tbl *cmdtp, int flag, int argc,
if (!strcmp(argv[2], "m"))
x = BMP_ALIGN_CENTER;
else
- x = simple_strtoul(argv[2], NULL, 10);
+ x = dectoul(argv[2], NULL);
if (!strcmp(argv[3], "m"))
y = BMP_ALIGN_CENTER;
else
- y = simple_strtoul(argv[3], NULL, 10);
+ y = dectoul(argv[3], NULL);
break;
default:
return CMD_RET_USAGE;
diff --git a/cmd/clk.c b/cmd/clk.c
index 7ece2454e0..dbbdc31b35 100644
--- a/cmd/clk.c
+++ b/cmd/clk.c
@@ -120,7 +120,7 @@ static int do_clk_setfreq(struct cmd_tbl *cmdtp, int flag, int argc,
s32 freq;
struct udevice *dev;
- freq = simple_strtoul(argv[2], NULL, 10);
+ freq = dectoul(argv[2], NULL);
dev = clk_lookup(argv[1]);
diff --git a/cmd/clone.c b/cmd/clone.c
index 32473a032c..a906207757 100644
--- a/cmd/clone.c
+++ b/cmd/clone.c
@@ -34,7 +34,7 @@ static int do_clone(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv
printf("Unable to open destination device\n");
return 1;
}
- requested = simple_strtoul(argv[5], &unit, 10);
+ requested = dectoul(argv[5], &unit);
srcbz = srcdesc->blksz;
destbz = destdesc->blksz;
diff --git a/cmd/cros_ec.c b/cmd/cros_ec.c
index abda5d6cd2..a40f5898b5 100644
--- a/cmd/cros_ec.c
+++ b/cmd/cros_ec.c
@@ -501,11 +501,11 @@ static int do_cros_ec(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
return CMD_RET_USAGE;
- index = simple_strtoul(argv[2], &endp, 10);
+ index = dectoul(argv[2], &endp);
if (*argv[2] == 0 || *endp != 0)
return CMD_RET_USAGE;
if (argc > 3) {
- state = simple_strtoul(argv[3], &endp, 10);
+ state = dectoul(argv[3], &endp);
if (*argv[3] == 0 || *endp != 0)
return CMD_RET_USAGE;
ret = cros_ec_set_ldo(dev, index, state);
diff --git a/cmd/demo.c b/cmd/demo.c
index a2957f770d..571f562ec6 100644
--- a/cmd/demo.c
+++ b/cmd/demo.c
@@ -106,7 +106,7 @@ static int do_demo(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
if (argc) {
- devnum = simple_strtoul(argv[0], NULL, 10);
+ devnum = dectoul(argv[0], NULL);
ret = uclass_get_device(UCLASS_DEMO, devnum, &demo_dev);
if (ret)
return cmd_process_error(cmdtp, ret);
diff --git a/cmd/exit.c b/cmd/exit.c
index 923f0870fb..2c7132693a 100644
--- a/cmd/exit.c
+++ b/cmd/exit.c
@@ -11,7 +11,7 @@ static int do_exit(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
if (argc > 1)
- return simple_strtoul(argv[1], NULL, 10);
+ return dectoul(argv[1], NULL);
return 0;
}
diff --git a/cmd/flash.c b/cmd/flash.c
index bc93e984bc..819febc10e 100644
--- a/cmd/flash.c
+++ b/cmd/flash.c
@@ -57,7 +57,7 @@ abbrev_spec (char *str, flash_info_t ** pinfo, int *psf, int *psl)
return 0;
*p++ = '\0';
- bank = simple_strtoul (str, &ep, 10);
+ bank = dectoul(str, &ep);
if (ep == str || *ep != '\0' ||
bank < 1 || bank > CONFIG_SYS_MAX_FLASH_BANKS ||
(fp = &flash_info[bank - 1])->flash_id == FLASH_UNKNOWN)
@@ -67,12 +67,12 @@ abbrev_spec (char *str, flash_info_t ** pinfo, int *psf, int *psl)
if ((p = strchr (str, '-')) != NULL)
*p++ = '\0';
- first = simple_strtoul (str, &ep, 10);
+ first = dectoul(str, &ep);
if (ep == str || *ep != '\0' || first >= fp->sector_count)
return -1;
if (p != NULL) {
- last = simple_strtoul (p, &ep, 10);
+ last = dectoul(p, &ep);
if (ep == p || *ep != '\0' ||
last < first || last >= fp->sector_count)
return -1;
diff --git a/cmd/gpio.c b/cmd/gpio.c
index 4fdb3135fc..4150024e62 100644
--- a/cmd/gpio.c
+++ b/cmd/gpio.c
@@ -17,7 +17,7 @@
__weak int name_to_gpio(const char *name)
{
- return simple_strtoul(name, NULL, 10);
+ return dectoul(name, NULL);
}
enum gpio_cmd {
@@ -99,7 +99,7 @@ static int do_gpio_status(bool all, const char *gpio_name)
p = gpio_name + banklen;
if (gpio_name && *p) {
- offset = simple_strtoul(p, NULL, 10);
+ offset = dectoul(p, NULL);
gpio_get_description(dev, bank_name, offset,
&flags, true);
} else {
diff --git a/cmd/gpt.c b/cmd/gpt.c
index 17f2b839d7..f818fbb71f 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -985,7 +985,7 @@ static int do_gpt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
#endif
return CMD_RET_USAGE;
- dev = (int)simple_strtoul(argv[3], &ep, 10);
+ dev = (int)dectoul(argv[3], &ep);
if (!ep || ep[0] != '\0') {
printf("'%s' is not a number\n", argv[3]);
return CMD_RET_USAGE;
diff --git a/cmd/i2c.c b/cmd/i2c.c
index 631222c28f..c7c08c4e32 100644
--- a/cmd/i2c.c
+++ b/cmd/i2c.c
@@ -1079,7 +1079,7 @@ static int do_i2c_loop(struct cmd_tbl *cmdtp, int flag, int argc,
*/
delay = 1000;
if (argc > 3)
- delay = simple_strtoul(argv[4], NULL, 10);
+ delay = dectoul(argv[4], NULL);
/*
* Run the loop...
*/
@@ -1765,7 +1765,7 @@ static int do_i2c_show_bus(struct cmd_tbl *cmdtp, int flag, int argc,
int i;
/* show specific bus */
- i = simple_strtoul(argv[1], NULL, 10);
+ i = dectoul(argv[1], NULL);
#if CONFIG_IS_ENABLED(DM_I2C)
struct udevice *bus;
int ret;
@@ -1833,7 +1833,7 @@ static int do_i2c_bus_num(struct cmd_tbl *cmdtp, int flag, int argc,
#endif
printf("Current bus is %d\n", bus_no);
} else {
- bus_no = simple_strtoul(argv[1], NULL, 10);
+ bus_no = dectoul(argv[1], NULL);
#if defined(CONFIG_SYS_I2C_LEGACY)
if (bus_no >= CONFIG_SYS_NUM_I2C_BUSES) {
printf("Invalid bus %d\n", bus_no);
@@ -1884,7 +1884,7 @@ static int do_i2c_bus_speed(struct cmd_tbl *cmdtp, int flag, int argc,
/* querying current speed */
printf("Current bus speed=%d\n", speed);
} else {
- speed = simple_strtoul(argv[1], NULL, 10);
+ speed = dectoul(argv[1], NULL);
printf("Setting bus speed to %d Hz\n", speed);
#if CONFIG_IS_ENABLED(DM_I2C)
ret = dm_i2c_set_bus_speed(bus, speed);
diff --git a/cmd/led.c b/cmd/led.c
index aa7751933e..48a02baf50 100644
--- a/cmd/led.c
+++ b/cmd/led.c
@@ -93,7 +93,7 @@ int do_led(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (cmd == LEDST_BLINK) {
if (argc < 4)
return CMD_RET_USAGE;
- freq_ms = simple_strtoul(argv[3], NULL, 10);
+ freq_ms = dectoul(argv[3], NULL);
}
#endif
ret = led_get_by_label(led_label, &dev);
diff --git a/cmd/legacy_led.c b/cmd/legacy_led.c
index 86cd969e40..5256255f05 100644
--- a/cmd/legacy_led.c
+++ b/cmd/legacy_led.c
@@ -129,7 +129,7 @@ int do_legacy_led(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc != 4)
return CMD_RET_USAGE;
- freq = simple_strtoul(argv[3], NULL, 10);
+ freq = dectoul(argv[3], NULL);
__led_blink(led_commands[i].mask, freq);
}
/* Need to set only 1 led if led_name wasn't 'all' */
diff --git a/cmd/load.c b/cmd/load.c
index ec3eed18b1..381ed1b3e2 100644
--- a/cmd/load.c
+++ b/cmd/load.c
@@ -70,7 +70,7 @@ static int do_load_serial(struct cmd_tbl *cmdtp, int flag, int argc,
offset = simple_strtol(argv[1], NULL, 16);
}
if (argc == 3) {
- load_baudrate = (int)simple_strtoul(argv[2], NULL, 10);
+ load_baudrate = (int)dectoul(argv[2], NULL);
/* default to current baudrate */
if (load_baudrate == 0)
@@ -264,7 +264,7 @@ int do_save_serial(struct cmd_tbl *cmdtp, int flag, int argc,
size = hextoul(argv[2], NULL);
}
if (argc == 4) {
- save_baudrate = (int)simple_strtoul(argv[3], NULL, 10);
+ save_baudrate = (int)dectoul(argv[3], NULL);
/* default to current baudrate */
if (save_baudrate == 0)
@@ -446,7 +446,7 @@ static int do_load_serial_bin(struct cmd_tbl *cmdtp, int flag, int argc,
offset = hextoul(argv[1], NULL);
}
if (argc == 3) {
- load_baudrate = (int)simple_strtoul(argv[2], NULL, 10);
+ load_baudrate = (int)dectoul(argv[2], NULL);
/* default to current baudrate */
if (load_baudrate == 0)
diff --git a/cmd/log.c b/cmd/log.c
index 72380c5691..c377aee85c 100644
--- a/cmd/log.c
+++ b/cmd/log.c
@@ -352,7 +352,7 @@ static int do_log_rec(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 7)
return CMD_RET_USAGE;
cat = log_get_cat_by_name(argv[1]);
- level = simple_strtoul(argv[2], &end, 10);
+ level = dectoul(argv[2], &end);
if (end == argv[2]) {
level = log_get_level_by_name(argv[2]);
@@ -366,7 +366,7 @@ static int do_log_rec(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
}
file = argv[3];
- line = simple_strtoul(argv[4], NULL, 10);
+ line = dectoul(argv[4], NULL);
func = argv[5];
msg = argv[6];
if (_log(cat, level, file, line, func, "%s\n", msg))
diff --git a/cmd/mbr.c b/cmd/mbr.c
index da2e3a4722..e7e2298096 100644
--- a/cmd/mbr.c
+++ b/cmd/mbr.c
@@ -269,7 +269,7 @@ static int do_mbr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc != 4 && argc != 5)
return CMD_RET_USAGE;
- dev = (int)simple_strtoul(argv[3], &ep, 10);
+ dev = (int)dectoul(argv[3], &ep);
if (!ep || ep[0] != '\0') {
printf("'%s' is not a number\n", argv[3]);
return CMD_RET_USAGE;
diff --git a/cmd/mem.c b/cmd/mem.c
index 0978df5d10..b7511382d3 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -189,7 +189,7 @@ static int do_mem_mdc(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 4)
return CMD_RET_USAGE;
- count = simple_strtoul(argv[3], NULL, 10);
+ count = dectoul(argv[3], NULL);
for (;;) {
do_mem_md (NULL, 0, 3, argv);
@@ -217,7 +217,7 @@ static int do_mem_mwc(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 4)
return CMD_RET_USAGE;
- count = simple_strtoul(argv[3], NULL, 10);
+ count = dectoul(argv[3], NULL);
for (;;) {
do_mem_mw (NULL, 0, 3, argv);
diff --git a/cmd/mmc.c b/cmd/mmc.c
index f72277800a..c67ad76242 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -519,10 +519,10 @@ static int do_mmc_dev(struct cmd_tbl *cmdtp, int flag,
if (argc == 1) {
dev = curr_device;
} else if (argc == 2) {
- dev = simple_strtoul(argv[1], NULL, 10);
+ dev = dectoul(argv[1], NULL);
} else if (argc == 3) {
- dev = (int)simple_strtoul(argv[1], NULL, 10);
- part = (int)simple_strtoul(argv[2], NULL, 10);
+ dev = (int)dectoul(argv[1], NULL);
+ part = (int)dectoul(argv[2], NULL);
if (part > PART_ACCESS_MASK) {
printf("#part_num shouldn't be larger than %d\n",
PART_ACCESS_MASK);
@@ -572,9 +572,9 @@ static int parse_hwpart_user(struct mmc_hwpart_conf *pconf,
if (i + 2 >= argc)
return -1;
pconf->user.enh_start =
- simple_strtoul(argv[i+1], NULL, 10);
+ dectoul(argv[i + 1], NULL);
pconf->user.enh_size =
- simple_strtoul(argv[i+2], NULL, 10);
+ dectoul(argv[i + 2], NULL);
i += 3;
} else if (!strcmp(argv[i], "wrrel")) {
if (i + 1 >= argc)
@@ -603,7 +603,7 @@ static int parse_hwpart_gp(struct mmc_hwpart_conf *pconf, int pidx,
if (1 >= argc)
return -1;
- pconf->gp_part[pidx].size = simple_strtoul(argv[0], NULL, 10);
+ pconf->gp_part[pidx].size = dectoul(argv[0], NULL);
i = 1;
while (i < argc) {
@@ -721,10 +721,10 @@ static int do_mmc_bootbus(struct cmd_tbl *cmdtp, int flag,
if (argc != 5)
return CMD_RET_USAGE;
- dev = simple_strtoul(argv[1], NULL, 10);
- width = simple_strtoul(argv[2], NULL, 10);
- reset = simple_strtoul(argv[3], NULL, 10);
- mode = simple_strtoul(argv[4], NULL, 10);
+ dev = dectoul(argv[1], NULL);
+ width = dectoul(argv[2], NULL);
+ reset = dectoul(argv[3], NULL);
+ mode = dectoul(argv[4], NULL);
mmc = init_mmc_device(dev, false);
if (!mmc)
@@ -785,9 +785,9 @@ static int do_mmc_boot_resize(struct cmd_tbl *cmdtp, int flag,
if (argc != 4)
return CMD_RET_USAGE;
- dev = simple_strtoul(argv[1], NULL, 10);
- bootsize = simple_strtoul(argv[2], NULL, 10);
- rpmbsize = simple_strtoul(argv[3], NULL, 10);
+ dev = dectoul(argv[1], NULL);
+ bootsize = dectoul(argv[2], NULL);
+ rpmbsize = dectoul(argv[3], NULL);
mmc = init_mmc_device(dev, false);
if (!mmc)
@@ -842,7 +842,7 @@ static int do_mmc_partconf(struct cmd_tbl *cmdtp, int flag,
if (argc != 2 && argc != 3 && argc != 5)
return CMD_RET_USAGE;
- dev = simple_strtoul(argv[1], NULL, 10);
+ dev = dectoul(argv[1], NULL);
mmc = init_mmc_device(dev, false);
if (!mmc)
@@ -856,9 +856,9 @@ static int do_mmc_partconf(struct cmd_tbl *cmdtp, int flag,
if (argc == 2 || argc == 3)
return mmc_partconf_print(mmc, argc == 3 ? argv[2] : NULL);
- ack = simple_strtoul(argv[2], NULL, 10);
- part_num = simple_strtoul(argv[3], NULL, 10);
- access = simple_strtoul(argv[4], NULL, 10);
+ ack = dectoul(argv[2], NULL);
+ part_num = dectoul(argv[3], NULL);
+ access = dectoul(argv[4], NULL);
/* acknowledge to be sent during boot operation */
return mmc_set_part_conf(mmc, ack, part_num, access);
@@ -879,8 +879,8 @@ static int do_mmc_rst_func(struct cmd_tbl *cmdtp, int flag,
if (argc != 3)
return CMD_RET_USAGE;
- dev = simple_strtoul(argv[1], NULL, 10);
- enable = simple_strtoul(argv[2], NULL, 10);
+ dev = dectoul(argv[1], NULL);
+ enable = dectoul(argv[2], NULL);
if (enable > 2) {
puts("Invalid RST_n_ENABLE value\n");
@@ -937,7 +937,7 @@ static int do_mmc_bkops_enable(struct cmd_tbl *cmdtp, int flag,
if (argc != 2)
return CMD_RET_USAGE;
- dev = simple_strtoul(argv[1], NULL, 10);
+ dev = dectoul(argv[1], NULL);
mmc = init_mmc_device(dev, false);
if (!mmc)
diff --git a/cmd/mp.c b/cmd/mp.c
index c2b5235a37..8d14401b49 100644
--- a/cmd/mp.c
+++ b/cmd/mp.c
@@ -36,7 +36,7 @@ cpu_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc < 3)
return CMD_RET_USAGE;
- cpuid = simple_strtoul(argv[1], NULL, 10);
+ cpuid = dectoul(argv[1], NULL);
if (!is_core_valid(cpuid)) {
printf ("Core num: %lu is not valid\n", cpuid);
return 1;
diff --git a/cmd/nand.c b/cmd/nand.c
index 34371b983a..d381053c6a 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -424,7 +424,7 @@ static int do_nand(struct cmd_tbl *cmdtp, int flag, int argc,
return 0;
}
- dev = (int)simple_strtoul(argv[2], NULL, 10);
+ dev = (int)dectoul(argv[2], NULL);
set_dev(dev);
return 0;
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 02a99b4a77..ddc715b4f9 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -423,7 +423,7 @@ int do_env_ask(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
* the size. Otherwise we echo it as part of the
* message.
*/
- i = simple_strtoul(argv[argc - 1], &endptr, 10);
+ i = dectoul(argv[argc - 1], &endptr);
if (*endptr != '\0') { /* no size */
size = CONFIG_SYS_CBSIZE - 1;
} else { /* size given */
diff --git a/cmd/optee_rpmb.c b/cmd/optee_rpmb.c
index 0d6b1cb1d8..e0e44bbed0 100644
--- a/cmd/optee_rpmb.c
+++ b/cmd/optee_rpmb.c
@@ -195,7 +195,7 @@ int do_optee_rpmb_read(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
name = argv[1];
- bytes = simple_strtoul(argv[2], &endp, 10);
+ bytes = dectoul(argv[2], &endp);
if (*endp && *endp != '\n')
return CMD_RET_USAGE;
diff --git a/cmd/osd.c b/cmd/osd.c
index 8557894a5d..c8c62d4a2a 100644
--- a/cmd/osd.c
+++ b/cmd/osd.c
@@ -211,7 +211,7 @@ static int do_show_osd(struct cmd_tbl *cmdtp, int flag, int argc,
int i, res;
/* show specific OSD */
- i = simple_strtoul(argv[1], NULL, 10);
+ i = dectoul(argv[1], NULL);
res = uclass_get_device_by_seq(UCLASS_VIDEO_OSD, i, &osd);
if (res) {
@@ -240,7 +240,7 @@ static int do_osd_num(struct cmd_tbl *cmdtp, int flag, int argc,
osd_no = -1;
printf("Current osd is %d\n", osd_no);
} else {
- osd_no = simple_strtoul(argv[1], NULL, 10);
+ osd_no = dectoul(argv[1], NULL);
printf("Setting osd to %d\n", osd_no);
res = cmd_osd_set_osd_num(osd_no);
diff --git a/cmd/pcap.c b/cmd/pcap.c
index c751980c55..ab5c1a7e87 100644
--- a/cmd/pcap.c
+++ b/cmd/pcap.c
@@ -19,7 +19,7 @@ static int do_pcap_init(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
addr = hextoul(argv[1], NULL);
- size = simple_strtoul(argv[2], NULL, 10);
+ size = dectoul(argv[2], NULL);
return pcap_init(addr, size) ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
}
diff --git a/cmd/pstore.c b/cmd/pstore.c
index c6973aeb28..9fac8c7218 100644
--- a/cmd/pstore.c
+++ b/cmd/pstore.c
@@ -279,7 +279,7 @@ static int pstore_display(struct cmd_tbl *cmdtp, int flag, int argc,
- pstore_ftrace_size - pstore_console_size;
if (argc > 2) {
- ptr += simple_strtoul(argv[2], NULL, 10)
+ ptr += dectoul(argv[2], NULL)
* pstore_record_size;
ptr_end = ptr + pstore_record_size;
}
diff --git a/cmd/pwm.c b/cmd/pwm.c
index e1f97c759d..87d840a2b9 100644
--- a/cmd/pwm.c
+++ b/cmd/pwm.c
@@ -66,7 +66,7 @@ static int do_pwm(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
}
- pwm_dev = simple_strtoul(str_pwm, NULL, 10);
+ pwm_dev = dectoul(str_pwm, NULL);
ret = uclass_get_device(UCLASS_PWM, pwm_dev, &dev);
if (ret) {
printf("pwm: '%s' not found\n", str_pwm);
@@ -74,22 +74,22 @@ static int do_pwm(struct cmd_tbl *cmdtp, int flag, int argc,
}
str_channel = *argv;
- channel = simple_strtoul(str_channel, NULL, 10);
+ channel = dectoul(str_channel, NULL);
argc--;
argv++;
if (sub_cmd == PWM_SET_INVERT) {
str_enable = *argv;
- pwm_enable = simple_strtoul(str_enable, NULL, 10);
+ pwm_enable = dectoul(str_enable, NULL);
ret = pwm_set_invert(dev, channel, pwm_enable);
} else if (sub_cmd == PWM_SET_CONFIG) {
str_period = *argv;
argc--;
argv++;
- period_ns = simple_strtoul(str_period, NULL, 10);
+ period_ns = dectoul(str_period, NULL);
str_duty = *argv;
- duty_ns = simple_strtoul(str_duty, NULL, 10);
+ duty_ns = dectoul(str_duty, NULL);
ret = pwm_set_config(dev, channel, period_ns, duty_ns);
} else if (sub_cmd == PWM_SET_ENABLE) {
diff --git a/cmd/remoteproc.c b/cmd/remoteproc.c
index 2a0e575971..ca3b436242 100644
--- a/cmd/remoteproc.c
+++ b/cmd/remoteproc.c
@@ -84,7 +84,7 @@ static int do_rproc_init(struct cmd_tbl *cmdtp, int flag, int argc,
return 0;
printf("Few Remote Processors failed to be initialized\n");
} else if (argc == 2) {
- id = (int)simple_strtoul(argv[1], NULL, 10);
+ id = (int)dectoul(argv[1], NULL);
if (!rproc_dev_init(id))
return 0;
printf("Remote Processor %d failed to be initialized\n", id);
@@ -129,7 +129,7 @@ static int do_remoteproc_load(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 4)
return CMD_RET_USAGE;
- id = (int)simple_strtoul(argv[1], NULL, 10);
+ id = (int)dectoul(argv[1], NULL);
addr = hextoul(argv[2], NULL);
size = hextoul(argv[3], NULL);
@@ -167,7 +167,7 @@ static int do_remoteproc_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 2)
return CMD_RET_USAGE;
- id = (int)simple_strtoul(argv[1], NULL, 10);
+ id = (int)dectoul(argv[1], NULL);
if (!strcmp(argv[0], "start")) {
ret = rproc_start(id);
diff --git a/cmd/rtc.c b/cmd/rtc.c
index 784879ec1a..75d4b64d68 100644
--- a/cmd/rtc.c
+++ b/cmd/rtc.c
@@ -130,7 +130,7 @@ int do_rtc(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
idx = curr_rtc;
if (!strcmp(argv[0], "dev") && argc >= 2)
- idx = simple_strtoul(argv[1], NULL, 10);
+ idx = dectoul(argv[1], NULL);
ret = uclass_get_device(UCLASS_RTC, idx, &dev);
if (ret) {
diff --git a/cmd/sata.c b/cmd/sata.c
index aa396c1bbd..76da1906b7 100644
--- a/cmd/sata.c
+++ b/cmd/sata.c
@@ -88,7 +88,7 @@ static int do_sata(struct cmd_tbl *cmdtp, int flag, int argc,
int devnum = 0;
if (argc == 3)
- devnum = (int)simple_strtoul(argv[2], NULL, 10);
+ devnum = (int)dectoul(argv[2], NULL);
if (!strcmp(argv[1], "stop"))
return sata_remove(devnum);
diff --git a/cmd/sleep.c b/cmd/sleep.c
index 1fff400c79..c741b4aa02 100644
--- a/cmd/sleep.c
+++ b/cmd/sleep.c
@@ -20,7 +20,7 @@ static int do_sleep(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 2)
return CMD_RET_USAGE;
- delay = simple_strtoul(argv[1], NULL, 10) * CONFIG_SYS_HZ;
+ delay = dectoul(argv[1], NULL) * CONFIG_SYS_HZ;
frpart = strchr(argv[1], '.');
diff --git a/cmd/sound.c b/cmd/sound.c
index fdcde36533..f82f2aa670 100644
--- a/cmd/sound.c
+++ b/cmd/sound.c
@@ -41,9 +41,9 @@ static int do_play(struct cmd_tbl *cmdtp, int flag, int argc,
int freq = 400;
if (argc > 1)
- msec = simple_strtoul(argv[1], NULL, 10);
+ msec = dectoul(argv[1], NULL);
if (argc > 2)
- freq = simple_strtoul(argv[2], NULL, 10);
+ freq = dectoul(argv[2], NULL);
ret = uclass_first_device_err(UCLASS_SOUND, &dev);
if (!ret)
diff --git a/cmd/spi.c b/cmd/spi.c
index 4aea191412..bdbdbacecd 100644
--- a/cmd/spi.c
+++ b/cmd/spi.c
@@ -114,20 +114,20 @@ int do_spi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
if (argc >= 2) {
mode = CONFIG_DEFAULT_SPI_MODE;
- bus = simple_strtoul(argv[1], &cp, 10);
+ bus = dectoul(argv[1], &cp);
if (*cp == ':') {
- cs = simple_strtoul(cp+1, &cp, 10);
+ cs = dectoul(cp + 1, &cp);
} else {
cs = bus;
bus = CONFIG_DEFAULT_SPI_BUS;
}
if (*cp == '.')
- mode = simple_strtoul(cp+1, &cp, 10);
+ mode = dectoul(cp + 1, &cp);
if (*cp == '@')
- freq = simple_strtoul(cp+1, &cp, 10);
+ freq = dectoul(cp + 1, &cp);
}
if (argc >= 3)
- bitlen = simple_strtoul(argv[2], NULL, 10);
+ bitlen = dectoul(argv[2], NULL);
if (argc >= 4) {
cp = argv[3];
for(j = 0; *cp; j++, cp++) {
diff --git a/cmd/ti/pd.c b/cmd/ti/pd.c
index 9e820b84ca..008668fd90 100644
--- a/cmd/ti/pd.c
+++ b/cmd/ti/pd.c
@@ -119,8 +119,8 @@ static int do_pd_endis(int argc, char *const argv[], u8 state)
if (!data)
return CMD_RET_FAILURE;
- psc_id = simple_strtoul(argv[1], NULL, 10);
- lpsc_id = simple_strtoul(argv[2], NULL, 10);
+ psc_id = dectoul(argv[1], NULL);
+ lpsc_id = dectoul(argv[2], NULL);
for (i = 0; i < data->num_lpsc; i++) {
lpsc = &data->lpsc[i];
diff --git a/cmd/tpm-common.c b/cmd/tpm-common.c
index a48c060273..1d5442c06f 100644
--- a/cmd/tpm-common.c
+++ b/cmd/tpm-common.c
@@ -302,7 +302,7 @@ int do_tpm_device(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
int rc;
if (argc == 2) {
- num = simple_strtoul(argv[1], NULL, 10);
+ num = dectoul(argv[1], NULL);
rc = tpm_set_device(num);
if (rc)
diff --git a/cmd/ufs.c b/cmd/ufs.c
index 858cd49b59..d4a1e66c1b 100644
--- a/cmd/ufs.c
+++ b/cmd/ufs.c
@@ -16,7 +16,7 @@ static int do_ufs(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc >= 2) {
if (!strcmp(argv[1], "init")) {
if (argc == 3) {
- dev = simple_strtoul(argv[2], NULL, 10);
+ dev = dectoul(argv[2], NULL);
ret = ufs_probe_dev(dev);
if (ret)
return CMD_RET_FAILURE;
diff --git a/cmd/usb.c b/cmd/usb.c
index b9ec29a845..3d87376525 100644
--- a/cmd/usb.c
+++ b/cmd/usb.c
@@ -690,7 +690,7 @@ static int do_usb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
* have multiple controllers and the device numbering
* starts at 1 on each bus.
*/
- i = simple_strtoul(argv[2], NULL, 10);
+ i = dectoul(argv[2], NULL);
printf("config for device %d\n", i);
udev = usb_find_device(i);
if (udev == NULL) {
@@ -706,13 +706,13 @@ static int do_usb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (strncmp(argv[1], "test", 4) == 0) {
if (argc < 5)
return CMD_RET_USAGE;
- i = simple_strtoul(argv[2], NULL, 10);
+ i = dectoul(argv[2], NULL);
udev = usb_find_device(i);
if (udev == NULL) {
printf("Device %d does not exist.\n", i);
return 1;
}
- i = simple_strtoul(argv[3], NULL, 10);
+ i = dectoul(argv[3], NULL);
return usb_test(udev, i, argv[4]);
}
#ifdef CONFIG_USB_STORAGE
diff --git a/cmd/w1.c b/cmd/w1.c
index d0f0ee1234..3209e65f37 100644
--- a/cmd/w1.c
+++ b/cmd/w1.c
@@ -51,16 +51,16 @@ static int w1_read(int argc, char *const argv[])
u8 buf[512];
if (argc > 2)
- bus_n = simple_strtoul(argv[2], NULL, 10);
+ bus_n = dectoul(argv[2], NULL);
if (argc > 3)
- dev_n = simple_strtoul(argv[3], NULL, 10);
+ dev_n = dectoul(argv[3], NULL);
if (argc > 4)
- offset = simple_strtoul(argv[4], NULL, 10);
+ offset = dectoul(argv[4], NULL);
if (argc > 5)
- len = simple_strtoul(argv[5], NULL, 10);
+ len = dectoul(argv[5], NULL);
if (len > 512) {
printf("len needs to be <= 512\n");