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/lib/net_utils.c b/lib/net_utils.c
index 0a8a557..f596c8f 100644
--- a/lib/net_utils.c
+++ b/lib/net_utils.c
@@ -52,7 +52,7 @@
 		return;
 
 	for (i = 0; i < 6; ++i) {
-		enetaddr[i] = addr ? simple_strtoul(addr, &end, 16) : 0;
+		enetaddr[i] = addr ? hextoul(addr, &end) : 0;
 		if (addr)
 			addr = (*end) ? end + 1 : end;
 	}
diff --git a/lib/strto.c b/lib/strto.c
index f8b53d8..57d6216 100644
--- a/lib/strto.c
+++ b/lib/strto.c
@@ -30,11 +30,10 @@
 	return s;
 }
 
-unsigned long simple_strtoul(const char *cp, char **endp,
-				unsigned int base)
+ulong simple_strtoul(const char *cp, char **endp, uint base)
 {
-	unsigned long result = 0;
-	unsigned long value;
+	ulong result = 0;
+	ulong value;
 
 	cp = _parse_integer_fixup_radix(cp, &base);
 
@@ -50,6 +49,11 @@
 	return result;
 }
 
+ulong hextoul(const char *cp, char **endp)
+{
+	return simple_strtoul(cp, endp, 16);
+}
+
 int strict_strtoul(const char *cp, unsigned int base, unsigned long *res)
 {
 	char *tail;
diff --git a/lib/uuid.c b/lib/uuid.c
index 5bc6867..67267c6 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -164,26 +164,26 @@
 	}
 
 	if (str_format == UUID_STR_FORMAT_STD) {
-		tmp32 = cpu_to_be32(simple_strtoul(uuid_str, NULL, 16));
+		tmp32 = cpu_to_be32(hextoul(uuid_str, NULL));
 		memcpy(uuid_bin, &tmp32, 4);
 
-		tmp16 = cpu_to_be16(simple_strtoul(uuid_str + 9, NULL, 16));
+		tmp16 = cpu_to_be16(hextoul(uuid_str + 9, NULL));
 		memcpy(uuid_bin + 4, &tmp16, 2);
 
-		tmp16 = cpu_to_be16(simple_strtoul(uuid_str + 14, NULL, 16));
+		tmp16 = cpu_to_be16(hextoul(uuid_str + 14, NULL));
 		memcpy(uuid_bin + 6, &tmp16, 2);
 	} else {
-		tmp32 = cpu_to_le32(simple_strtoul(uuid_str, NULL, 16));
+		tmp32 = cpu_to_le32(hextoul(uuid_str, NULL));
 		memcpy(uuid_bin, &tmp32, 4);
 
-		tmp16 = cpu_to_le16(simple_strtoul(uuid_str + 9, NULL, 16));
+		tmp16 = cpu_to_le16(hextoul(uuid_str + 9, NULL));
 		memcpy(uuid_bin + 4, &tmp16, 2);
 
-		tmp16 = cpu_to_le16(simple_strtoul(uuid_str + 14, NULL, 16));
+		tmp16 = cpu_to_le16(hextoul(uuid_str + 14, NULL));
 		memcpy(uuid_bin + 6, &tmp16, 2);
 	}
 
-	tmp16 = cpu_to_be16(simple_strtoul(uuid_str + 19, NULL, 16));
+	tmp16 = cpu_to_be16(hextoul(uuid_str + 19, NULL));
 	memcpy(uuid_bin + 8, &tmp16, 2);
 
 	tmp64 = cpu_to_be64(simple_strtoull(uuid_str + 24, NULL, 16));
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index c14176dd..d7ee35b 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -858,7 +858,7 @@
 {
 	char *endptr;
 
-	*num = simple_strtoul(p, &endptr, 16);
+	*num = hextoul(p, &endptr);
 	return *p != '\0' && *endptr == '\0';
 }