diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2015-11-30 10:11:32 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-12-06 20:29:22 -0500 |
commit | 66586baba56679baa2da1a10a96ccf15b1e96b95 (patch) | |
tree | e3d941455d6478cb071edc6ef307ba3f7b45fcf3 /include/linux/property.h | |
parent | 318a1971826103ecf560875b17236dd4a93e8c88 (diff) |
device property: keep single value inplace
We may save a lot of lines of code and space by keeping single values inside
the struct property_entry. Refactor the implementation to do so.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/linux/property.h')
-rw-r--r-- | include/linux/property.h | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/include/linux/property.h b/include/linux/property.h index c29460a0e521..69a8a0817fd3 100644 --- a/include/linux/property.h +++ b/include/linux/property.h | |||
@@ -145,19 +145,34 @@ static inline int fwnode_property_read_u64(struct fwnode_handle *fwnode, | |||
145 | * struct property_entry - "Built-in" device property representation. | 145 | * struct property_entry - "Built-in" device property representation. |
146 | * @name: Name of the property. | 146 | * @name: Name of the property. |
147 | * @length: Length of data making up the value. | 147 | * @length: Length of data making up the value. |
148 | * @value: Value of the property (an array of items of the given type). | 148 | * @is_array: True when the property is an array. |
149 | * @is_string: True when property is a string. | ||
150 | * @pointer: Pointer to the property (an array of items of the given type). | ||
151 | * @value: Value of the property (when it is a single item of the given type). | ||
149 | */ | 152 | */ |
150 | struct property_entry { | 153 | struct property_entry { |
151 | const char *name; | 154 | const char *name; |
152 | size_t length; | 155 | size_t length; |
156 | bool is_array; | ||
157 | bool is_string; | ||
153 | union { | 158 | union { |
154 | void *raw_data; | 159 | union { |
155 | u8 *u8_data; | 160 | void *raw_data; |
156 | u16 *u16_data; | 161 | u8 *u8_data; |
157 | u32 *u32_data; | 162 | u16 *u16_data; |
158 | u64 *u64_data; | 163 | u32 *u32_data; |
159 | const char **str; | 164 | u64 *u64_data; |
160 | } value; | 165 | const char **str; |
166 | } pointer; | ||
167 | union { | ||
168 | unsigned long long raw_data; | ||
169 | u8 u8_data; | ||
170 | u16 u16_data; | ||
171 | u32 u32_data; | ||
172 | u64 u64_data; | ||
173 | const char *str; | ||
174 | } value; | ||
175 | }; | ||
161 | }; | 176 | }; |
162 | 177 | ||
163 | /** | 178 | /** |