[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260112142009.1006236-25-herve.codina@bootlin.com>
Date: Mon, 12 Jan 2026 15:19:14 +0100
From: Herve Codina <herve.codina@...tlin.com>
To: David Gibson <david@...son.dropbear.id.au>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk@...nel.org>,
Conor Dooley <conor+dt@...nel.org>
Cc: Ayush Singh <ayush@...gleboard.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
devicetree-compiler@...r.kernel.org,
devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
devicetree-spec@...r.kernel.org,
Hui Pu <hui.pu@...ealthcare.com>,
Ian Ray <ian.ray@...ealthcare.com>,
Luca Ceresoli <luca.ceresoli@...tlin.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Herve Codina <herve.codina@...tlin.com>
Subject: [RFC PATCH 24/77] dtc: Introduce update_exports_ref()
In order to have consistent internal data when a export symbol using a
local phandle is parsed from a dtb, the reference related to this
phandle usage needs to be updated based on the phandle value.
This is done for phandles used by properties in update_phandles_ref().
The same operation is needed for export symbols. This is the purpose of
update_exports_ref().
Signed-off-by: Herve Codina <herve.codina@...tlin.com>
---
dtc.c | 1 +
dtc.h | 1 +
livetree.c | 30 ++++++++++++++++++++++++++++++
3 files changed, 32 insertions(+)
diff --git a/dtc.c b/dtc.c
index 030bfa2..e0a0b54 100644
--- a/dtc.c
+++ b/dtc.c
@@ -336,6 +336,7 @@ int main(int argc, char *argv[])
update_phandles_ref(dti);
mark_local_phandles(dti);
+ update_exports_ref(dti);
mark_local_exports(dti);
/*
diff --git a/dtc.h b/dtc.h
index ea073c2..024e172 100644
--- a/dtc.h
+++ b/dtc.h
@@ -368,6 +368,7 @@ void generate_local_fixups_tree(struct dt_info *dti, const char *name);
void update_phandles_ref(struct dt_info *dti);
void mark_local_phandles(struct dt_info *dti);
+void update_exports_ref(struct dt_info *dti);
void mark_local_exports(struct dt_info *dti);
/* Checks */
diff --git a/livetree.c b/livetree.c
index 0e756b8..7cf3ee5 100644
--- a/livetree.c
+++ b/livetree.c
@@ -1304,6 +1304,36 @@ void mark_local_phandles(struct dt_info *dti)
mark_local_phandles_internal(dti, dti->dt);
}
+static void update_exports_ref_internal(struct dt_info *dti, struct node *node)
+{
+ struct node *c;
+ struct symbol *exportsym;
+ struct node *refnode;
+
+ for_each_symbol(node->exportsymlist, exportsym) {
+ if (exportsym->ref)
+ continue;
+
+ if (exportsym->is_local) {
+ refnode = get_node_by_phandle(dti->dt, exportsym->phandle);
+ if (!refnode)
+ die("Node not found for phandle 0x%"PRIx32"\n", exportsym->phandle);
+
+ exportsym->ref = refnode->fullpath;
+ } else {
+ die("Found a non local phandle without a reference\n");
+ }
+ }
+
+ for_each_child(node, c)
+ update_exports_ref_internal(dti, c);
+}
+
+void update_exports_ref(struct dt_info *dti)
+{
+ update_exports_ref_internal(dti, dti->dt);
+}
+
static void mark_local_exports_internal(struct dt_info *dti,
struct node *node)
{
--
2.52.0
Powered by blists - more mailing lists