summaryrefslogtreecommitdiff
path: root/cmd/pci.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-07-24 18:03:29 +0300
committerTom Rini <trini@konsulko.com>2021-08-02 20:32:14 +0300
commit7e5f460ec457fe310156e399198a41eb0ce1e98c (patch)
tree7e89e4d15fcea2d2263c4b4af1be69905537ef42 /cmd/pci.c
parent031725f8cdf33e836d19f35d3fe82c5baa5a2976 (diff)
downloadu-boot-7e5f460ec457fe310156e399198a41eb0ce1e98c.tar.xz
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>
Diffstat (limited to 'cmd/pci.c')
-rw-r--r--cmd/pci.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/cmd/pci.c b/cmd/pci.c
index e53b7c858c..22de9426c9 100644
--- a/cmd/pci.c
+++ b/cmd/pci.c
@@ -470,14 +470,14 @@ static pci_dev_t get_pci_dev(char *name)
if (name[i] == '.') {
memcpy(cnum, &name[iold], i - iold);
cnum[i - iold] = '\0';
- bdfs[n++] = simple_strtoul(cnum, NULL, 16);
+ bdfs[n++] = hextoul(cnum, NULL);
iold = i + 1;
}
}
strcpy(cnum, &name[iold]);
if (n == 0)
n = 1;
- bdfs[n] = simple_strtoul(cnum, NULL, 16);
+ bdfs[n] = hextoul(cnum, NULL);
return PCI_BDF(bdfs[0], bdfs[1], bdfs[2]);
}
@@ -588,7 +588,7 @@ static int pci_cfg_modify(pci_dev_t bdf, ulong addr, ulong size, ulong value,
#endif
else {
char *endp;
- i = simple_strtoul(console_buffer, &endp, 16);
+ i = hextoul(console_buffer, &endp);
nbytes = endp - console_buffer;
if (nbytes) {
/* good enough to not time out
@@ -683,9 +683,9 @@ static int do_pci(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
cmd_size = cmd_get_data_size(argv[1], 4);
size = (cmd_size == 4) ? PCI_SIZE_32 : cmd_size - 1;
if (argc > 3)
- addr = simple_strtoul(argv[3], NULL, 16);
+ addr = hextoul(argv[3], NULL);
if (argc > 4)
- value = simple_strtoul(argv[4], NULL, 16);
+ value = hextoul(argv[4], NULL);
case 'h': /* header */
#ifdef CONFIG_DM_PCI
case 'b': /* bars */
@@ -709,7 +709,7 @@ static int do_pci(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
argc--;
}
if (argc > 1)
- busnum = simple_strtoul(argv[1], NULL, 16);
+ busnum = hextoul(argv[1], NULL);
}
#ifdef CONFIG_DM_PCI
ret = uclass_get_device_by_seq(UCLASS_PCI, busnum, &bus);