mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 1/4] of: base: factor out of_merge_nodes from of_copy_node
@ 2023-02-10 16:53 Ahmad Fatoum
  2023-02-10 16:53 ` [PATCH v2 2/4] of: support of_ensure_probed for top-level machine device Ahmad Fatoum
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Ahmad Fatoum @ 2023-02-10 16:53 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Later commit will need to merge two DTs from the root up. Refactor
that part out of of_copy_node to make it usable on its own.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
  - no changes
---
 drivers/of/base.c | 17 ++++++++++++-----
 include/of.h      |  1 +
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 937847f44ab7..1221cd316cdf 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2616,19 +2616,26 @@ out:
 	return dn;
 }
 
-struct device_node *of_copy_node(struct device_node *parent, const struct device_node *other)
+void of_merge_nodes(struct device_node *np, const struct device_node *other)
 {
-	struct device_node *np, *child;
+	struct device_node *child;
 	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);
 
 	for_each_child_of_node(other, child)
 		of_copy_node(np, child);
+}
+
+struct device_node *of_copy_node(struct device_node *parent, const struct device_node *other)
+{
+	struct device_node *np;
+
+	np = of_new_node(parent, other->name);
+	np->phandle = other->phandle;
+
+	of_merge_nodes(np, other);
 
 	return np;
 }
diff --git a/include/of.h b/include/of.h
index 7ee1304b932b..1a38774615a4 100644
--- a/include/of.h
+++ b/include/of.h
@@ -180,6 +180,7 @@ extern struct device_node *of_new_node(struct device_node *parent,
 				const char *name);
 extern struct device_node *of_create_node(struct device_node *root,
 					const char *path);
+extern void of_merge_nodes(struct device_node *np, const struct device_node *other);
 extern struct device_node *of_copy_node(struct device_node *parent,
 				const struct device_node *other);
 extern struct device_node *of_dup(const struct device_node *root);
-- 
2.30.2




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

end of thread, other threads:[~2023-03-13 14:45 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-10 16:53 [PATCH v2 1/4] of: base: factor out of_merge_nodes from of_copy_node Ahmad Fatoum
2023-02-10 16:53 ` [PATCH v2 2/4] of: support of_ensure_probed for top-level machine device Ahmad Fatoum
2023-03-10 14:46   ` Michael Riesch
2023-03-10 16:19     ` Ahmad Fatoum
2023-03-13  7:05       ` Michael Riesch
2023-03-13 14:43         ` Ahmad Fatoum
2023-02-10 16:53 ` [PATCH v2 3/4] boards: qemu-virt: ensure board driver probe at postcore_initcall level Ahmad Fatoum
2023-02-10 16:53 ` [PATCH v2 4/4] boards: qemu-virt: support passing in FIT public key Ahmad Fatoum
2023-02-10 17:32   ` Jan Lübbe
2023-02-13  8:45   ` Sascha Hauer
2023-02-17 13:03     ` Ahmad Fatoum
2023-03-09 12:47       ` Ahmad Fatoum
2023-03-10  9:51 ` [PATCH v2 1/4] of: base: factor out of_merge_nodes from of_copy_node Sascha Hauer

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