aboutsummaryrefslogtreecommitdiff
path: root/cmd/adc.c
diff options
context:
space:
mode:
authorMichal Suchanek2022-10-12 21:57:58 +0200
committerSimon Glass2022-10-17 21:17:12 -0600
commit8676ae36ae4617b20b5cc49972c54c63c7b27bb3 (patch)
tree734d8ece41b094b709432ff5252b2d20d67dc422 /cmd/adc.c
parent9244645f929bdff2ce87d1d967a78a0e05cebd80 (diff)
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/adc.c')
-rw-r--r--cmd/adc.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/cmd/adc.c b/cmd/adc.c
index 1c5d3e10a39..a739d9e4641 100644
--- a/cmd/adc.c
+++ b/cmd/adc.c
@@ -12,23 +12,19 @@ static int do_adc_list(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
struct udevice *dev;
- int ret;
+ int ret, err;
- ret = uclass_first_device_err(UCLASS_ADC, &dev);
- if (ret) {
- printf("No available ADC device\n");
- return CMD_RET_FAILURE;
- }
+ ret = err = uclass_first_device_check(UCLASS_ADC, &dev);
- do {
- printf("- %s\n", dev->name);
+ while (dev) {
+ printf("- %s status: %i\n", dev->name, ret);
- ret = uclass_next_device(&dev);
+ ret = uclass_next_device_check(&dev);
if (ret)
- return CMD_RET_FAILURE;
- } while (dev);
+ err = ret;
+ }
- return CMD_RET_SUCCESS;
+ return err ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
}
static int do_adc_info(struct cmd_tbl *cmdtp, int flag, int argc,