diff options
author | Simon Glass <sjg@chromium.org> | 2022-09-07 05:26:57 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-09-29 23:07:58 +0300 |
commit | 829d51246fda25655b64224f2a19976797cf1897 (patch) | |
tree | 8e74ee7de940010449347df9c7d04ba4afbb551f /drivers/core | |
parent | b5001cb4bdfed678877840776c15b1e9a358dacf (diff) | |
download | u-boot-829d51246fda25655b64224f2a19976797cf1897.tar.xz |
dm: core: Pass a root node to of_find_node_by_phandle()
This function currently assumes that the control FDT is used. Update it
to allow a root node to be passed, so it can work with any tree.
Also add a comment to ofnode_get_by_phandle() so that its purpose is
clear.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core')
-rw-r--r-- | drivers/core/of_access.c | 7 | ||||
-rw-r--r-- | drivers/core/ofnode.c | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c index df007e642b..f7743d4066 100644 --- a/drivers/core/of_access.c +++ b/drivers/core/of_access.c @@ -445,14 +445,15 @@ struct device_node *of_find_node_by_prop_value(struct device_node *from, return np; } -struct device_node *of_find_node_by_phandle(phandle handle) +struct device_node *of_find_node_by_phandle(struct device_node *root, + phandle handle) { struct device_node *np; if (!handle) return NULL; - for_each_of_allnodes(np) + for_each_of_allnodes_from(root, np) if (np->phandle == handle) break; (void)of_node_get(np); @@ -697,7 +698,7 @@ static int __of_parse_phandle_with_args(const struct device_node *np, * below. */ if (cells_name || cur_index == index) { - node = of_find_node_by_phandle(phandle); + node = of_find_node_by_phandle(NULL, phandle); if (!node) { debug("%s: could not find phandle\n", np->full_name); diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 42f3c09a51..b241be3b9f 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -391,7 +391,7 @@ ofnode ofnode_get_by_phandle(uint phandle) ofnode node; if (of_live_active()) - node = np_to_ofnode(of_find_node_by_phandle(phandle)); + node = np_to_ofnode(of_find_node_by_phandle(NULL, phandle)); else node.of_offset = fdt_node_offset_by_phandle(gd->fdt_blob, phandle); |