diff options
author | Michal Suchanek <msuchanek@suse.de> | 2022-10-12 21:57:58 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2022-10-17 21:17:12 -0600 |
commit | 8676ae36ae4617b20b5cc49972c54c63c7b27bb3 (patch) | |
tree | 734d8ece41b094b709432ff5252b2d20d67dc422 /cmd/gpio.c | |
parent | 9244645f929bdff2ce87d1d967a78a0e05cebd80 (diff) | |
download | u-boot-8676ae36ae4617b20b5cc49972c54c63c7b27bb3.tar.gz u-boot-8676ae36ae4617b20b5cc49972c54c63c7b27bb3.tar.bz2 u-boot-8676ae36ae4617b20b5cc49972c54c63c7b27bb3.zip |
cmd: List all uclass devices regardless of probe error
There are a few commands that iterate uclass with
uclass_first_device/uclass_next_device or the _err variant.
Use the _check class iterator variant to get devices that fail to probe
as well, and print the status.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd/gpio.c')
-rw-r--r-- | cmd/gpio.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/cmd/gpio.c b/cmd/gpio.c index 53e9ce666f..f4565982ec 100644 --- a/cmd/gpio.c +++ b/cmd/gpio.c @@ -77,17 +77,24 @@ static int do_gpio_status(bool all, const char *gpio_name) struct udevice *dev; int banklen; int flags; - int ret; + int ret, err = 0; flags = 0; if (gpio_name && !*gpio_name) gpio_name = NULL; - for (ret = uclass_first_device(UCLASS_GPIO, &dev); + for (ret = uclass_first_device_check(UCLASS_GPIO, &dev); dev; - ret = uclass_next_device(&dev)) { + ret = uclass_next_device_check(&dev)) { const char *bank_name; int num_bits; + if (ret) { + printf("GPIO device %s probe error %i\n", + dev->name, ret); + err = ret; + continue; + } + flags |= FLAG_SHOW_BANK; if (all) flags |= FLAG_SHOW_ALL; @@ -120,7 +127,7 @@ static int do_gpio_status(bool all, const char *gpio_name) flags |= FLAG_SHOW_NEWLINE; } - return ret; + return err; } #endif |