On Mon, Jan 12, 2026 at 03:19:39PM +0100, Herve Codina wrote: > Orphan nodes have been introduced recently. > > Retrieving a node, a property and/or a marker from an orphan node tree > is perfectly legit. > > Those retrievals are performed by the dti_get_xxx_by_yyy() functions > family. > > Update them to handle orphan nodes. I think at least some of the orphan node stuff can be separated from the import/export symbol stuff, and dtb changes. That can be reviewed and merged first, which will simplify the review task. The idea is this: at the moment, when we have multiple tree sections in the dts, we merge them all together into a single tree as we parse. The idea would be that we first make a list of all those sections, then perform the merge as a separate step from parsing. > > Signed-off-by: Herve Codina > --- > livetree.c | 42 ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 42 insertions(+) > > diff --git a/livetree.c b/livetree.c > index 057997a..fa9daff 100644 > --- a/livetree.c > +++ b/livetree.c > @@ -789,6 +789,7 @@ static struct node *get_node_by_ref(struct node *tree, const char *ref) > > struct node *dti_get_node_by_path(struct dt_info *dti, const char *path) > { > + struct node *orphan; > struct node *node; > > if (dti->dt) { > @@ -797,11 +798,18 @@ struct node *dti_get_node_by_path(struct dt_info *dti, const char *path) > return node; > } > > + for_each_orphan(dti->orphanlist, orphan) { > + node = get_node_by_path(orphan, path); > + if (node) > + return node; > + } > + > return NULL; > } > > struct node *dti_get_node_by_label(struct dt_info *dti, const char *label) > { > + struct node *orphan; > struct node *node; > > if (dti->dt) { > @@ -810,11 +818,18 @@ struct node *dti_get_node_by_label(struct dt_info *dti, const char *label) > return node; > } > > + for_each_orphan(dti->orphanlist, orphan) { > + node = get_node_by_label(orphan, label); > + if (node) > + return node; > + } > + > return NULL; > } > > struct node *dti_get_node_by_phandle(struct dt_info *dti, cell_t phandle) > { > + struct node *orphan; > struct node *node; > > if (dti->dt) { > @@ -823,11 +838,18 @@ struct node *dti_get_node_by_phandle(struct dt_info *dti, cell_t phandle) > return node; > } > > + for_each_orphan(dti->orphanlist, orphan) { > + node = get_node_by_phandle(orphan, phandle); > + if (node) > + return node; > + } > + > return NULL; > } > > struct node *dti_get_node_by_ref(struct dt_info *dti, const char *ref) > { > + struct node *orphan; > struct node *node; > > if (dti->dt) { > @@ -836,6 +858,12 @@ struct node *dti_get_node_by_ref(struct dt_info *dti, const char *ref) > return node; > } > > + for_each_orphan(dti->orphanlist, orphan) { > + node = get_node_by_ref(orphan, ref); > + if (node) > + return node; > + } > + > return NULL; > } > > @@ -844,6 +872,7 @@ struct property *dti_get_property_by_label(struct dt_info *dti, > struct node **node) > { > struct property *property; > + struct node *orphan; > > if (dti->dt) { > property = get_property_by_label(dti->dt, label, node); > @@ -851,6 +880,12 @@ struct property *dti_get_property_by_label(struct dt_info *dti, > return property; > } > > + for_each_orphan(dti->orphanlist, orphan) { > + property = get_property_by_label(orphan, label, node); > + if (property) > + return property; > + } > + > *node = NULL; > return NULL; > } > @@ -859,6 +894,7 @@ struct marker *dti_get_marker_label(struct dt_info *dti, const char *label, > struct node **node, struct property **prop) > { > struct marker *marker; > + struct node *orphan; > > if (dti->dt) { > marker = get_marker_label(dti->dt, label, node, prop); > @@ -866,6 +902,12 @@ struct marker *dti_get_marker_label(struct dt_info *dti, const char *label, > return marker; > } > > + for_each_orphan(dti->orphanlist, orphan) { > + marker = get_marker_label(orphan, label, node, prop); > + if (marker) > + return marker; > + } > + > *prop = NULL; > *node = NULL; > return NULL; > -- > 2.52.0 > > -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson