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>
This commit is contained in:
Simon Glass 2021-07-24 09:03:30 -06:00 committed by Tom Rini
parent 7e5f460ec4
commit 0b1284eb52
111 changed files with 255 additions and 230 deletions

View File

@ -277,7 +277,7 @@ static unsigned long get_internval_val_mhz(void)
ulong interval_mhz = get_bus_freq(0) / (1000 * 1000);
if (interval)
interval_mhz = simple_strtoul(interval, NULL, 10);
interval_mhz = dectoul(interval, NULL);
return interval_mhz;
}

View File

@ -302,7 +302,7 @@ static int do_dek_blob(struct cmd_tbl *cmdtp, int flag, int argc,
src_addr = hextoul(argv[1], NULL);
dst_addr = hextoul(argv[2], NULL);
len = simple_strtoul(argv[3], NULL, 10);
len = dectoul(argv[3], NULL);
return blob_encap_dek(src_addr, dst_addr, len);
}

View File

@ -72,7 +72,7 @@ static int do_mfgprot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
return CMD_RET_USAGE;
m_addr = hextoul(argv[2], NULL);
m_size = simple_strtoul(argv[3], NULL, 10);
m_size = dectoul(argv[3], NULL);
m_ptr = map_physmem(m_addr, m_size, MAP_NOCACHE);
if (!m_ptr)
return -ENOMEM;

View File

@ -726,7 +726,7 @@ static int do_tamper_pin_cfg(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != (2 + 1))
return CMD_RET_USAGE;
conf.pad = simple_strtoul(argv[++idx], NULL, 10);
conf.pad = dectoul(argv[++idx], NULL);
conf.mux_conf = hextoul(argv[++idx], NULL);
err = apply_tamper_pin_list_config(&conf, 1);

View File

@ -42,9 +42,9 @@ int do_pll_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
else
goto pll_cmd_usage;
cmd_pll_data.pll_m = simple_strtoul(argv[2], NULL, 10);
cmd_pll_data.pll_d = simple_strtoul(argv[3], NULL, 10);
cmd_pll_data.pll_od = simple_strtoul(argv[4], NULL, 10);
cmd_pll_data.pll_m = dectoul(argv[2], NULL);
cmd_pll_data.pll_d = dectoul(argv[3], NULL);
cmd_pll_data.pll_od = dectoul(argv[4], NULL);
printf("Trying to set pll %d; mult %d; div %d; OD %d\n",
cmd_pll_data.pll, cmd_pll_data.pll_m,
@ -72,7 +72,7 @@ int do_getclk_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 2)
goto getclk_cmd_usage;
clk = simple_strtoul(argv[1], NULL, 10);
clk = dectoul(argv[1], NULL);
freq = ks_clk_get_rate(clk);
if (freq)
@ -101,7 +101,7 @@ int do_psc_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc != 3)
goto psc_cmd_usage;
psc_module = simple_strtoul(argv[1], NULL, 10);
psc_module = dectoul(argv[1], NULL);
if (strcmp(argv[2], "en") == 0) {
res = psc_enable_module(psc_module);
printf("psc_enable_module(%d) - %s\n", psc_module,

View File

@ -125,7 +125,7 @@ static void kw_sysrst_check(void)
return;
/* read sysrstdelay value */
sysrst_dly = (u32) simple_strtoul(s, NULL, 10);
sysrst_dly = (u32)dectoul(s, NULL);
/* read SysRst Length counter register (bits 28:0) */
sysrst_cnt = (0x1fffffff & readl(KW_REG_SYSRST_CNT));

View File

@ -592,7 +592,7 @@ struct clk *clk_get(const char *id)
c = strrchr((const char *)str, (int)'.');
if (!c || !cdev->peri)
break;
devid = simple_strtoul(++c, NULL, 10);
devid = dectoul(++c, NULL);
if (cdev->peri->dev_id == devid)
break;
}

View File

@ -59,7 +59,7 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
}
dev = (int)simple_strtoul(argv[2], NULL, 10);
dev = (int)dectoul(argv[2], NULL);
addr = STM32_DDR_BASE;
size = 0;

View File

@ -253,7 +253,7 @@ static int parse_type(struct stm32prog_data *data,
result = -EINVAL;
else
part->bin_nb =
simple_strtoul(&p[7], NULL, 10);
dectoul(&p[7], NULL);
}
} else if (!strcmp(p, "System")) {
part->part_type = PART_SYSTEM;

View File

@ -138,7 +138,7 @@ int do_ecc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
if (argc == 3) {
if (strcmp(argv[1], "sbecnt") == 0) {
val = simple_strtoul(argv[2], NULL, 10);
val = dectoul(argv[2], NULL);
if (val > 255) {
printf("Incorrect Counter value, "
"should be 0..255\n");
@ -151,7 +151,7 @@ int do_ecc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
ddr->err_sbe = val;
return 0;
} else if (strcmp(argv[1], "sbethr") == 0) {
val = simple_strtoul(argv[2], NULL, 10);
val = dectoul(argv[2], NULL);
if (val > 255) {
printf("Incorrect Counter value, "
"should be 0..255\n");

View File

@ -52,7 +52,7 @@ void spi_set_speed(struct spi_slave *slave, uint hz)
*/
int name_to_gpio(const char *name)
{
int gpio = 31 - simple_strtoul(name, NULL, 10);
int gpio = 31 - dectoul(name, NULL);
if (gpio < 16)
gpio = -1;

View File

@ -194,13 +194,13 @@ int drv_video_init(void)
printf("Init Video as ");
s = env_get("displaywidth");
if (s != NULL)
display_width = simple_strtoul(s, NULL, 10);
display_width = dectoul(s, NULL);
else
display_width = 256;
s = env_get("displayheight");
if (s != NULL)
display_height = simple_strtoul(s, NULL, 10);
display_height = dectoul(s, NULL);
else
display_height = 256;
@ -234,8 +234,8 @@ int do_brightness(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
switch (argc) {
case 3:
side = simple_strtoul(argv[1], NULL, 10);
bright = simple_strtoul(argv[2], NULL, 10);
side = dectoul(argv[1], NULL);
bright = dectoul(argv[2], NULL);
if ((side >= 0) && (side <= 3) &&
(bright >= 0) && (bright <= 1000)) {
vcxk_setbrightness(side, bright);

View File

@ -47,7 +47,7 @@ void at91_pda_detect(void)
break;
}
}
pda = simple_strtoul((const char *)buf, NULL, 10);
pda = dectoul((const char *)buf, NULL);
switch (pda) {
case 7000:

View File

@ -236,47 +236,47 @@ int do_atf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if ((argc == 5) && !strcmp(argv[1], "readmmc")) {
buffer = (void *)hextoul(argv[2], NULL);
offset = simple_strtoul(argv[3], NULL, 10);
size = simple_strtoul(argv[4], NULL, 10);
offset = dectoul(argv[3], NULL);
size = dectoul(argv[4], NULL);
ret = atf_read_mmc(offset, buffer, size);
} else if ((argc == 5) && !strcmp(argv[1], "readnor")) {
buffer = (void *)hextoul(argv[2], NULL);
offset = simple_strtoul(argv[3], NULL, 10);
size = simple_strtoul(argv[4], NULL, 10);
offset = dectoul(argv[3], NULL);
size = dectoul(argv[4], NULL);
ret = atf_read_nor(offset, buffer, size);
} else if ((argc == 5) && !strcmp(argv[1], "writemmc")) {
buffer = (void *)hextoul(argv[2], NULL);
offset = simple_strtoul(argv[3], NULL, 10);
size = simple_strtoul(argv[4], NULL, 10);
offset = dectoul(argv[3], NULL);
size = dectoul(argv[4], NULL);
ret = atf_write_mmc(offset, buffer, size);
} else if ((argc == 5) && !strcmp(argv[1], "writenor")) {
buffer = (void *)hextoul(argv[2], NULL);
offset = simple_strtoul(argv[3], NULL, 10);
size = simple_strtoul(argv[4], NULL, 10);
offset = dectoul(argv[3], NULL);
size = dectoul(argv[4], NULL);
ret = atf_write_nor(offset, buffer, size);
} else if ((argc == 2) && !strcmp(argv[1], "part")) {
atf_print_part_table();
} else if ((argc == 4) && !strcmp(argv[1], "erasenor")) {
offset = simple_strtoul(argv[2], NULL, 10);
size = simple_strtoul(argv[3], NULL, 10);
offset = dectoul(argv[2], NULL);
size = dectoul(argv[3], NULL);
ret = atf_erase_nor(offset, size);
} else if ((argc == 2) && !strcmp(argv[1], "envcount")) {
ret = atf_env_count();
printf("Number of environment strings: %zd\n", ret);
} else if ((argc == 3) && !strcmp(argv[1], "envstring")) {
index = simple_strtoul(argv[2], NULL, 10);
index = dectoul(argv[2], NULL);
ret = atf_env_string(index, str);
if (ret > 0)
printf("Environment string %d: %s\n", index, str);
else
printf("Return code: %zd\n", ret);
} else if ((argc == 3) && !strcmp(argv[1], "dramsize")) {
node = simple_strtoul(argv[2], NULL, 10);
node = dectoul(argv[2], NULL);
ret = atf_dram_size(node);
printf("DRAM size: %zd Mbytes\n", ret >> 20);
} else if ((argc == 2) && !strcmp(argv[1], "nodes")) {

View File

@ -153,7 +153,7 @@ u32 cl_eeprom_get_board_rev(uint eeprom_bus)
*/
if (cl_eeprom_layout == LAYOUT_LEGACY) {
sprintf(str, "%x", board_rev);
board_rev = simple_strtoul(str, NULL, 10);
board_rev = dectoul(str, NULL);
}
return board_rev;

View File

@ -244,7 +244,7 @@ static int parse_pixclock(char *pixclock)
int divisor, pixclock_val;
char *pixclk_start = pixclock;
pixclock_val = simple_strtoul(pixclock, &pixclock, 10);
pixclock_val = dectoul(pixclock, &pixclock);
divisor = DIV_ROUND_UP(PIXEL_CLK_NUMERATOR, pixclock_val);
/* 0 and 1 are illegal values for PCD */
if (divisor <= 1)

View File

@ -284,7 +284,7 @@ u32 get_board_rev(void)
s = env_get("maxcpuclk");
if (s)
maxcpuclk = simple_strtoul(s, NULL, 10);
maxcpuclk = dectoul(s, NULL);
if (maxcpuclk >= 456000000)
rev = 3;

View File

@ -403,10 +403,10 @@ static unsigned long strfractoint(char *strptr)
mulconst = 1;
for (i = 0; i < j; i++)
mulconst *= 10;
decval = simple_strtoul(decarr, NULL, 10);
decval = dectoul(decarr, NULL);
}
intval = simple_strtoul(intarr, NULL, 10);
intval = dectoul(intarr, NULL);
intval = intval * mulconst;
return intval + decval;
@ -489,9 +489,9 @@ static int pixis_reset_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
unsigned long corepll;
unsigned long mpxpll;
sysclk = simple_strtoul(p_cf_sysclk, NULL, 10);
sysclk = dectoul(p_cf_sysclk, NULL);
corepll = strfractoint(p_cf_corepll);
mpxpll = simple_strtoul(p_cf_mpxpll, NULL, 10);
mpxpll = dectoul(p_cf_mpxpll, NULL);
if (!(set_px_sysclk(sysclk)
&& set_px_corepll(corepll)

View File

@ -456,7 +456,7 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
update_crc();
break;
case '0' ... '9': /* "mac 0" through "mac 22" */
set_mac_address(simple_strtoul(argv[1], NULL, 10), argv[2]);
set_mac_address(dectoul(argv[1], NULL), argv[2]);
break;
case 'h': /* help */
default:

View File

@ -277,7 +277,7 @@ static int do_gsc_sleep(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 2)
return CMD_RET_USAGE;
secs = simple_strtoul(argv[1], NULL, 10);
secs = dectoul(argv[1], NULL);
printf("GSC Sleeping for %ld seconds\n", secs);
i2c_set_bus_num(0);
@ -322,7 +322,7 @@ static int do_gsc_wd(struct cmd_tbl *cmdtp, int flag, int argc,
int timeout = 0;
if (argc > 2)
timeout = simple_strtoul(argv[2], NULL, 10);
timeout = dectoul(argv[2], NULL);
i2c_set_bus_num(0);
if (gsc_i2c_read(GSC_SC_ADDR, GSC_SC_CTRL1, 1, &reg, 1))
return CMD_RET_FAILURE;

View File

@ -471,7 +471,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
if (serial) {
serialnr->high = 0;
serialnr->low = simple_strtoul(serial, NULL, 10);
serialnr->low = dectoul(serial, NULL);
} else if (ventana_info.model[0]) {
serialnr->high = 0;
serialnr->low = ventana_info.serial;

View File

@ -660,7 +660,7 @@ static int do_gsc(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]
if (strcasecmp(argv[1], "sleep") == 0) {
if (argc < 3)
return CMD_RET_USAGE;
if (!gsc_sleep(simple_strtoul(argv[2], NULL, 10)))
if (!gsc_sleep(dectoul(argv[2], NULL)))
return CMD_RET_SUCCESS;
} else if (strcasecmp(argv[1], "hwmon") == 0) {
if (!gsc_hwmon())

View File

@ -275,13 +275,13 @@ int do_ioreflect(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc < 2)
return CMD_RET_USAGE;
fpga = simple_strtoul(argv[1], NULL, 10);
fpga = dectoul(argv[1], NULL);
/*
* If another parameter, it is the report rate in packets.
*/
if (argc > 2)
rate = simple_strtoul(argv[2], NULL, 10);
rate = dectoul(argv[2], NULL);
/* Enable receive path */
FPGA_SET_REG(fpga, ep.rx_tx_control, CTRL_PROC_RECEIVE_ENABLE);
@ -388,18 +388,18 @@ int do_ioloop(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
/*
* FPGA is specified since argc > 2
*/
fpga = simple_strtoul(argv[1], NULL, 10);
fpga = dectoul(argv[1], NULL);
/*
* packet size is specified since argc > 2
*/
size = simple_strtoul(argv[2], NULL, 10);
size = dectoul(argv[2], NULL);
/*
* If another parameter, it is the test rate in packets per second.
*/
if (argc > 3)
rate = simple_strtoul(argv[3], NULL, 10);
rate = dectoul(argv[3], NULL);
/* enable receive path */
FPGA_SET_REG(fpga, ep.rx_tx_control, CTRL_PROC_RECEIVE_ENABLE);
@ -463,13 +463,13 @@ int do_ioloop(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
/*
* packet size is specified since argc > 1
*/
size = simple_strtoul(argv[2], NULL, 10);
size = dectoul(argv[2], NULL);
/*
* If another parameter, it is the test rate in packets per second.
*/
if (argc > 2)
rate = simple_strtoul(argv[3], NULL, 10);
rate = dectoul(argv[3], NULL);
/* Enable receive path */
misc_set_enabled(dev, true);
@ -514,7 +514,7 @@ int do_iodev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return CMD_RET_FAILURE;
if (argc > 1) {
int i = simple_strtoul(argv[1], NULL, 10);
int i = dectoul(argv[1], NULL);
snprintf(name, sizeof(name), "ioep%d", i);

View File

@ -169,7 +169,7 @@ char *get_dfu_alt_boot(char *interface, char *devstr)
if (board_is_odroidxu4() || board_is_odroidhc1() || board_is_odroidhc2())
return info;
dev_num = simple_strtoul(devstr, NULL, 10);
dev_num = dectoul(devstr, NULL);
mmc = find_mmc_device(dev_num);
if (!mmc)

View File

@ -85,7 +85,7 @@ char *get_dfu_alt_boot(char *interface, char *devstr)
char *alt_boot;
int dev_num;
dev_num = simple_strtoul(devstr, NULL, 10);
dev_num = dectoul(devstr, NULL);
mmc = find_mmc_device(dev_num);
if (!mmc)

View File

@ -394,10 +394,9 @@ static int do_upgrade_available(struct cmd_tbl *cmdtp, int flag, int argc,
unsigned long boot_retry = 0;
char boot_buf[10];
upgrade_available = simple_strtoul(env_get("upgrade_available"), NULL,
10);
upgrade_available = dectoul(env_get("upgrade_available"), NULL);
if (upgrade_available) {
boot_retry = simple_strtoul(env_get("boot_retries"), NULL, 10);
boot_retry = dectoul(env_get("boot_retries"), NULL);
boot_retry++;
sprintf(boot_buf, "%lx", boot_retry);
env_set("boot_retries", boot_buf);

View File

@ -324,7 +324,7 @@ static void set_pcb_revision(char *string)
{
unsigned long p;
p = simple_strtoul(string, &string, 10);
p = dectoul(string, &string);
if (p > U8_MAX) {
printf("%s must not be greater than %d\n", "PCB revision",
U8_MAX);
@ -366,7 +366,7 @@ static void set_bom_variant(char *string)
{
unsigned long p;
p = simple_strtoul(string, &string, 10);
p = dectoul(string, &string);
if (p > U8_MAX) {
printf("%s must not be greater than %d\n", "BOM variant",
U8_MAX);
@ -389,7 +389,7 @@ static void set_product_id(char *string)
{
unsigned long p;
p = simple_strtoul(string, &string, 10);
p = dectoul(string, &string);
if (p > U16_MAX) {
printf("%s must not be greater than %d\n", "Product ID",
U16_MAX);

View File

@ -254,7 +254,7 @@ static int arg_read_set(const struct env_map_common *map, u32 i, int argc,
if (map[i].type == ENV_HEX)
map[i].val->val = hextoul(argv[1], &endp);
else
map[i].val->val = simple_strtoul(argv[1], &endp, 10);
map[i].val->val = dectoul(argv[1], &endp);
map[i].val->set = true;

View File

@ -548,7 +548,7 @@ static int get_cfgblock_interactive(void)
len = cli_readline(message);
}
tdx_serial = simple_strtoul(console_buffer, NULL, 10);
tdx_serial = dectoul(console_buffer, NULL);
return 0;
}
@ -566,14 +566,14 @@ static int get_cfgblock_barcode(char *barcode, struct toradex_hw *tag,
/* Get hardware information from the first 8 digits */
tag->ver_major = barcode[4] - '0';
tag->ver_minor = barcode[5] - '0';
tag->ver_assembly = simple_strtoul(revision, NULL, 10);
tag->ver_assembly = dectoul(revision, NULL);
barcode[4] = '\0';
tag->prodid = simple_strtoul(barcode, NULL, 10);
tag->prodid = dectoul(barcode, NULL);
/* Parse second part of the barcode (serial number */
barcode += 8;
*serial = simple_strtoul(barcode, NULL, 10);
*serial = dectoul(barcode, NULL);
return 0;
}
@ -710,7 +710,7 @@ int try_migrate_tdx_cfg_block_carrier(void)
tdx_car_hw_tag.ver_assembly = pid8[7] - '0';
pid8[4] = '\0';
tdx_car_hw_tag.prodid = simple_strtoul(pid8, NULL, 10);
tdx_car_hw_tag.prodid = dectoul(pid8, NULL);
/* Valid Tag */
write_tag(config_block, &offset, TAG_VALID, NULL, 0);
@ -754,7 +754,7 @@ static int get_cfgblock_carrier_interactive(void)
sprintf(message, "Choose your carrier board (provide ID): ");
len = cli_readline(message);
tdx_car_hw_tag.prodid = simple_strtoul(console_buffer, NULL, 10);
tdx_car_hw_tag.prodid = dectoul(console_buffer, NULL);
do {
sprintf(message, "Enter carrier board version (e.g. V1.1B): V");
@ -770,7 +770,7 @@ static int get_cfgblock_carrier_interactive(void)
len = cli_readline(message);
}
tdx_car_serial = simple_strtoul(console_buffer, NULL, 10);
tdx_car_serial = dectoul(console_buffer, NULL);
return 0;
}

View File

@ -368,7 +368,7 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
update_crc();
break;
case '0' ... '9': /* "mac 0" through "mac 22" */
set_mac_address(simple_strtoul(argv[1], NULL, 10), argv[2]);
set_mac_address(dectoul(argv[1], NULL), argv[2]);
break;
case 'h': /* help */
default:

View File

@ -233,8 +233,7 @@ void work_92105_display_init(void)
/* set display contrast */
display_contrast_str = env_get("fwopt_dispcontrast");
if (display_contrast_str)
display_contrast = simple_strtoul(display_contrast_str,
NULL, 10);
display_contrast = dectoul(display_contrast_str, NULL);
i2c_write(0x2c, 0x00, 1, &display_contrast, 1);
/* request GPO_15 as an output initially set to 1 */

View File

@ -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;

View File

@ -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:

View File

@ -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);

View File

@ -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);

View File

@ -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",

View File

@ -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;

View File

@ -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]);

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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 {

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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' */

View File

@ -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)

View File

@ -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))

View File

@ -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;

View File

@ -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);

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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 */

View File

@ -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;

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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) {

View File

@ -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);

View File

@ -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) {

View File

@ -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);

View File

@ -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], '.');

View File

@ -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)

View File

@ -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++) {

View File

@ -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];

View File

@ -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)

View File

@ -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;

View File

@ -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

View File

@ -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");

View File

@ -1007,7 +1007,7 @@ long read_number (char *txt)
if (txt[0] == '0' && (txt[1] == 'x' || txt[1] == 'X')) /* hex */
val = hextoul(&txt[2], NULL);
else /* decimal */
val = simple_strtoul (txt, NULL, 10);
val = dectoul(txt, NULL);
if (is_neg)
val = -val;

View File

@ -229,8 +229,8 @@ static int do_lcd_setcursor(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 3)
return CMD_RET_USAGE;
col = simple_strtoul(argv[1], NULL, 10);
row = simple_strtoul(argv[2], NULL, 10);
col = dectoul(argv[1], NULL);
row = dectoul(argv[2], NULL);
lcd_position_cursor(col, row);
return 0;

View File

@ -135,7 +135,7 @@ struct rigid_disk_block *get_rdisk(struct blk_desc *dev_desc)
s = env_get("amiga_scanlimit");
if (s)
limit = simple_strtoul(s, NULL, 10);
limit = dectoul(s, NULL);
else
limit = AMIGA_BLOCK_LIMIT;
@ -175,7 +175,7 @@ struct bootcode_block *get_bootcode(struct blk_desc *dev_desc)
s = env_get("amiga_scanlimit");
if (s)
limit = simple_strtoul(s, NULL, 10);
limit = dectoul(s, NULL);
else
limit = AMIGA_BLOCK_LIMIT;

View File

@ -348,7 +348,7 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s)
const char *argv[3];
const char **parg = argv;
dfu->data.mmc.dev_num = simple_strtoul(devstr, NULL, 10);
dfu->data.mmc.dev_num = dectoul(devstr, NULL);
for (; parg < argv + sizeof(argv) / sizeof(*argv); ++parg) {
*parg = strsep(&s, " ");

View File

@ -279,7 +279,7 @@ int dfu_fill_entity_mtd(struct dfu_entity *dfu, char *devstr, char *s)
dfu->layout = DFU_RAW_ADDR;
part = simple_strtoul(s, &s, 10);
part = dectoul(s, &s);
sprintf(mtd_id, "%s,%d", devstr, part - 1);
printf("using id '%s'\n", mtd_id);

View File

@ -215,9 +215,9 @@ int dfu_fill_entity_nand(struct dfu_entity *dfu, char *devstr, char *s)
dfu->layout = DFU_RAW_ADDR;
dev = simple_strtoul(s, &s, 10);
dev = dectoul(s, &s);
s++;
part = simple_strtoul(s, &s, 10);
part = dectoul(s, &s);
sprintf(mtd_id, "%s%d,%d", "nand", dev, part - 1);
debug("using id '%s'\n", mtd_id);

View File

@ -184,9 +184,9 @@ int dfu_fill_entity_sf(struct dfu_entity *dfu, char *devstr, char *s)
dfu->layout = DFU_RAW_ADDR;
dev = simple_strtoul(s, &s, 10);
dev = dectoul(s, &s);
s++;
part = simple_strtoul(s, &s, 10);
part = dectoul(s, &s);
sprintf(mtd_id, "%s%d,%d", "nor", dev, part - 1);
printf("using id '%s'\n", mtd_id);

View File

@ -38,7 +38,7 @@ int dfu_fill_entity_virt(struct dfu_entity *dfu, char *devstr, char *s)
dfu->dev_type = DFU_DEV_VIRT;
dfu->layout = DFU_RAW_ADDR;
dfu->data.virt.dev_num = simple_strtoul(devstr, NULL, 10);
dfu->data.virt.dev_num = dectoul(devstr, NULL);
dfu->write_medium = dfu_write_medium_virt;
dfu->get_medium_size = dfu_get_medium_size_virt;

View File

@ -122,7 +122,7 @@ int dm_gpio_lookup_name(const char *name, struct gpio_desc *desc)
int numeric;
int ret;
numeric = isdigit(*name) ? simple_strtoul(name, NULL, 10) : -1;
numeric = isdigit(*name) ? dectoul(name, NULL) : -1;
for (ret = uclass_first_device(UCLASS_GPIO, &dev);
dev;
ret = uclass_next_device(&dev)) {

View File

@ -123,12 +123,12 @@ int name_to_gpio(const char *name)
unsigned bank, pin;
char *end;
bank = simple_strtoul(name, &end, 10);
bank = dectoul(name, &end);
if (!*end || *end != ':')
return bank;
pin = simple_strtoul(end + 1, NULL, 10);
pin = dectoul(end + 1, NULL);
return (bank << MXS_PAD_BANK_SHIFT) | (pin << MXS_PAD_PIN_SHIFT);
}

View File

@ -262,11 +262,11 @@ static int do_tca642x(struct cmd_tbl *cmdtp, int flag, int argc,
/* arg2 used as chip number or pin number */
if (argc > 2)
ul_arg2 = simple_strtoul(argv[2], NULL, 10);
ul_arg2 = dectoul(argv[2], NULL);
/* arg3 used as pin or invert value */
if (argc > 3)
ul_arg3 = simple_strtoul(argv[3], NULL, 10) & 0x1;
ul_arg3 = dectoul(argv[3], NULL) & 0x1;
switch ((int)c->cmd) {
case TCA642X_CMD_INFO:

View File

@ -5796,7 +5796,7 @@ static int do_e1000(struct cmd_tbl *cmdtp, int flag, int argc,
}
/* Make sure we can find the requested e1000 card */
cardnum = simple_strtoul(argv[1], NULL, 10);
cardnum = dectoul(argv[1], NULL);
#ifdef CONFIG_DM_ETH
e1000_name(name, cardnum);
ret = uclass_get_device_by_name(UCLASS_ETH, name, &dev);

View File

@ -642,7 +642,7 @@ static unsigned long get_mc_boot_timeout_ms(void)
char *timeout_ms_env_var = env_get(MC_BOOT_TIMEOUT_ENV_VAR);
if (timeout_ms_env_var) {
timeout_ms = simple_strtoul(timeout_ms_env_var, NULL, 10);
timeout_ms = dectoul(timeout_ms_env_var, NULL);
if (timeout_ms == 0) {
printf("fsl-mc: WARNING: Invalid value for \'"
MC_BOOT_TIMEOUT_ENV_VAR

View File

@ -87,7 +87,7 @@ static int refresh_settings_from_env(void)
return -1; /* ncip is 0.0.0.0 */
p = strchr(env_get("ncip"), ':');
if (p != NULL) {
nc_out_port = simple_strtoul(p + 1, NULL, 10);
nc_out_port = dectoul(p + 1, NULL);
nc_in_port = nc_out_port;
}
} else {
@ -96,10 +96,10 @@ static int refresh_settings_from_env(void)
p = env_get("ncoutport");
if (p != NULL)
nc_out_port = simple_strtoul(p, NULL, 10);
nc_out_port = dectoul(p, NULL);
p = env_get("ncinport");
if (p != NULL)
nc_in_port = simple_strtoul(p, NULL, 10);
nc_in_port = dectoul(p, NULL);
if (is_broadcast(nc_ip))
/* broadcast MAC address */

View File

@ -298,7 +298,7 @@ int pfe_firmware_init(void)
if (!p) {
max_fw_count = 2;
} else {
max_fw_count = simple_strtoul(p, NULL, 10);
max_fw_count = dectoul(p, NULL);
if (max_fw_count)
max_fw_count = 3;
else

View File

@ -648,7 +648,7 @@ int do_b53_reg_read(const char *name, int argc, char *const argv[])
page = hextoul(argv[1], NULL);
offset = hextoul(argv[2], NULL);
width = simple_strtoul(argv[3], NULL, 10);
width = dectoul(argv[3], NULL);
switch (width) {
case 8:
@ -700,7 +700,7 @@ int do_b53_reg_write(const char *name, int argc, char *const argv[])
page = hextoul(argv[1], NULL);
offset = hextoul(argv[2], NULL);
width = simple_strtoul(argv[3], NULL, 10);
width = dectoul(argv[3], NULL);
if (width == 48 || width == 64)
value64 = simple_strtoull(argv[4], NULL, 16);
else

View File

@ -238,9 +238,9 @@ int do_mvsw_reg_read(const char *name, int argc, char *const argv[])
u16 value = 0, phyaddr, reg, port;
int ret;
phyaddr = simple_strtoul(argv[1], NULL, 10);
port = simple_strtoul(argv[2], NULL, 10);
reg = simple_strtoul(argv[3], NULL, 10);
phyaddr = dectoul(argv[1], NULL);
port = dectoul(argv[2], NULL);
reg = dectoul(argv[3], NULL);
ret = sw_reg_read(name, phyaddr, port, reg, &value);
printf("%#x\n", value);
@ -253,9 +253,9 @@ int do_mvsw_reg_write(const char *name, int argc, char *const argv[])
u16 value = 0, phyaddr, reg, port;
int ret;
phyaddr = simple_strtoul(argv[1], NULL, 10);
port = simple_strtoul(argv[2], NULL, 10);
reg = simple_strtoul(argv[3], NULL, 10);
phyaddr = dectoul(argv[1], NULL);
port = dectoul(argv[2], NULL);
reg = dectoul(argv[3], NULL);
value = hextoul(argv[4], NULL);
ret = sw_reg_write(name, phyaddr, port, reg, value);

View File

@ -938,7 +938,7 @@ enum qe_clock qe_clock_source(const char *source)
return QE_CLK_NONE;
if (strncasecmp(source, "brg", 3) == 0) {
i = simple_strtoul(source + 3, NULL, 10);
i = dectoul(source + 3, NULL);
if (i >= 1 && i <= 16)
return (QE_BRG1 - 1) + i;
else
@ -946,7 +946,7 @@ enum qe_clock qe_clock_source(const char *source)
}
if (strncasecmp(source, "clk", 3) == 0) {
i = simple_strtoul(source + 3, NULL, 10);
i = dectoul(source + 3, NULL);
if (i >= 1 && i <= 24)
return (QE_CLK1 - 1) + i;
else

View File

@ -34,7 +34,7 @@ unsigned long pin_to_bank_base(struct udevice *dev, const char *pin_name,
idx++;
}
bank[idx] = '\0';
*pin = (u32)simple_strtoul(&pin_name[++idx], NULL, 10);
*pin = (u32)dectoul(&pin_name[++idx], NULL);
/* lookup the pin bank data using the pin bank name */
for (idx = 0; idx < nr_banks; idx++)

View File

@ -69,7 +69,7 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
* If statename is not found in "pinctrl-names",
* assume statename is just the integer state ID.
*/
state = simple_strtoul(statename, &end, 10);
state = dectoul(statename, &end);
if (*end)
return -EINVAL;
}

View File

@ -2544,7 +2544,7 @@ try_again:
eptr = env_get("limit_dram_mbytes");
if (eptr) {
unsigned int mbytes = simple_strtoul(eptr, NULL, 10);
unsigned int mbytes = dectoul(eptr, NULL);
if (mbytes > 0) {
memsize_mbytes = mbytes;

View File

@ -395,7 +395,7 @@ static int on_baudrate(const char *name, const char *value, enum env_op op,
/*
* Switch to new baudrate if new baudrate is supported
*/
baudrate = simple_strtoul(value, NULL, 10);
baudrate = dectoul(value, NULL);
/* Not actually changing */
if (gd->baudrate == baudrate)

View File

@ -61,7 +61,7 @@ static int on_baudrate(const char *name, const char *value, enum env_op op,
/*
* Switch to new baudrate if new baudrate is supported
*/
baudrate = simple_strtoul(value, NULL, 10);
baudrate = dectoul(value, NULL);
/* Not actually changing */
if (gd->baudrate == baudrate)

View File

@ -1659,7 +1659,7 @@ cdns3_endpoint *cdns3_find_available_ep(struct cdns3_device *priv_dev,
/* ep name pattern likes epXin or epXout */
char c[2] = {ep->name[2], '\0'};
num = simple_strtoul(c, NULL, 10);
num = dectoul(c, NULL);
priv_ep = ep_to_cdns3_ep(ep);
if (cdns3_ep_dir_is_correct(desc, priv_ep)) {

View File

@ -144,7 +144,7 @@ static int ep_matches(
/* report address */
if (isdigit(ep->name[2])) {
u8 num = simple_strtoul(&ep->name[2], NULL, 10);
u8 num = dectoul(&ep->name[2], NULL);
desc->bEndpointAddress |= num;
#ifdef MANY_ENDPOINTS
} else if (desc->bEndpointAddress & USB_DIR_IN) {

View File

@ -2401,8 +2401,7 @@ static int _usb_eth_init(struct ether_priv *priv)
usb_gadget_connect(gadget);
if (env_get("cdc_connect_timeout"))
timeout = simple_strtoul(env_get("cdc_connect_timeout"),
NULL, 10) * CONFIG_SYS_HZ;
timeout = dectoul(env_get("cdc_connect_timeout"), NULL) * CONFIG_SYS_HZ;
ts = get_timer(0);
while (!dev->network_started) {
/* Handle control-c and timeouts */

View File

@ -692,8 +692,8 @@ static int do_video_setcursor(struct cmd_tbl *cmdtp, int flag, int argc,
if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev))
return CMD_RET_FAILURE;
col = simple_strtoul(argv[1], NULL, 10);
row = simple_strtoul(argv[2], NULL, 10);
col = dectoul(argv[1], NULL);
row = dectoul(argv[2], NULL);
vidconsole_position_cursor(dev, col, row);
return 0;

View File

@ -141,11 +141,12 @@ int atmel_df_pow2(int argc, char *const argv[])
if (line[0] == '\0')
continue;
bus = cs = simple_strtoul(line, &p, 10);
bus = dectoul(line, &p);
cs = bus;
if (*p) {
if (*p == ':') {
++p;
cs = simple_strtoul(p, &p, 10);
cs = dectoul(p, &p);
}
if (*p) {
puts("invalid format, please try again\n");

Some files were not shown because too many files have changed in this diff Show More