[PATCH v2 5/6] commands: of_dump: use of_dup instead of flattening/unflattening

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Flattening and unflattening is needlessly laborious. We have of_dup
for that, so let's make use of it.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
v1 -> v2:
  - new patch
---
 commands/of_dump.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/commands/of_dump.c b/commands/of_dump.c
index f8e7280fd9f2..1d6c019bf08c 100644
--- a/commands/of_dump.c
+++ b/commands/of_dump.c
@@ -79,21 +79,9 @@ static int do_of_dump(int argc, char *argv[])
 	} else {
 		root = of_get_root_node();
 
-		if (fix) {
-			/* create a copy of internal devicetree */
-			void *fdt;
-			fdt = of_flatten_dtb(root);
-			root = of_unflatten_dtb(fdt, fdt_totalsize(fdt));
-
-			free(fdt);
-
-			if (IS_ERR(root)) {
-				ret = PTR_ERR(root);
-				goto out;
-			}
-
-			of_free = root;
-		}
+		/* copy internal device tree to apply fixups onto it */
+		if (fix)
+			root = of_free = of_dup(root);
 	}
 
 	if (fix) {
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux