[RFC PATCH v2 06/74] dtc: Move fill_fullpaths() into build_dt_info()
From: Herve Codina
Date: Wed Aug 26 2026 - 05:54:12 EST
fill_fullpaths() is called unconditionally after parsing to set the full
path of each node in the parsed device tree.
There is no reason to call it outside build_dt_info().
Furthermore, future metadata support will need post-parsing operations
in build_dt_info() to produce a fully consistent dt_info. Those future
operations will need the full paths filled by fill_fullpaths().
Move the fill_fullpaths() call into build_dt_info() in preparation.
No functional change expected.
Signed-off-by: Herve Codina <herve.codina@xxxxxxxxxxx>
---
dtc.c | 19 -------------------
livetree.c | 19 +++++++++++++++++++
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/dtc.c b/dtc.c
index 6dae60de..e5068375 100644
--- a/dtc.c
+++ b/dtc.c
@@ -28,23 +28,6 @@ static int is_power_of_2(int x)
return (x > 0) && ((x & (x - 1)) == 0);
}
-static void fill_fullpaths(struct node *tree, const char *prefix)
-{
- struct node *child;
- const char *unit;
-
- tree->fullpath = join_path(prefix, tree->name);
-
- unit = strchr(tree->name, '@');
- if (unit)
- tree->basenamelen = unit - tree->name;
- else
- tree->basenamelen = strlen(tree->name);
-
- for_each_child(tree, child)
- fill_fullpaths(child, tree->fullpath);
-}
-
/* 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,8 +309,6 @@ int main(int argc, char *argv[])
if (cmdline_boot_cpuid != -1)
dti->boot_cpuid_phys = cmdline_boot_cpuid;
- fill_fullpaths(dti->dt, "");
-
/* on a plugin, generate by default */
if (dti->dtsflags & DTSF_PLUGIN) {
generate_fixups = 1;
diff --git a/livetree.c b/livetree.c
index 8baed1fc..abe73de1 100644
--- a/livetree.c
+++ b/livetree.c
@@ -448,6 +448,23 @@ struct reserve_info *add_reserve_entry(struct reserve_info *list,
return list;
}
+static void fill_fullpaths(struct node *tree, const char *prefix)
+{
+ struct node *child;
+ const char *unit;
+
+ tree->fullpath = join_path(prefix, tree->name);
+
+ unit = strchr(tree->name, '@');
+ if (unit)
+ tree->basenamelen = unit - tree->name;
+ else
+ tree->basenamelen = strlen(tree->name);
+
+ for_each_child(tree, child)
+ fill_fullpaths(child, tree->fullpath);
+}
+
struct dt_info *build_dt_info(unsigned int dtsflags,
struct reserve_info *reservelist,
struct node *tree, uint32_t boot_cpuid_phys)
@@ -460,6 +477,8 @@ struct dt_info *build_dt_info(unsigned int dtsflags,
dti->dt = tree;
dti->boot_cpuid_phys = boot_cpuid_phys;
+ fill_fullpaths(dti->dt, "");
+
return dti;
}
--
2.55.0