Commit 4e8bc211703d3c93689367745e8c07dc22c68dfc
1 parent
fffa24d7c5
Exists in
v2017.01-smarct4x
and in
37 other branches
dm: Avoid activating devices in 'dm uclass' command
This command currently activates devices as it lists them. This is not desirable since it changes the system state. Fix it and avoid printing a newline if there are no devices in a uclass. Signed-off-by: Simon Glass <sjg@chromium.org>
Showing 1 changed file with 3 additions and 3 deletions Side-by-side Diff
test/dm/cmd_dm.c
... | ... | @@ -94,9 +94,9 @@ |
94 | 94 | continue; |
95 | 95 | |
96 | 96 | printf("uclass %d: %s\n", id, uc->uc_drv->name); |
97 | - for (ret = uclass_first_device(id, &dev); | |
98 | - dev; | |
99 | - ret = uclass_next_device(&dev)) { | |
97 | + if (list_empty(&uc->dev_head)) | |
98 | + continue; | |
99 | + list_for_each_entry(dev, &uc->dev_head, uclass_node) { | |
100 | 100 | dm_display_line(dev, ""); |
101 | 101 | } |
102 | 102 | puts("\n"); |