diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2017-10-12 12:26:57 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-10-17 08:46:08 +0200 |
commit | 2aec5f446763fe9075a9625f8197efdd19f9d7f3 (patch) | |
tree | b1f8af73eef3794f52322d5ff4362388d957346a /drivers/of | |
parent | fb639086d37bb0731562405edbda7f9e842c498f (diff) | |
download | barebox-2aec5f446763fe9075a9625f8197efdd19f9d7f3.tar.gz barebox-2aec5f446763fe9075a9625f8197efdd19f9d7f3.tar.xz |
of: base: add function to copy a device tree node
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/base.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index fb4d2c0394..3ca13ae44e 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; |