diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2015-12-31 20:07:09 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-12-31 20:07:09 -0500 |
commit | d76eebfa175e86383324ad2bbaf472866950398b (patch) | |
tree | 5a840ac067f9c2aea2a084b8334ea4c4ca13c14a | |
parent | 4c5301abbf81f4351416cec1e8a02647d96e6fd1 (diff) |
include/linux/property.h: fix build issues with gcc-4.4.4
gcc-4.4.4 has problems with initialization of anonymous unions:
drivers/mfd/intel-lpss-acpi.c:30: error: unknown field 'value' specified in initializer
work around this by crafting the initializers in a manner which the
compiler can handle.
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | include/linux/property.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/include/linux/property.h b/include/linux/property.h index 3a8c7d7773e6..b8c4e420fe87 100644 --- a/include/linux/property.h +++ b/include/linux/property.h | |||
@@ -175,12 +175,19 @@ struct property_entry { | |||
175 | }; | 175 | }; |
176 | }; | 176 | }; |
177 | 177 | ||
178 | /* | ||
179 | * Note: the below four initializers for the anonymous union are carefully | ||
180 | * crafted to avoid gcc-4.4.4's problems with initialization of anon unions | ||
181 | * and structs. | ||
182 | */ | ||
183 | |||
178 | #define PROPERTY_ENTRY_INTEGER_ARRAY(_name_, _type_, _val_) \ | 184 | #define PROPERTY_ENTRY_INTEGER_ARRAY(_name_, _type_, _val_) \ |
179 | { \ | 185 | { \ |
180 | .name = _name_, \ | 186 | .name = _name_, \ |
181 | .length = ARRAY_SIZE(_val_) * sizeof(_type_), \ | 187 | .length = ARRAY_SIZE(_val_) * sizeof(_type_), \ |
182 | .is_array = true, \ | 188 | .is_array = true, \ |
183 | .pointer._type_##_data = _val_, \ | 189 | .is_string = false, \ |
190 | { .pointer = { _type_##_data = _val_ } }, \ | ||
184 | } | 191 | } |
185 | 192 | ||
186 | #define PROPERTY_ENTRY_U8_ARRAY(_name_, _val_) \ | 193 | #define PROPERTY_ENTRY_U8_ARRAY(_name_, _val_) \ |
@@ -198,14 +205,15 @@ struct property_entry { | |||
198 | .length = ARRAY_SIZE(_val_) * sizeof(const char *), \ | 205 | .length = ARRAY_SIZE(_val_) * sizeof(const char *), \ |
199 | .is_array = true, \ | 206 | .is_array = true, \ |
200 | .is_string = true, \ | 207 | .is_string = true, \ |
201 | .pointer.str = _val_, \ | 208 | { .pointer = { .str = _val_ } }, \ |
202 | } | 209 | } |
203 | 210 | ||
204 | #define PROPERTY_ENTRY_INTEGER(_name_, _type_, _val_) \ | 211 | #define PROPERTY_ENTRY_INTEGER(_name_, _type_, _val_) \ |
205 | { \ | 212 | { \ |
206 | .name = _name_, \ | 213 | .name = _name_, \ |
207 | .length = sizeof(_type_), \ | 214 | .length = sizeof(_type_), \ |
208 | .value._type_##_data = _val_, \ | 215 | .is_string = false, \ |
216 | { .value = { ._type_##_data = _val_ } }, \ | ||
209 | } | 217 | } |
210 | 218 | ||
211 | #define PROPERTY_ENTRY_U8(_name_, _val_) \ | 219 | #define PROPERTY_ENTRY_U8(_name_, _val_) \ |
@@ -222,7 +230,7 @@ struct property_entry { | |||
222 | .name = _name_, \ | 230 | .name = _name_, \ |
223 | .length = sizeof(_val_), \ | 231 | .length = sizeof(_val_), \ |
224 | .is_string = true, \ | 232 | .is_string = true, \ |
225 | .value.str = _val_, \ | 233 | { .value = {.str = _val_} }, \ |
226 | } | 234 | } |
227 | 235 | ||
228 | #define PROPERTY_ENTRY_BOOL(_name_) \ | 236 | #define PROPERTY_ENTRY_BOOL(_name_) \ |