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>
diff --git a/cmd/regulator.c b/cmd/regulator.c
index 60a7003..ed4996d 100644
--- a/cmd/regulator.c
+++ b/cmd/regulator.c
@@ -205,7 +205,7 @@
constraint(" * mode id:", mode, mode_name);
}
-static void do_status_line(struct udevice *dev)
+static void do_status_line(struct udevice *dev, int status)
{
struct dm_regulator_uclass_plat *pdata;
int current, value, mode;
@@ -231,6 +231,7 @@
printf("%-10s", mode_name);
else
printf("%-10s", "-");
+ printf(" %i", status);
printf("\n");
}
@@ -250,11 +251,11 @@
}
/* Show all of them in a list, probing them as needed */
- printf("%-20s %-10s %10s %10s %-10s\n", "Name", "Enabled", "uV", "mA",
- "Mode");
- for (ret = uclass_first_device(UCLASS_REGULATOR, &dev); dev;
- ret = uclass_next_device(&dev))
- do_status_line(dev);
+ printf("%-20s %-10s %10s %10s %-10s %s\n", "Name", "Enabled", "uV", "mA",
+ "Mode", "Status");
+ for (ret = uclass_first_device_check(UCLASS_REGULATOR, &dev); dev;
+ ret = uclass_next_device_check(&dev))
+ do_status_line(dev, ret);
return CMD_RET_SUCCESS;
}