mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] dt:overlay: fix operation with multiple overlays
@ 2021-02-10 14:27 Enrico Scholz
  2021-02-10 14:27 ` [PATCH] imx8:pinfunc: fix definition Enrico Scholz
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Enrico Scholz @ 2021-02-10 14:27 UTC (permalink / raw)
  To: barebox; +Cc: Enrico Scholz

When applying multiple devicetree overlays the 'phandle' attribute
must be updated too.  Else, every overlay will be adjusted to start
with the same base which causes duplicate phandles.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
---
 drivers/of/base.c    | 1 +
 drivers/of/overlay.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index edb0a8e71a0f..c88803d8ab4b 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2385,6 +2385,7 @@ struct device_node *of_copy_node(struct device_node *parent, const struct device
 	struct property *pp;
 
 	np = of_new_node(parent, other->name);
+	np->phandle = other->phandle;
 
 	list_for_each_entry(pp, &other->properties, list)
 		of_new_property(np, pp->name, pp->value, pp->length);
diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index 92d20b9a247e..79f8b6dfdbcf 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -66,8 +66,10 @@ static int of_overlay_apply(struct device_node *target,
 
 	for_each_child_of_node(overlay, child) {
 		target_child = of_get_child_by_name(target, child->name);
-		if (!target_child)
+		if (!target_child) {
 			target_child = of_new_node(target, child->name);
+			target_child->phandle = child->phandle;
+		}
 		if (!target_child)
 			return -ENOMEM;
 
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-02-12 10:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10 14:27 [PATCH] dt:overlay: fix operation with multiple overlays Enrico Scholz
2021-02-10 14:27 ` [PATCH] imx8:pinfunc: fix definition Enrico Scholz
2021-02-12 10:17   ` Sascha Hauer
2021-02-10 14:27 ` [PATCH] nvmem: avoid false positive in of_nvmem_find() and simplify it Enrico Scholz
2021-02-12 10:16 ` [PATCH] dt:overlay: fix operation with multiple overlays Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox