From fb721e3fd2380d7d0835ad6479ee3a23b528569d Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 30 Jan 2018 12:14:40 +0100 Subject: of: Allow for const properties This adds support for const properties. We add a const void *value_const to struct property which will not be modified. The value of a property should no longer be used directly, but with the of_property_get_value() accessor which picks the right value. With this we can unflatten dtbs and use the property values directly from the dtb instead of copying them. This is useful for device trees which (ab)use properties to store huge data files, aka FIT images. To create a property whose value is not copied but used from the original input data we introduce of_new_property_const(). Signed-off-by: Sascha Hauer --- include/of.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/of.h b/include/of.h index 1b9719d603..d3b92328a5 100644 --- a/include/of.h +++ b/include/of.h @@ -20,6 +20,7 @@ struct property { char *name; int length; void *value; + const void *value_const; struct list_head list; }; @@ -117,6 +118,9 @@ extern int of_set_property(struct device_node *node, const char *p, const void *val, int len, int create); extern struct property *of_new_property(struct device_node *node, const char *name, const void *data, int len); +extern struct property *of_new_property_const(struct device_node *node, + const char *name, + const void *data, int len); extern void of_delete_property(struct property *pp); extern struct device_node *of_find_node_by_name(struct device_node *from, -- cgit v1.2.3