]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
dm: Avoid activating devices in 'dm uclass' command
authorSimon Glass <sjg@chromium.org>
Wed, 23 Jul 2014 12:55:11 +0000 (06:55 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 23 Jul 2014 13:07:25 +0000 (14:07 +0100)
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>
test/dm/cmd_dm.c

index 9b77a7fb920f9d85fc3a9a931045d5bf57054b98..93e525579d770d7c92ee257db3ef097091b70510 100644 (file)
@@ -94,9 +94,9 @@ static int do_dm_dump_uclass(cmd_tbl_t *cmdtp, int flag, int argc,
                        continue;
 
                printf("uclass %d: %s\n", id, uc->uc_drv->name);
-               for (ret = uclass_first_device(id, &dev);
-                    dev;
-                    ret = uclass_next_device(&dev)) {
+               if (list_empty(&uc->dev_head))
+                       continue;
+               list_for_each_entry(dev, &uc->dev_head, uclass_node) {
                        dm_display_line(dev, "");
                }
                puts("\n");