diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2023-02-10 17:53:50 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-03-10 11:20:12 +0100 |
commit | a7fd3482bcd253193851b31fd6bfa47f2a50a6e7 (patch) | |
tree | fc4a9599a0190b6f3dde87b6275d61adf92e7edd /drivers/of | |
parent | 8012f1209ea517fd110b1268822d369398e39e05 (diff) | |
download | barebox-a7fd3482bcd253193851b31fd6bfa47f2a50a6e7.tar.gz |
of: base: factor out of_merge_nodes from of_copy_node
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>
Link: https://lore.barebox.org/20230210165353.3601175-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/base.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index fb23594c7a..82dde9a3f0 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -2617,19 +2617,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; } |