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/demo.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/demo.c')
-rw-r--r-- | cmd/demo.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/cmd/demo.c b/cmd/demo.c index 571f562ec6..ebd5a241c3 100644 --- a/cmd/demo.c +++ b/cmd/demo.c @@ -64,20 +64,23 @@ static int do_demo_light(struct cmd_tbl *cmdtp, int flag, int argc, int do_demo_list(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct udevice *dev; - int i, ret; + int i, ret, err = 0; puts("Demo uclass entries:\n"); - for (i = 0, ret = uclass_first_device(UCLASS_DEMO, &dev); + for (i = 0, ret = uclass_first_device_check(UCLASS_DEMO, &dev); dev; - ret = uclass_next_device(&dev)) { - printf("entry %d - instance %08x, ops %08x, plat %08x\n", + ret = uclass_next_device_check(&dev)) { + printf("entry %d - instance %08x, ops %08x, plat %08x, status %i\n", i++, (uint)map_to_sysmem(dev), (uint)map_to_sysmem(dev->driver->ops), - (uint)map_to_sysmem(dev_get_plat(dev))); + (uint)map_to_sysmem(dev_get_plat(dev)), + ret); + if (ret) + err = ret; } - return cmd_process_error(cmdtp, ret); + return cmd_process_error(cmdtp, err); } static struct cmd_tbl demo_commands[] = { |