aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSimon Glass2022-09-06 20:27:15 -0600
committerTom Rini2022-09-29 16:11:14 -0400
commitf46ec93ed593e7a442629a2a56fd541debc41329 (patch)
tree3992b6252e60c9fccd1661c9ef81f4d1e694c55d /lib
parent9243224687bd92674c693546a46f849b1a54c75c (diff)
dm: core: Avoid creating a name property when unflattening
The current implementation creates a 'name' value for every node. This is not needed for the latest device tree format, which includes a name in the node header. Adjust the code to point the name at the node header instead. Also simplify ofnode_get_name(), now that we can rely on it to set the name correctly. Update the comment to make it clear what name the root node has. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/of_live.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/of_live.c b/lib/of_live.c
index 30cae9ab881..1b5964d09a9 100644
--- a/lib/of_live.c
+++ b/lib/of_live.c
@@ -97,6 +97,10 @@ static void *unflatten_dt_node(const void *blob, void *mem, int *poffset,
char *fn;
fn = (char *)np + sizeof(*np);
+ if (new_format) {
+ np->name = pathp;
+ has_name = 1;
+ }
np->full_name = fn;
if (new_format) {
/* rebuild full path for new format */
@@ -202,7 +206,8 @@ static void *unflatten_dt_node(const void *blob, void *mem, int *poffset,
}
if (!dryrun) {
*prev_pp = NULL;
- np->name = of_get_property(np, "name", NULL);
+ if (!has_name)
+ np->name = of_get_property(np, "name", NULL);
np->type = of_get_property(np, "device_type", NULL);
if (!np->name)