[RFC PATCH 47/77] dtc: Introduce dti_fill_fullpaths()

Herve Codina <[email protected]> Mon, 12 Jan 2026 15:19:37 +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]>
The future introduction of orphan nodes for addons device-tree will lead
to more than one tree in the addons data. Those trees will be:
  - the classical root tree starting at the root node
  - trees related to orphan nodes

Also, an addon device-tree can have only trees based on orphan nodes. In
other words an addon device-tree is valid without having the classical
'root' tree.

To prepare this change, introduce and use dti_fill_fullpaths().

dti_fill_fullpaths() builds fullpaths of nodes available in a
tree like fill_fullpaths() but it works at the struct dt_info level.

It handles the case where a 'root' device-tree is not present and will
handle orphan nodes trees as soon as they will be introduced.

This introduction doesn't lead to any functional changes.

Signed-off-by: Herve Codina <[email protected]>
---
 dtc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/dtc.c b/dtc.c
index e0a0b54..59f4d77 100644
--- a/dtc.c
+++ b/dtc.c
@@ -45,6 +45,13 @@ static void fill_fullpaths(struct node *tree, const char *prefix)
 		fill_fullpaths(child, tree->fullpath);
 }
 
+static void dti_fill_fullpaths(struct dt_info *dti)
+{
+	/* Fill fullpaths for the root node */
+	if (dti->dt)
+		fill_fullpaths(dti->dt, "");
+}
+
 /* Usage related data. */
 static const char usage_synopsis[] = "dtc [options] <input file>";
 static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:a:fb:i:H:sW:E:@LAThv";
@@ -326,7 +333,7 @@ int main(int argc, char *argv[])
 	if (cmdline_boot_cpuid != -1)
 		dti->boot_cpuid_phys = cmdline_boot_cpuid;
 
-	fill_fullpaths(dti->dt, "");
+	dti_fill_fullpaths(dti);
 
 	/* on a plugin, generate by default */
 	if (dti->dtsflags & DTSF_PLUGIN) {
-- 
2.52.0