[RFC PATCH 50/77] dtc: Handle orphan nodes in mark_local_xxx() and update_xxx_ref()
Herve Codina <[email protected]> Mon, 12 Jan 2026 15:19:40 +0100
| Newsgroups | org.kernel.vger.devicetree-spec,org.kernel.vger.devicetree-compiler,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Orphan nodes have been introduced recently. mark_local_phandles() and mark_local_exports() mark phandles and export symbols as local when they reference a local node (i.e. a node in the current device-tree). update_phandles_ref() and update_exports_ref() update references pointing to local nodes. Those phandles, export symbols and references can involve orphan trees. Indeed, even if an orphan node itself is not present in the current device-tree, its subnodes are fully described in the current device-tree and so, those subnodes have to be considered as local nodes. Update those functions to handle orphan nodes. Signed-off-by: Herve Codina <[email protected]> --- livetree.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/livetree.c b/livetree.c index fa9daff..52c55be 100644 --- a/livetree.c +++ b/livetree.c @@ -1481,7 +1481,12 @@ static void update_phandles_ref_internal(struct dt_info *dti, struct node *node) void update_phandles_ref(struct dt_info *dti) { + struct node *orphan; + update_phandles_ref_internal(dti, dti->dt); + + for_each_orphan(dti->orphanlist, orphan) + update_phandles_ref_internal(dti, orphan); } static void mark_local_phandles_internal(struct dt_info *dti, @@ -1507,7 +1512,12 @@ static void mark_local_phandles_internal(struct dt_info *dti, void mark_local_phandles(struct dt_info *dti) { + struct node *orphan; + mark_local_phandles_internal(dti, dti->dt); + + for_each_orphan(dti->orphanlist, orphan) + mark_local_phandles_internal(dti, orphan); } static void update_exports_ref_internal(struct dt_info *dti, struct node *node) @@ -1537,7 +1547,12 @@ static void update_exports_ref_internal(struct dt_info *dti, struct node *node) void update_exports_ref(struct dt_info *dti) { + struct node *orphan; + update_exports_ref_internal(dti, dti->dt); + + for_each_orphan(dti->orphanlist, orphan) + update_exports_ref_internal(dti, orphan); } static void mark_local_exports_internal(struct dt_info *dti, @@ -1559,6 +1574,10 @@ static void mark_local_exports_internal(struct dt_info *dti, void mark_local_exports(struct dt_info *dti) { + struct node *orphan; + mark_local_exports_internal(dti, dti->dt); + for_each_orphan(dti->orphanlist, orphan) + mark_local_exports_internal(dti, orphan); } -- 2.52.0