diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2023-04-14 20:35:44 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-04-17 09:08:33 +0200 |
commit | f09de517765a4fab6a0edcfe32f4e35a056f683f (patch) | |
tree | fd18e0243f56d843f65c699b4910b0aa9db9ab13 /drivers | |
parent | f42ad4fa1566028ffa82e22be3a551af0fd822cd (diff) | |
download | barebox-f09de517765a4fab6a0edcfe32f4e35a056f683f.tar.gz |
of: implement of_copy_property
For use in fixups, it can be useful to copy a property verbatim from the
barebox DT to the kernel DT. Add a helper that does just that.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230414183545.2039170-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-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 ea4be9c512..9eaa93b5bb 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -2318,6 +2318,22 @@ struct property *of_rename_property(struct device_node *np, return pp; } +struct property *of_copy_property(const struct device_node *src, + const char *propname, + struct device_node *dst) +{ + struct property *prop; + + prop = of_find_property(src, propname, NULL); + if (!prop) + return NULL; + + return of_new_property(dst, propname, + of_property_get_value(prop), prop->length); +} +EXPORT_SYMBOL_GPL(of_copy_property); + + /** * of_set_property - create a property for a given node * @node - the node |