From: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
To: barebox@lists.infradead.org
Cc: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Subject: [PATCH] dt:overlay: fix operation with multiple overlays
Date: Wed, 10 Feb 2021 15:27:02 +0100 [thread overview]
Message-ID: <20210210142704.1855761-1-enrico.scholz@sigma-chemnitz.de> (raw)
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
next reply other threads:[~2021-02-10 14:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-10 14:27 Enrico Scholz [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210210142704.1855761-1-enrico.scholz@sigma-chemnitz.de \
--to=enrico.scholz@sigma-chemnitz.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox