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>
diff --git a/board/Arcturus/ucp1020/ucp1020.c b/board/Arcturus/ucp1020/ucp1020.c
index 24d1d57..ee8a9e0 100644
--- a/board/Arcturus/ucp1020/ucp1020.c
+++ b/board/Arcturus/ucp1020/ucp1020.c
@@ -52,7 +52,7 @@
  */
 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 5829299..b739bc3 100644
--- a/board/BuS/eb_cpu5282/eb_cpu5282.c
+++ b/board/BuS/eb_cpu5282/eb_cpu5282.c
@@ -194,13 +194,13 @@
 	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 @@
 
 	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 eee5c35..c93c0e5 100644
--- a/board/atmel/common/board.c
+++ b/board/atmel/common/board.c
@@ -47,7 +47,7 @@
 			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 582af6f..1a039c5 100644
--- a/board/cavium/thunderx/atf.c
+++ b/board/cavium/thunderx/atf.c
@@ -236,47 +236,47 @@
 
 	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 5206cf5..b41c64d 100644
--- a/board/compulab/common/eeprom.c
+++ b/board/compulab/common/eeprom.c
@@ -153,7 +153,7 @@
 	 */
 	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 cb9ebae..4ed3b9c 100644
--- a/board/compulab/common/omap3_display.c
+++ b/board/compulab/common/omap3_display.c
@@ -244,7 +244,7 @@
 	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 383a861..6c75231 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -284,7 +284,7 @@
 
 	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 4127fbc..6fdb110 100644
--- a/board/freescale/common/pixis.c
+++ b/board/freescale/common/pixis.c
@@ -403,10 +403,10 @@
 		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 @@
 		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 9e73056..35df8ba 100644
--- a/board/freescale/common/sys_eeprom.c
+++ b/board/freescale/common/sys_eeprom.c
@@ -456,7 +456,7 @@
 		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 ffed6b5..59fd1b6 100644
--- a/board/gateworks/gw_ventana/gsc.c
+++ b/board/gateworks/gw_ventana/gsc.c
@@ -277,7 +277,7 @@
 	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 @@
 		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 6a0382d..912075d 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -471,7 +471,7 @@
 
 	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 c75bc6f..271bc8c 100644
--- a/board/gateworks/venice/gsc.c
+++ b/board/gateworks/venice/gsc.c
@@ -660,7 +660,7 @@
 	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 658756d..1412421 100644
--- a/board/gdsys/common/cmd_ioloop.c
+++ b/board/gdsys/common/cmd_ioloop.c
@@ -275,13 +275,13 @@
 	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 @@
 	/*
 	 * 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 @@
 	/*
 	 * 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 @@
 		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 1318ea7..0d77a57f 100644
--- a/board/samsung/common/exynos5-dt.c
+++ b/board/samsung/common/exynos5-dt.c
@@ -169,7 +169,7 @@
 	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 90aab62..35e4cee 100644
--- a/board/samsung/odroid/odroid.c
+++ b/board/samsung/odroid/odroid.c
@@ -85,7 +85,7 @@
 	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 cad16f9..dae064d 100644
--- a/board/siemens/taurus/taurus.c
+++ b/board/siemens/taurus/taurus.c
@@ -394,10 +394,9 @@
 	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 b230a71..2b985b9 100644
--- a/board/sifive/unmatched/hifive-platform-i2c-eeprom.c
+++ b/board/sifive/unmatched/hifive-platform-i2c-eeprom.c
@@ -324,7 +324,7 @@
 {
 	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 @@
 {
 	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 @@
 {
 	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 e225838..fd54ac7 100644
--- a/board/synopsys/hsdk/env-lib.c
+++ b/board/synopsys/hsdk/env-lib.c
@@ -254,7 +254,7 @@
 	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 93eb20c..e4f9a0d 100644
--- a/board/toradex/common/tdx-cfg-block.c
+++ b/board/toradex/common/tdx-cfg-block.c
@@ -548,7 +548,7 @@
 		len = cli_readline(message);
 	}
 
-	tdx_serial = simple_strtoul(console_buffer, NULL, 10);
+	tdx_serial = dectoul(console_buffer, NULL);
 
 	return 0;
 }
@@ -566,14 +566,14 @@
 	/* 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 @@
 	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 @@
 
 	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 @@
 		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 1bf5436..8f624e5 100644
--- a/board/varisys/common/sys_eeprom.c
+++ b/board/varisys/common/sys_eeprom.c
@@ -368,7 +368,7 @@
 		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 fecbbbd..e8e559c 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 @@
 	/* 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 */