summaryrefslogtreecommitdiff
path: root/board
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 /board
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 'board')
-rw-r--r--board/Arcturus/ucp1020/ucp1020.c2
-rw-r--r--board/BuS/eb_cpu5282/eb_cpu5282.c8
-rw-r--r--board/atmel/common/board.c2
-rw-r--r--board/cavium/thunderx/atf.c24
-rw-r--r--board/compulab/common/eeprom.c2
-rw-r--r--board/compulab/common/omap3_display.c2
-rw-r--r--board/davinci/da8xxevm/da850evm.c2
-rw-r--r--board/freescale/common/pixis.c8
-rw-r--r--board/freescale/common/sys_eeprom.c2
-rw-r--r--board/gateworks/gw_ventana/gsc.c4
-rw-r--r--board/gateworks/gw_ventana/gw_ventana.c2
-rw-r--r--board/gateworks/venice/gsc.c2
-rw-r--r--board/gdsys/common/cmd_ioloop.c16
-rw-r--r--board/samsung/common/exynos5-dt.c2
-rw-r--r--board/samsung/odroid/odroid.c2
-rw-r--r--board/siemens/taurus/taurus.c5
-rw-r--r--board/sifive/unmatched/hifive-platform-i2c-eeprom.c6
-rw-r--r--board/synopsys/hsdk/env-lib.c2
-rw-r--r--board/toradex/common/tdx-cfg-block.c14
-rw-r--r--board/varisys/common/sys_eeprom.c2
-rw-r--r--board/work-microwave/work_92105/work_92105_display.c3
21 files changed, 55 insertions, 57 deletions
diff --git a/board/Arcturus/ucp1020/ucp1020.c b/board/Arcturus/ucp1020/ucp1020.c
index 24d1d57ec4..ee8a9e0a5e 100644
--- a/board/Arcturus/ucp1020/ucp1020.c
+++ b/board/Arcturus/ucp1020/ucp1020.c
@@ -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;
diff --git a/board/BuS/eb_cpu5282/eb_cpu5282.c b/board/BuS/eb_cpu5282/eb_cpu5282.c
index 5829299663..b739bc3ca6 100644
--- a/board/BuS/eb_cpu5282/eb_cpu5282.c
+++ b/board/BuS/eb_cpu5282/eb_cpu5282.c
@@ -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);
diff --git a/board/atmel/common/board.c b/board/atmel/common/board.c
index eee5c357bd..c93c0e52e3 100644
--- a/board/atmel/common/board.c
+++ b/board/atmel/common/board.c
@@ -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:
diff --git a/board/cavium/thunderx/atf.c b/board/cavium/thunderx/atf.c
index 582af6f1f1..1a039c53c1 100644
--- a/board/cavium/thunderx/atf.c
+++ b/board/cavium/thunderx/atf.c
@@ -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")) {
diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c
index 5206cf5c0a..b41c64d2a3 100644
--- a/board/compulab/common/eeprom.c
+++ b/board/compulab/common/eeprom.c
@@ -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;
diff --git a/board/compulab/common/omap3_display.c b/board/compulab/common/omap3_display.c
index cb9ebae7f9..4ed3b9c00a 100644
--- a/board/compulab/common/omap3_display.c
+++ b/board/compulab/common/omap3_display.c
@@ -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)
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index 383a861738..6c75231ddf 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -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;
diff --git a/board/freescale/common/pixis.c b/board/freescale/common/pixis.c
index 4127fbc139..6fdb11039e 100644
--- a/board/freescale/common/pixis.c
+++ b/board/freescale/common/pixis.c
@@ -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)
diff --git a/board/freescale/common/sys_eeprom.c b/board/freescale/common/sys_eeprom.c
index 9e73056a29..35df8ba389 100644
--- a/board/freescale/common/sys_eeprom.c
+++ b/board/freescale/common/sys_eeprom.c
@@ -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:
diff --git a/board/gateworks/gw_ventana/gsc.c b/board/gateworks/gw_ventana/gsc.c
index ffed6b5fc8..59fd1b6939 100644
--- a/board/gateworks/gw_ventana/gsc.c
+++ b/board/gateworks/gw_ventana/gsc.c
@@ -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;
diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c
index 6a0382dee3..912075db88 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -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;
diff --git a/board/gateworks/venice/gsc.c b/board/gateworks/venice/gsc.c
index c75bc6f855..271bc8c229 100644
--- a/board/gateworks/venice/gsc.c
+++ b/board/gateworks/venice/gsc.c
@@ -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())
diff --git a/board/gdsys/common/cmd_ioloop.c b/board/gdsys/common/cmd_ioloop.c
index 658756d984..1412421a02 100644
--- a/board/gdsys/common/cmd_ioloop.c
+++ b/board/gdsys/common/cmd_ioloop.c
@@ -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);
diff --git a/board/samsung/common/exynos5-dt.c b/board/samsung/common/exynos5-dt.c
index 1318ea716a..0d77a57f80 100644
--- a/board/samsung/common/exynos5-dt.c
+++ b/board/samsung/common/exynos5-dt.c
@@ -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)
diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
index 90aab62d33..35e4cee74f 100644
--- a/board/samsung/odroid/odroid.c
+++ b/board/samsung/odroid/odroid.c
@@ -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)
diff --git a/board/siemens/taurus/taurus.c b/board/siemens/taurus/taurus.c
index cad16f9065..dae064d465 100644
--- a/board/siemens/taurus/taurus.c
+++ b/board/siemens/taurus/taurus.c
@@ -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);
diff --git a/board/sifive/unmatched/hifive-platform-i2c-eeprom.c b/board/sifive/unmatched/hifive-platform-i2c-eeprom.c
index b230a71b3a..2b985b9b22 100644
--- a/board/sifive/unmatched/hifive-platform-i2c-eeprom.c
+++ b/board/sifive/unmatched/hifive-platform-i2c-eeprom.c
@@ -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);
diff --git a/board/synopsys/hsdk/env-lib.c b/board/synopsys/hsdk/env-lib.c
index e2258385ce..fd54ac75f2 100644
--- a/board/synopsys/hsdk/env-lib.c
+++ b/board/synopsys/hsdk/env-lib.c
@@ -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;
diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c
index 93eb20cf63..e4f9a0db91 100644
--- a/board/toradex/common/tdx-cfg-block.c
+++ b/board/toradex/common/tdx-cfg-block.c
@@ -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;
}
diff --git a/board/varisys/common/sys_eeprom.c b/board/varisys/common/sys_eeprom.c
index 1bf543619b..8f624e5e36 100644
--- a/board/varisys/common/sys_eeprom.c
+++ b/board/varisys/common/sys_eeprom.c
@@ -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:
diff --git a/board/work-microwave/work_92105/work_92105_display.c b/board/work-microwave/work_92105/work_92105_display.c
index fecbbbdb58..e8e559ce1f 100644
--- a/board/work-microwave/work_92105/work_92105_display.c
+++ b/board/work-microwave/work_92105/work_92105_display.c
@@ -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 */