mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
core: ofnode: add ofnode_get_parent function
The Rockchip video drivers need to walk the ofnode-parrents to find an enclosing device that has a UCLASS_DISPLAY driver bound. This adds a ofnode_get_parent()-function that returns the parent-node. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com> Reviewed-by: Anatolij Gustschin <agust@denx.de>
This commit is contained in:
parent
f0f6917188
commit
e2d5997ffd
2 changed files with 22 additions and 0 deletions
|
@ -165,6 +165,20 @@ ofnode ofnode_next_subnode(ofnode node)
|
||||||
fdt_next_subnode(gd->fdt_blob, ofnode_to_offset(node)));
|
fdt_next_subnode(gd->fdt_blob, ofnode_to_offset(node)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ofnode ofnode_get_parent(ofnode node)
|
||||||
|
{
|
||||||
|
ofnode parent;
|
||||||
|
|
||||||
|
assert(ofnode_valid(node));
|
||||||
|
if (ofnode_is_np(node))
|
||||||
|
parent = np_to_ofnode(of_get_parent(ofnode_to_np(node)));
|
||||||
|
else
|
||||||
|
parent.of_offset = fdt_parent_offset(gd->fdt_blob,
|
||||||
|
ofnode_to_offset(node));
|
||||||
|
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
const char *ofnode_get_name(ofnode node)
|
const char *ofnode_get_name(ofnode node)
|
||||||
{
|
{
|
||||||
assert(ofnode_valid(node));
|
assert(ofnode_valid(node));
|
||||||
|
|
|
@ -301,6 +301,14 @@ ofnode ofnode_first_subnode(ofnode node);
|
||||||
*/
|
*/
|
||||||
ofnode ofnode_next_subnode(ofnode node);
|
ofnode ofnode_next_subnode(ofnode node);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ofnode_get_parent() - get the ofnode's parent (enclosing ofnode)
|
||||||
|
*
|
||||||
|
* @node: valid node to look up
|
||||||
|
* @return ofnode reference of the parent node
|
||||||
|
*/
|
||||||
|
ofnode ofnode_get_parent(ofnode node);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ofnode_get_name() - get the name of a node
|
* ofnode_get_name() - get the name of a node
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue