diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2019-10-23 23:02:24 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2019-11-06 01:18:10 +0300 |
commit | 1f74d70ff21249670eb68c1344e0687aa909861d (patch) | |
tree | c2dd779cadf563c5e90d1b6102ec51fc6c651cd7 /include/linux/property.h | |
parent | 75dd63c968d8e91707d74845ccb96bda3664cdaa (diff) | |
download | linux-1f74d70ff21249670eb68c1344e0687aa909861d.tar.xz |
software node: get rid of property_set_pointer()
Instead of explicitly setting values of integer types when copying
property entries lets just copy entire value union when processing
non-array values.
For value arrays we no longer use union of pointers, but rather a single
void pointer, which allows us to remove property_set_pointer().
In property_get_pointer() we do not need to handle each data type
separately, we can simply return either the pointer or pointer to values
union.
We are not losing anything from removing typed pointer union because the
upper layers do their accesses through void pointers anyway, and we
trust the "type" of the property when interpret the data. We rely on
users of property entries on using PROPERTY_ENTRY_XXX() macros to
properly initialize entries instead of poking in the instances directly.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.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 | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/include/linux/property.h b/include/linux/property.h index d6019bacd848..12eff7cbb395 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -238,13 +238,7 @@ struct property_entry { bool is_array; enum dev_prop_type type; union { - union { - const u8 *u8_data; - const u16 *u16_data; - const u32 *u32_data; - const u64 *u64_data; - const char * const *str; - } pointer; + const void *pointer; union { u8 u8_data; u16 u16_data; @@ -267,7 +261,7 @@ struct property_entry { .length = (_len_) * sizeof(_type_), \ .is_array = true, \ .type = DEV_PROP_##_Type_, \ - { .pointer = { ._type_##_data = _val_ } }, \ + { .pointer = _val_ }, \ } #define PROPERTY_ENTRY_U8_ARRAY_LEN(_name_, _val_, _len_) \ @@ -285,7 +279,7 @@ struct property_entry { .length = (_len_) * sizeof(const char *), \ .is_array = true, \ .type = DEV_PROP_STRING, \ - { .pointer = { .str = _val_ } }, \ + { .pointer = _val_ }, \ } #define PROPERTY_ENTRY_U8_ARRAY(_name_, _val_) \ |