diff options
author | Simon Glass <sjg@chromium.org> | 2021-07-24 09:03:30 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-08-02 13:32:14 -0400 |
commit | 0b1284eb52578e15ec611adc5fee1a9ae68dadea (patch) | |
tree | 2d83815e93fc16decbaa5671fd660ade0ec74532 /drivers/gpio | |
parent | 7e5f460ec457fe310156e399198a41eb0ce1e98c (diff) |
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 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-uclass.c | 2 | ||||
-rw-r--r-- | drivers/gpio/mxs_gpio.c | 4 | ||||
-rw-r--r-- | drivers/gpio/tca642x.c | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index 131099cc17..8c77777dbe 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -122,7 +122,7 @@ int dm_gpio_lookup_name(const char *name, struct gpio_desc *desc) int numeric; int ret; - numeric = isdigit(*name) ? simple_strtoul(name, NULL, 10) : -1; + numeric = isdigit(*name) ? dectoul(name, NULL) : -1; for (ret = uclass_first_device(UCLASS_GPIO, &dev); dev; ret = uclass_next_device(&dev)) { diff --git a/drivers/gpio/mxs_gpio.c b/drivers/gpio/mxs_gpio.c index 5775a22abd..7b9d88a8a7 100644 --- a/drivers/gpio/mxs_gpio.c +++ b/drivers/gpio/mxs_gpio.c @@ -123,12 +123,12 @@ int name_to_gpio(const char *name) unsigned bank, pin; char *end; - bank = simple_strtoul(name, &end, 10); + bank = dectoul(name, &end); if (!*end || *end != ':') return bank; - pin = simple_strtoul(end + 1, NULL, 10); + pin = dectoul(end + 1, NULL); return (bank << MXS_PAD_BANK_SHIFT) | (pin << MXS_PAD_PIN_SHIFT); } diff --git a/drivers/gpio/tca642x.c b/drivers/gpio/tca642x.c index 7007c7a002..7f67f96b0e 100644 --- a/drivers/gpio/tca642x.c +++ b/drivers/gpio/tca642x.c @@ -262,11 +262,11 @@ static int do_tca642x(struct cmd_tbl *cmdtp, int flag, int argc, /* arg2 used as chip number or pin number */ if (argc > 2) - ul_arg2 = simple_strtoul(argv[2], NULL, 10); + ul_arg2 = dectoul(argv[2], NULL); /* arg3 used as pin or invert value */ if (argc > 3) - ul_arg3 = simple_strtoul(argv[3], NULL, 10) & 0x1; + ul_arg3 = dectoul(argv[3], NULL) & 0x1; switch ((int)c->cmd) { case TCA642X_CMD_INFO: |