<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 5, 2021 at 10:41 AM G S Niteesh Babu <<a href="mailto:niteesh.gs@gmail.com">niteesh.gs@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Refactored recursive rtems_ofw_get_effective_phandle into a<br>
iterative function.<br>
---<br>
bsps/shared/ofw/ofw.c | 9 +++++----<br>
1 file changed, 5 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/bsps/shared/ofw/ofw.c b/bsps/shared/ofw/ofw.c<br>
index 9dec310247..e3626747fa 100644<br>
--- a/bsps/shared/ofw/ofw.c<br>
+++ b/bsps/shared/ofw/ofw.c<br>
@@ -509,11 +509,12 @@ static phandle_t rtems_ofw_get_effective_phandle(<br>
{<br>
phandle_t child;<br>
phandle_t ref;<br>
+ int node_offset;<br>
<br>
- for (child = rtems_ofw_child(node); child != 0; child = rtems_ofw_peer(child)) {<br>
- ref = rtems_ofw_get_effective_phandle(child, xref);<br>
- if (ref != -1)<br>
- return ref;<br>
+ node_offset = fdt_path_offset(fdtp, "/");<br>
+<br>
+ while ((node_offset = fdt_next_node(fdtp, node_offset, NULL)) > 0) {<br>
+ child = rtems_fdt_offset_to_phandle(node_offset);<br>
<br></blockquote><div>Assuming this works, it is much better now :) Thanks.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
if (rtems_ofw_get_enc_prop(child, "phandle", &ref, sizeof(ref)) == -1 &&<br>
rtems_ofw_get_enc_prop(child, "ibm,phandle", &ref, sizeof(ref)) == -1 &&<br>
-- <br>
2.17.1<br>
<br>
</blockquote></div></div>