[RFC PATCH v2 42/74] dtc: Change get_marker_label() signature to take dt_info

From: Herve Codina

Date: Wed Aug 26 2026 - 06:13:58 EST


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 orphan nodes introduction, move get_marker_label() parameter
one level up and use dt_info struct instead of the 'root' tree (i.e.
dti->dt).

This change doesn't lead to any functional changes.

Signed-off-by: Herve Codina <herve.codina@xxxxxxxxxxx>
---
checks.c | 4 +---
dtc.h | 4 ++--
livetree.c | 22 +++++++++++++++++++---
3 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/checks.c b/checks.c
index 7b52f37c..2b87e212 100644
--- a/checks.c
+++ b/checks.c
@@ -447,7 +447,6 @@ static void check_duplicate_label(struct check *c, struct dt_info *dti,
const char *label, struct node *node,
struct property *prop, struct marker *mark)
{
- struct node *dt = dti->dt;
struct node *othernode = NULL;
struct property *otherprop = NULL;
struct marker *othermark = NULL;
@@ -457,8 +456,7 @@ static void check_duplicate_label(struct check *c, struct dt_info *dti,
if (!othernode)
otherprop = get_property_by_label(dti, label, &othernode);
if (!othernode)
- othermark = get_marker_label(dt, label, &othernode,
- &otherprop);
+ othermark = get_marker_label(dti, label, &othernode, &otherprop);

if (!othernode)
return;
diff --git a/dtc.h b/dtc.h
index b596cdd0..e2d90f63 100644
--- a/dtc.h
+++ b/dtc.h
@@ -318,8 +318,6 @@ const char *get_unitname(struct node *node);
struct property *get_property(struct node *node, const char *propname);
cell_t propval_cell(struct property *prop);
cell_t propval_cell_n(struct property *prop, unsigned int n);
-struct marker *get_marker_label(struct node *tree, const char *label,
- struct node **node, struct property **prop);
struct node *get_subnode(struct node *node, const char *nodename);

uint32_t guess_boot_cpuid(struct node *tree);
@@ -357,6 +355,8 @@ struct node *get_node_by_ref(struct dt_info *dti, const char *ref);
cell_t get_node_phandle(struct dt_info *dti, struct node *node);
struct property *get_property_by_label(struct dt_info *dti, const char *label,
struct node **node);
+struct marker *get_marker_label(struct dt_info *dti, const char *label,
+ struct node **node, struct property **prop);

/* DTS version flags definitions */
#define DTSF_V1 0x0001 /* /dts-v1/ */
diff --git a/livetree.c b/livetree.c
index 332f2196..f8abc5d4 100644
--- a/livetree.c
+++ b/livetree.c
@@ -733,8 +733,8 @@ static struct property *get_property_by_label_(struct node *tree,
return NULL;
}

-struct marker *get_marker_label(struct node *tree, const char *label,
- struct node **node, struct property **prop)
+static struct marker *get_marker_label_(struct node *tree, const char *label,
+ struct node **node, struct property **prop)
{
struct marker *m;
struct property *p;
@@ -751,7 +751,7 @@ struct marker *get_marker_label(struct node *tree, const char *label,
}

for_each_child(tree, c) {
- m = get_marker_label(c, label, node, prop);
+ m = get_marker_label_(c, label, node, prop);
if (m)
return m;
}
@@ -960,6 +960,22 @@ struct property *get_property_by_label(struct dt_info *dti, const char *label,
return NULL;
}

+struct marker *get_marker_label(struct dt_info *dti, const char *label,
+ struct node **node, struct property **prop)
+{
+ struct marker *marker;
+
+ if (dti->dt) {
+ marker = get_marker_label_(dti->dt, label, node, prop);
+ if (marker)
+ return marker;
+ }
+
+ *prop = NULL;
+ *node = NULL;
+ return NULL;
+}
+
static void add_phandle_property(struct node *node,
const char *name, int format)
{
--
2.55.0