From 66586baba56679baa2da1a10a96ccf15b1e96b95 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Mon, 30 Nov 2015 17:11:32 +0200 Subject: 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 Signed-off-by: Rafael J. Wysocki --- include/linux/property.h | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'include/linux/property.h') 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, * struct property_entry - "Built-in" device property representation. * @name: Name of the property. * @length: Length of data making up the value. - * @value: Value of the property (an array of items of the given type). + * @is_array: True when the property is an array. + * @is_string: True when property is a string. + * @pointer: Pointer to the property (an array of items of the given type). + * @value: Value of the property (when it is a single item of the given type). */ struct property_entry { const char *name; size_t length; + bool is_array; + bool is_string; union { - void *raw_data; - u8 *u8_data; - u16 *u16_data; - u32 *u32_data; - u64 *u64_data; - const char **str; - } value; + union { + void *raw_data; + u8 *u8_data; + u16 *u16_data; + u32 *u32_data; + u64 *u64_data; + const char **str; + } pointer; + union { + unsigned long long raw_data; + u8 u8_data; + u16 u16_data; + u32 u32_data; + u64 u64_data; + const char *str; + } value; + }; }; /** -- cgit