mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
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>
This commit is contained in:
parent
9243224687
commit
f46ec93ed5
3 changed files with 8 additions and 3 deletions
|
@ -356,7 +356,7 @@ const char *ofnode_get_name(ofnode node)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ofnode_is_np(node))
|
if (ofnode_is_np(node))
|
||||||
return strrchr(node.np->full_name, '/') + 1;
|
return node.np->name;
|
||||||
|
|
||||||
return fdt_get_name(gd->fdt_blob, ofnode_to_offset(node), NULL);
|
return fdt_get_name(gd->fdt_blob, ofnode_to_offset(node), NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -466,7 +466,7 @@ ofnode ofnode_get_parent(ofnode node);
|
||||||
* ofnode_get_name() - get the name of a node
|
* ofnode_get_name() - get the name of a node
|
||||||
*
|
*
|
||||||
* @node: valid node to look up
|
* @node: valid node to look up
|
||||||
* Return: name of node
|
* Return: name of node (for the root node this is "")
|
||||||
*/
|
*/
|
||||||
const char *ofnode_get_name(ofnode node);
|
const char *ofnode_get_name(ofnode node);
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,10 @@ static void *unflatten_dt_node(const void *blob, void *mem, int *poffset,
|
||||||
char *fn;
|
char *fn;
|
||||||
|
|
||||||
fn = (char *)np + sizeof(*np);
|
fn = (char *)np + sizeof(*np);
|
||||||
|
if (new_format) {
|
||||||
|
np->name = pathp;
|
||||||
|
has_name = 1;
|
||||||
|
}
|
||||||
np->full_name = fn;
|
np->full_name = fn;
|
||||||
if (new_format) {
|
if (new_format) {
|
||||||
/* rebuild full path for 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) {
|
if (!dryrun) {
|
||||||
*prev_pp = NULL;
|
*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);
|
np->type = of_get_property(np, "device_type", NULL);
|
||||||
|
|
||||||
if (!np->name)
|
if (!np->name)
|
||||||
|
|
Loading…
Reference in a new issue