diff mbox series

[v4,01/19] dm: fdt: scan for devices under /firmware too

Message ID 20180925144023.24555-2-jens.wiklander@linaro.org
State Accepted
Commit 747558d014577526bf2e8d9fe9ca748fdbf75d8a
Headers show
Series AVB using OP-TEE | expand

Commit Message

Jens Wiklander Sept. 25, 2018, 2:40 p.m. UTC
Just as /chosen may contain devices /firmware may contain devices, scan
for devices under /firmware too.

Reviewed-by: Simon Glass <sjg@chromium.org>

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

---
 drivers/core/root.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

-- 
2.17.1

Comments

Tom Rini Oct. 8, 2018, 1:40 a.m. UTC | #1
On Tue, Sep 25, 2018 at 04:40:05PM +0200, Jens Wiklander wrote:

> Just as /chosen may contain devices /firmware may contain devices, scan

> for devices under /firmware too.

> 

> Reviewed-by: Simon Glass <sjg@chromium.org>

> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>


Applied to u-boot/master, thanks!

-- 
Tom
diff mbox series

Patch

diff --git a/drivers/core/root.c b/drivers/core/root.c
index 72bcc7d7f2a3..0dca507e1187 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -265,9 +265,15 @@  static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
 	for (offset = fdt_first_subnode(blob, offset);
 	     offset > 0;
 	     offset = fdt_next_subnode(blob, offset)) {
-		/* "chosen" node isn't a device itself but may contain some: */
-		if (!strcmp(fdt_get_name(blob, offset, NULL), "chosen")) {
-			pr_debug("parsing subnodes of \"chosen\"\n");
+		const char *node_name = fdt_get_name(blob, offset, NULL);
+
+		/*
+		 * The "chosen" and "firmware" nodes aren't devices
+		 * themselves but may contain some:
+		 */
+		if (!strcmp(node_name, "chosen") ||
+		    !strcmp(node_name, "firmware")) {
+			pr_debug("parsing subnodes of \"%s\"\n", node_name);
 
 			err = dm_scan_fdt_node(parent, blob, offset,
 					       pre_reloc_only);
@@ -286,8 +292,7 @@  static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
 		err = lists_bind_fdt(parent, offset_to_ofnode(offset), NULL);
 		if (err && !ret) {
 			ret = err;
-			debug("%s: ret=%d\n", fdt_get_name(blob, offset, NULL),
-			      ret);
+			debug("%s: ret=%d\n", node_name, ret);
 		}
 	}