mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 11/12] of: base: add funtion to copy a device tree node
Date: Fri, 15 Sep 2017 10:39:21 +0200	[thread overview]
Message-ID: <20170915083922.25134-12-l.stach@pengutronix.de> (raw)
In-Reply-To: <20170915083922.25134-1-l.stach@pengutronix.de>

From: Michael Olbrich <m.olbrich@pengutronix.de>

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/of/base.c | 16 ++++++++++++++++
 include/of.h      |  8 ++++++++
 2 files changed, 24 insertions(+)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index fb4d2c03946e..3ca13ae44e5c 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1988,6 +1988,22 @@ out:
 	return dn;
 }
 
+struct device_node *of_copy_node(struct device_node *parent, const struct device_node *other)
+{
+	struct device_node *np, *child;
+	struct property *pp;
+
+	np = of_new_node(parent, other->name);
+
+	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);
+
+	return np;
+}
+
 void of_delete_node(struct device_node *node)
 {
 	struct device_node *n, *nt;
diff --git a/include/of.h b/include/of.h
index 9ba771a395b8..c21a1e95dda8 100644
--- a/include/of.h
+++ b/include/of.h
@@ -144,6 +144,8 @@ 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 struct device_node *of_copy_node(struct device_node *parent,
+				const struct device_node *other);
 extern void of_delete_node(struct device_node *node);
 
 extern int of_machine_is_compatible(const char *compat);
@@ -576,6 +578,12 @@ static inline struct device_node *of_create_node(struct device_node *root,
 	return NULL;
 }
 
+static inline struct device_node *of_copy_node(struct device_node *parent,
+					       const struct device_node *other)
+{
+	return NULL;
+}
+
 static inline void of_delete_node(struct device_node *node)
 {
 }
-- 
2.11.0


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

  parent reply	other threads:[~2017-09-15  8:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-15  8:39 [PATCH 00/12] Vexpress rework Lucas Stach
2017-09-15  8:39 ` [PATCH 01/12] ARM: vexpress: always build relocatable image Lucas Stach
2017-09-15  8:39 ` [PATCH 02/12] of: populate clock providers before other devices Lucas Stach
2017-09-15  8:39 ` [PATCH 03/12] clk: versatile: add basic clocks Lucas Stach
2017-09-16 13:34   ` Sam Ravnborg
2017-09-15  8:39 ` [PATCH 04/12] clocksource: sp804: silently ignore secondary instaces Lucas Stach
2017-09-15  8:39 ` [PATCH 05/12] mci: mmci: add DT support Lucas Stach
2017-09-16 13:37   ` Sam Ravnborg
2017-09-15  8:39 ` [PATCH 06/12] ARM: vexpress: switch to DT probe and multi-image build Lucas Stach
2017-09-15  8:39 ` [PATCH 07/12] ARM: vexpress: regenerate config Lucas Stach
2017-09-15  8:39 ` [PATCH 08/12] docs: add qemu vexpress Lucas Stach
2017-09-15  8:39 ` [PATCH 09/12] vexpress: use device tree provided by QEMU if available Lucas Stach
2017-09-15  8:39 ` [PATCH 10/12] vexpress: add bootstate node to the device tree Lucas Stach
2017-09-15  8:39 ` Lucas Stach [this message]
2017-09-20  6:20   ` [PATCH 11/12] of: base: add funtion to copy a device tree node Sascha Hauer
2017-09-15  8:39 ` [PATCH 12/12] ARM: vexpress: add fixup handler for 'virtio, mmio' devices Lucas Stach

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=20170915083922.25134-12-l.stach@pengutronix.de \
    --to=l.stach@pengutronix.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