global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/common/bedbug.c b/common/bedbug.c
index 18a35ca..6e1fb58 100644
--- a/common/bedbug.c
+++ b/common/bedbug.c
@@ -1005,7 +1005,7 @@
 	}
 
 	if (txt[0] == '0' && (txt[1] == 'x' || txt[1] == 'X'))	/* hex */
-		val = simple_strtoul (&txt[2], NULL, 16);
+		val = hextoul(&txt[2], NULL);
 	else						/* decimal */
 		val = simple_strtoul (txt, NULL, 10);
 
diff --git a/common/bootm_os.c b/common/bootm_os.c
index 0b6325d..d635037 100644
--- a/common/bootm_os.c
+++ b/common/bootm_os.c
@@ -238,7 +238,7 @@
 	/* See README.plan9 */
 	s = env_get("confaddr");
 	if (s != NULL) {
-		char *confaddr = (char *)simple_strtoul(s, NULL, 16);
+		char *confaddr = (char *)hextoul(s, NULL);
 
 		if (argc > 0) {
 			copy_args(confaddr, argc, argv, '\n');
@@ -360,8 +360,7 @@
 			/* find f=0xnumber flag */
 			if ((bootargs[pos] == '=') && (pos >= 1) &&
 			    (bootargs[pos - 1] == 'f')) {
-				vxflags = simple_strtoul(&bootargs[pos + 1],
-							 NULL, 16);
+				vxflags = hextoul(&bootargs[pos + 1], NULL);
 				if (vxflags & VXWORKS_SYSFLG_STD_DTB)
 					std_dtb = true;
 			}
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 240f1e5..4341d84 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -579,7 +579,7 @@
 
 			for (j = 0; j < 6; j++) {
 				mac_addr[j] = tmp ?
-					      simple_strtoul(tmp, &end, 16) : 0;
+					      hextoul(tmp, &end) : 0;
 				if (tmp)
 					tmp = (*end) ? end + 1 : end;
 			}
diff --git a/common/hash.c b/common/hash.c
index 059d381..dca2363 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -397,7 +397,7 @@
 		char chr[3];
 
 		strlcpy(chr, &str[i * 2], 3);
-		result[i] = simple_strtoul(chr, NULL, 16);
+		result[i] = hextoul(chr, NULL);
 	}
 
 	return 0;
@@ -470,7 +470,7 @@
 		ulong addr;
 		void *buf;
 
-		addr = simple_strtoul(dest, NULL, 16);
+		addr = hextoul(dest, NULL);
 		buf = map_sysmem(addr, algo->digest_size);
 		memcpy(buf, sum, algo->digest_size);
 		unmap_sysmem(buf);
@@ -510,7 +510,7 @@
 		ulong addr;
 		void *buf;
 
-		addr = simple_strtoul(verify_str, NULL, 16);
+		addr = hextoul(verify_str, NULL);
 		buf = map_sysmem(addr, algo->digest_size);
 		memcpy(vsum, buf, algo->digest_size);
 	} else {
@@ -555,8 +555,8 @@
 	if ((argc < 2) || ((flags & HASH_FLAG_VERIFY) && (argc < 3)))
 		return CMD_RET_USAGE;
 
-	addr = simple_strtoul(*argv++, NULL, 16);
-	len = simple_strtoul(*argv++, NULL, 16);
+	addr = hextoul(*argv++, NULL);
+	len = hextoul(*argv++, NULL);
 
 	if (multi_hash()) {
 		struct hash_algo *algo;
@@ -628,7 +628,7 @@
 				addr, addr + len - 1, crc);
 
 		if (argc >= 3) {
-			ptr = (ulong *)simple_strtoul(argv[0], NULL, 16);
+			ptr = (ulong *)hextoul(argv[0], NULL);
 			*ptr = crc;
 		}
 	}
diff --git a/common/image-fdt.c b/common/image-fdt.c
index 06dce92..9441e63 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -186,7 +186,7 @@
 	/* If fdt_high is set use it to select the relocation address */
 	fdt_high = env_get("fdt_high");
 	if (fdt_high) {
-		void *desired_addr = (void *)simple_strtoul(fdt_high, NULL, 16);
+		void *desired_addr = (void *)hextoul(fdt_high, NULL);
 
 		if (((ulong) desired_addr) == ~0UL) {
 			/* All ones means use fdt in place */
@@ -297,7 +297,7 @@
 	*of_size = 0;
 
 	img_addr = (argc == 0) ? image_load_addr :
-			simple_strtoul(argv[0], NULL, 16);
+			hextoul(argv[0], NULL);
 	buf = map_sysmem(img_addr, 0);
 
 	if (argc > 2)
@@ -329,7 +329,7 @@
 			} else
 #endif
 			{
-				fdt_addr = simple_strtoul(select, NULL, 16);
+				fdt_addr = hextoul(select, NULL);
 				debug("*  fdt: cmdline image address = 0x%08lx\n",
 				      fdt_addr);
 			}
diff --git a/common/image-fit.c b/common/image-fit.c
index d6b2c3c..aff4670 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -53,7 +53,7 @@
 	sep = strchr(spec, sepc);
 	if (sep) {
 		if (sep - spec > 0)
-			*addr = simple_strtoul(spec, NULL, 16);
+			*addr = hextoul(spec, NULL);
 
 		*name = sep + 1;
 		return 1;
diff --git a/common/image.c b/common/image.c
index 51854aa..59c52a1 100644
--- a/common/image.c
+++ b/common/image.c
@@ -662,7 +662,7 @@
 	switch (op) {
 	case env_op_create:
 	case env_op_overwrite:
-		image_load_addr = simple_strtoul(value, NULL, 16);
+		image_load_addr = hextoul(value, NULL);
 		break;
 	default:
 		break;
@@ -676,7 +676,7 @@
 {
 	char *s = env_get("bootm_low");
 	if (s) {
-		ulong tmp = simple_strtoul(s, NULL, 16);
+		ulong tmp = hextoul(s, NULL);
 		return tmp;
 	}
 
@@ -1060,7 +1060,7 @@
 		      *fit_uname_kernel, kernel_addr);
 #endif
 	} else {
-		kernel_addr = simple_strtoul(img_addr, NULL, 16);
+		kernel_addr = hextoul(img_addr, NULL);
 		debug("*  kernel: cmdline image address = 0x%08lx\n",
 		      kernel_addr);
 	}
@@ -1227,7 +1227,7 @@
 			} else
 #endif
 			{
-				rd_addr = simple_strtoul(select, NULL, 16);
+				rd_addr = hextoul(select, NULL);
 				debug("*  ramdisk: cmdline image address = "
 						"0x%08lx\n",
 						rd_addr);
@@ -1301,7 +1301,7 @@
 			if (select)
 				end = strchr(select, ':');
 			if (end) {
-				rd_len = simple_strtoul(++end, NULL, 16);
+				rd_len = hextoul(++end, NULL);
 				rd_data = rd_addr;
 			} else
 #endif
@@ -1379,7 +1379,7 @@
 		/* a value of "no" or a similar string will act like 0,
 		 * turning the "load high" feature off. This is intentional.
 		 */
-		initrd_high = simple_strtoul(s, NULL, 16);
+		initrd_high = hextoul(s, NULL);
 		if (initrd_high == ~0)
 			initrd_copy_to_ram = 0;
 	} else {
diff --git a/common/kallsyms.c b/common/kallsyms.c
index ce42a93..13344e6 100644
--- a/common/kallsyms.c
+++ b/common/kallsyms.c
@@ -31,7 +31,7 @@
 	*caddr = 0;
 
 	while (*sym) {
-		sym_addr = simple_strtoul(sym, &esym, 16);
+		sym_addr = hextoul(sym, &esym);
 		sym = esym;
 		if (sym_addr > addr)
 			break;
diff --git a/common/lcd.c b/common/lcd.c
index ab5614a..16a0a7c 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -747,7 +747,7 @@
 	if (op == env_op_delete)
 		return 0;
 
-	addr = simple_strtoul(value, NULL, 16);
+	addr = hextoul(value, NULL);
 	/* See README.displaying-bmps */
 	aligned = (addr % 4 == 2);
 	if (!aligned) {
diff --git a/common/splash.c b/common/splash.c
index 2b9313e..de720df 100644
--- a/common/splash.c
+++ b/common/splash.c
@@ -65,7 +65,7 @@
 	if (!splashimage)
 		return -ENOENT;
 
-	bmp_load_addr = simple_strtoul(splashimage, 0, 16);
+	bmp_load_addr = hextoul(splashimage, 0);
 	if (!bmp_load_addr) {
 		printf("Error: bad 'splashimage' address\n");
 		return -EFAULT;
@@ -162,7 +162,7 @@
 	if (!s)
 		return -EINVAL;
 
-	addr = simple_strtoul(s, NULL, 16);
+	addr = hextoul(s, NULL);
 	ret = splash_screen_prepare();
 	if (ret)
 		return ret;
diff --git a/common/splash_source.c b/common/splash_source.c
index 3cf926d..d05670f 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -414,7 +414,7 @@
 	if (env_splashimage_value == NULL)
 		return -ENOENT;
 
-	bmp_load_addr = simple_strtoul(env_splashimage_value, 0, 16);
+	bmp_load_addr = hextoul(env_splashimage_value, 0);
 	if (bmp_load_addr == 0) {
 		printf("Error: bad splashimage address specified\n");
 		return -EFAULT;
diff --git a/common/update.c b/common/update.c
index f084895..f5c8684 100644
--- a/common/update.c
+++ b/common/update.c
@@ -272,7 +272,7 @@
 	/* get load address of downloaded update file */
 	env_addr = env_get("loadaddr");
 	if (env_addr)
-		addr = simple_strtoul(env_addr, NULL, 16);
+		addr = hextoul(env_addr, NULL);
 	else
 		addr = CONFIG_UPDATE_LOAD_ADDR;