From: Simon Glass <sjg@chromium.org>
Date: Wed, 23 Jul 2014 12:55:11 +0000 (-0600)
Subject: dm: Avoid activating devices in 'dm uclass' command
X-Git-Tag: v2025.01-rc5-pxa1908~14971
X-Git-Url: http://git.dujemihanovic.xyz/html/static/git-favicon.png?a=commitdiff_plain;h=4e8bc211703d3c93689367745e8c07dc22c68dfc;p=u-boot.git

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>
---

diff --git a/test/dm/cmd_dm.c b/test/dm/cmd_dm.c
index 9b77a7fb92..93e525579d 100644
--- a/test/dm/cmd_dm.c
+++ b/test/dm/cmd_dm.c
@@ -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");