aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2017-07-21 07:39:35 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-07-21 18:04:50 -0400
commit39e5aeed835dece823e6cc57f6842b8f1f4799e1 (patch)
tree58b26ba2cf40881690fe3c84c1d1e249b24128e9
parent99a85464693faa9b6829cb753b328c2e4434d94b (diff)
device property: Constify argument to pset fwnode backend
Internally constify pset fwnode backend. Do not touch the pset fwnode operations yet. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/base/property.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/drivers/base/property.c b/drivers/base/property.c
index 857e4d39add6..8fde824ad418 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -27,19 +27,23 @@ struct property_set {
27 27
28static const struct fwnode_operations pset_fwnode_ops; 28static const struct fwnode_operations pset_fwnode_ops;
29 29
30static inline bool is_pset_node(struct fwnode_handle *fwnode) 30static inline bool is_pset_node(const struct fwnode_handle *fwnode)
31{ 31{
32 return !IS_ERR_OR_NULL(fwnode) && fwnode->ops == &pset_fwnode_ops; 32 return !IS_ERR_OR_NULL(fwnode) && fwnode->ops == &pset_fwnode_ops;
33} 33}
34 34
35static inline struct property_set *to_pset_node(struct fwnode_handle *fwnode) 35#define to_pset_node(__fwnode) \
36{ 36 ({ \
37 return is_pset_node(fwnode) ? 37 typeof(__fwnode) __to_pset_node_fwnode = __fwnode; \
38 container_of(fwnode, struct property_set, fwnode) : NULL; 38 \
39} 39 is_pset_node(__to_pset_node_fwnode) ? \
40 40 container_of(__to_pset_node_fwnode, \
41static const struct property_entry *pset_prop_get(struct property_set *pset, 41 struct property_set, fwnode) : \
42 const char *name) 42 NULL; \
43 })
44
45static const struct property_entry *
46pset_prop_get(const struct property_set *pset, const char *name)
43{ 47{
44 const struct property_entry *prop; 48 const struct property_entry *prop;
45 49
@@ -53,7 +57,7 @@ static const struct property_entry *pset_prop_get(struct property_set *pset,
53 return NULL; 57 return NULL;
54} 58}
55 59
56static const void *pset_prop_find(struct property_set *pset, 60static const void *pset_prop_find(const struct property_set *pset,
57 const char *propname, size_t length) 61 const char *propname, size_t length)
58{ 62{
59 const struct property_entry *prop; 63 const struct property_entry *prop;
@@ -73,7 +77,7 @@ static const void *pset_prop_find(struct property_set *pset,
73 return pointer; 77 return pointer;
74} 78}
75 79
76static int pset_prop_read_u8_array(struct property_set *pset, 80static int pset_prop_read_u8_array(const struct property_set *pset,
77 const char *propname, 81 const char *propname,
78 u8 *values, size_t nval) 82 u8 *values, size_t nval)
79{ 83{
@@ -88,7 +92,7 @@ static int pset_prop_read_u8_array(struct property_set *pset,
88 return 0; 92 return 0;
89} 93}
90 94
91static int pset_prop_read_u16_array(struct property_set *pset, 95static int pset_prop_read_u16_array(const struct property_set *pset,
92 const char *propname, 96 const char *propname,
93 u16 *values, size_t nval) 97 u16 *values, size_t nval)
94{ 98{
@@ -103,7 +107,7 @@ static int pset_prop_read_u16_array(struct property_set *pset,
103 return 0; 107 return 0;
104} 108}
105 109
106static int pset_prop_read_u32_array(struct property_set *pset, 110static int pset_prop_read_u32_array(const struct property_set *pset,
107 const char *propname, 111 const char *propname,
108 u32 *values, size_t nval) 112 u32 *values, size_t nval)
109{ 113{
@@ -118,7 +122,7 @@ static int pset_prop_read_u32_array(struct property_set *pset,
118 return 0; 122 return 0;
119} 123}
120 124
121static int pset_prop_read_u64_array(struct property_set *pset, 125static int pset_prop_read_u64_array(const struct property_set *pset,
122 const char *propname, 126 const char *propname,
123 u64 *values, size_t nval) 127 u64 *values, size_t nval)
124{ 128{
@@ -133,7 +137,7 @@ static int pset_prop_read_u64_array(struct property_set *pset,
133 return 0; 137 return 0;
134} 138}
135 139
136static int pset_prop_count_elems_of_size(struct property_set *pset, 140static int pset_prop_count_elems_of_size(const struct property_set *pset,
137 const char *propname, size_t length) 141 const char *propname, size_t length)
138{ 142{
139 const struct property_entry *prop; 143 const struct property_entry *prop;
@@ -145,7 +149,7 @@ static int pset_prop_count_elems_of_size(struct property_set *pset,
145 return prop->length / length; 149 return prop->length / length;
146} 150}
147 151
148static int pset_prop_read_string_array(struct property_set *pset, 152static int pset_prop_read_string_array(const struct property_set *pset,
149 const char *propname, 153 const char *propname,
150 const char **strings, size_t nval) 154 const char **strings, size_t nval)
151{ 155{