diff options
author | Simon Glass <sjg@chromium.org> | 2021-07-24 18:03:29 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-08-02 20:32:14 +0300 |
commit | 7e5f460ec457fe310156e399198a41eb0ce1e98c (patch) | |
tree | 7e89e4d15fcea2d2263c4b4af1be69905537ef42 /board/siemens/common | |
parent | 031725f8cdf33e836d19f35d3fe82c5baa5a2976 (diff) | |
download | u-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 'board/siemens/common')
-rw-r--r-- | board/siemens/common/factoryset.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c index 2e3ae1a54d..fba678b426 100644 --- a/board/siemens/common/factoryset.c +++ b/board/siemens/common/factoryset.c @@ -243,7 +243,7 @@ int factoryset_read_eeprom(int i2c_addr) buf, MAX_STRING_LENGTH); cp1 = buf; for (i = 0; i < 6; i++) { - factory_dat.mac[i] = simple_strtoul((char *)cp1, NULL, 16); + factory_dat.mac[i] = hextoul((char *)cp1, NULL); cp1 += 3; } @@ -254,8 +254,7 @@ int factoryset_read_eeprom(int i2c_addr) if (ret > 0) { cp1 = buf; for (i = 0; i < 6; i++) { - factory_dat.mac_wlan[i] = simple_strtoul((char *)cp1, - NULL, 16); + factory_dat.mac_wlan[i] = hextoul((char *)cp1, NULL); cp1 += 3; } } @@ -266,15 +265,13 @@ int factoryset_read_eeprom(int i2c_addr) if (0 <= get_factory_record_val(cp, size, (uchar *)"USBD1", (uchar *)"vid", buf, MAX_STRING_LENGTH)) { - factory_dat.usb_vendor_id = simple_strtoul((char *)buf, - NULL, 16); + factory_dat.usb_vendor_id = hextoul((char *)buf, NULL); } if (0 <= get_factory_record_val(cp, size, (uchar *)"USBD1", (uchar *)"pid", buf, MAX_STRING_LENGTH)) { - factory_dat.usb_product_id = simple_strtoul((char *)buf, - NULL, 16); + factory_dat.usb_product_id = hextoul((char *)buf, NULL); } printf("DFU USB: VID = 0x%4x, PID = 0x%4x\n", factory_dat.usb_vendor_id, factory_dat.usb_product_id); @@ -294,8 +291,7 @@ int factoryset_read_eeprom(int i2c_addr) if (0 <= get_factory_record_val(cp, size, (uchar *)"DEV", (uchar *)"ver", buf, MAX_STRING_LENGTH)) { - factory_dat.version = simple_strtoul((char *)buf, - NULL, 16); + factory_dat.version = hextoul((char *)buf, NULL); debug("version number: %d\n", factory_dat.version); } /* Get ASN from factory set if available */ |