Revert "dm: fdt: scan for devices under /firmware too"
diff mbox series

Message ID 20200217203545.26470-1-thiruan@linux.microsoft.com
State Rejected
Delegated to: Michal Simek
Headers show
Series
  • Revert "dm: fdt: scan for devices under /firmware too"
Related show

Commit Message

Thirupathaiah Annapureddy Feb. 17, 2020, 8:35 p.m. UTC
Subnodes under "/firmware" node are scanned twice in
dm_scan_fdt_node() and dm_extended_scan_fdt().
This patch removes the scanning in dm_scan_fdt_node() to
avoid double scanning.

This reverts commit 747558d014577526bf2e8d9fe9ca748fdbf75d8a.

Signed-off-by: Thirupathaiah Annapureddy <thiruan@linux.microsoft.com>
---
 drivers/core/root.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

Comments

Michal Simek Feb. 18, 2020, 7:22 a.m. UTC | #1
On 17. 02. 20 21:35, Thirupathaiah Annapureddy wrote:
> Subnodes under "/firmware" node are scanned twice in
> dm_scan_fdt_node() and dm_extended_scan_fdt().
> This patch removes the scanning in dm_scan_fdt_node() to
> avoid double scanning.
> 
> This reverts commit 747558d014577526bf2e8d9fe9ca748fdbf75d8a.
> 
> Signed-off-by: Thirupathaiah Annapureddy <thiruan@linux.microsoft.com>
> ---
>  drivers/core/root.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/core/root.c b/drivers/core/root.c
> index e85643819e..cb695e933a 100644
> --- a/drivers/core/root.c
> +++ b/drivers/core/root.c
> @@ -254,15 +254,9 @@ 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)) {
> -		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);
> +		/* "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");
>  
>  			err = dm_scan_fdt_node(parent, blob, offset,
>  					       pre_reloc_only);
> @@ -279,7 +273,8 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
>  				     pre_reloc_only);
>  		if (err && !ret) {
>  			ret = err;
> -			debug("%s: ret=%d\n", node_name, ret);
> +			debug("%s: ret=%d\n", fdt_get_name(blob, offset, NULL),
> +			      ret);
>  		}
>  	}

This has come up several times. Please join this thread which is fixing
this issue.
https://lists.denx.de/pipermail/u-boot/2020-February/400165.html

Thanks,
Michal

Patch
diff mbox series

diff --git a/drivers/core/root.c b/drivers/core/root.c
index e85643819e..cb695e933a 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -254,15 +254,9 @@  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)) {
-		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);
+		/* "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");
 
 			err = dm_scan_fdt_node(parent, blob, offset,
 					       pre_reloc_only);
@@ -279,7 +273,8 @@  static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
 				     pre_reloc_only);
 		if (err && !ret) {
 			ret = err;
-			debug("%s: ret=%d\n", node_name, ret);
+			debug("%s: ret=%d\n", fdt_get_name(blob, offset, NULL),
+			      ret);
 		}
 	}