summaryrefslogtreecommitdiff
path: root/net
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 /net
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 'net')
-rw-r--r--net/bootp.c2
-rw-r--r--net/eth-uclass.c4
-rw-r--r--net/eth_legacy.c2
-rw-r--r--net/net.c2
-rw-r--r--net/tftp.c13
5 files changed, 10 insertions, 13 deletions
diff --git a/net/bootp.c b/net/bootp.c
index 163af41e92..655b9cceb6 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -740,7 +740,7 @@ void bootp_request(void)
ep = env_get("bootpretryperiod");
if (ep != NULL)
- time_taken_max = simple_strtoul(ep, NULL, 10);
+ time_taken_max = dectoul(ep, NULL);
else
time_taken_max = TIMEOUT_MS;
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index c2a97d723a..0da0e85be0 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -128,7 +128,7 @@ struct udevice *eth_get_dev_by_name(const char *devname)
/* Must be longer than 3 to be an alias */
if (!strncmp(devname, "eth", len) && strlen(devname) > len) {
startp = devname + len;
- seq = simple_strtoul(startp, &endp, 10);
+ seq = dectoul(startp, &endp);
}
ret = uclass_get(UCLASS_ETH, &uc);
@@ -241,7 +241,7 @@ static int on_ethaddr(const char *name, const char *value, enum env_op op,
struct udevice *dev;
/* look for an index after "eth" */
- index = simple_strtoul(name + 3, NULL, 10);
+ index = dectoul(name + 3, NULL);
retval = uclass_find_device_by_seq(UCLASS_ETH, index, &dev);
if (!retval) {
diff --git a/net/eth_legacy.c b/net/eth_legacy.c
index 96ed5a4720..f383ccce0b 100644
--- a/net/eth_legacy.c
+++ b/net/eth_legacy.c
@@ -114,7 +114,7 @@ static int on_ethaddr(const char *name, const char *value, enum env_op op,
return 0;
/* look for an index after "eth" */
- index = simple_strtoul(name + 3, NULL, 10);
+ index = dectoul(name + 3, NULL);
dev = eth_devices;
do {
diff --git a/net/net.c b/net/net.c
index b58f3062b2..c2992a0908 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1591,7 +1591,7 @@ ushort string_to_vlan(const char *s)
if (*s < '0' || *s > '9')
id = VLAN_NONE;
else
- id = (ushort)simple_strtoul(s, NULL, 10);
+ id = (ushort)dectoul(s, NULL);
return htons(id);
}
diff --git a/net/tftp.c b/net/tftp.c
index 00ab7ca0b3..5baf528f4e 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -554,8 +554,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
for (i = 0; i+8 < len; i++) {
if (strcasecmp((char *)pkt + i, "blksize") == 0) {
tftp_block_size = (unsigned short)
- simple_strtoul((char *)pkt + i + 8,
- NULL, 10);
+ dectoul((char *)pkt + i + 8, NULL);
debug("Blocksize oack: %s, %d\n",
(char *)pkt + i + 8, tftp_block_size);
if (tftp_block_size > tftp_block_size_option) {
@@ -566,8 +565,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
}
if (strcasecmp((char *)pkt + i, "timeout") == 0) {
timeout_val_rcvd = (unsigned short)
- simple_strtoul((char *)pkt + i + 8,
- NULL, 10);
+ dectoul((char *)pkt + i + 8, NULL);
debug("Timeout oack: %s, %d\n",
(char *)pkt + i + 8, timeout_val_rcvd);
if (timeout_val_rcvd != (timeout_ms / 1000)) {
@@ -578,16 +576,15 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
}
#ifdef CONFIG_TFTP_TSIZE
if (strcasecmp((char *)pkt + i, "tsize") == 0) {
- tftp_tsize = simple_strtoul((char *)pkt + i + 6,
- NULL, 10);
+ tftp_tsize = dectoul((char *)pkt + i + 6,
+ NULL);
debug("size = %s, %d\n",
(char *)pkt + i + 6, tftp_tsize);
}
#endif
if (strcasecmp((char *)pkt + i, "windowsize") == 0) {
tftp_windowsize =
- simple_strtoul((char *)pkt + i + 11,
- NULL, 10);
+ dectoul((char *)pkt + i + 11, NULL);
debug("windowsize = %s, %d\n",
(char *)pkt + i + 11, tftp_windowsize);
}