diff options
author | G S Niteesh Babu <niteesh.gs@gmail.com> | 2021-02-06 23:10:11 +0530 |
---|---|---|
committer | Christian Mauderer <oss@c-mauderer.de> | 2021-02-08 21:08:36 +0100 |
commit | 6da50db55bb852b68c64a70dff3ff918222b176b (patch) | |
tree | facbf10b6f493d658fcd10d0fa8ebf3e8b5a4cda /bsps | |
parent | bsps/shared/ofw: Use strlcpy instead of strncpy (diff) | |
download | rtems-6da50db55bb852b68c64a70dff3ff918222b176b.tar.bz2 |
bsps/shared/ofw: Make rtems_ofw_get_effective_phandle iterative
Refactored recursive rtems_ofw_get_effective_phandle into a
iterative function.
Diffstat (limited to 'bsps')
-rw-r--r-- | bsps/shared/ofw/ofw.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/bsps/shared/ofw/ofw.c b/bsps/shared/ofw/ofw.c index 886ad0252b..78576ecf45 100644 --- a/bsps/shared/ofw/ofw.c +++ b/bsps/shared/ofw/ofw.c @@ -509,11 +509,12 @@ static phandle_t rtems_ofw_get_effective_phandle( { phandle_t child; phandle_t ref; + int node_offset; - for (child = rtems_ofw_child(node); child != 0; child = rtems_ofw_peer(child)) { - ref = rtems_ofw_get_effective_phandle(child, xref); - if (ref != -1) - return ref; + node_offset = fdt_path_offset(fdtp, "/"); + + while ((node_offset = fdt_next_node(fdtp, node_offset, NULL)) > 0) { + child = rtems_fdt_offset_to_phandle(node_offset); if (rtems_ofw_get_enc_prop(child, "phandle", &ref, sizeof(ref)) == -1 && rtems_ofw_get_enc_prop(child, "ibm,phandle", &ref, sizeof(ref)) == -1 && |