[PATCH] dt:overlay: fix operation with multiple overlays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux