device property: Define type of PROPERTY_ENRTY_*() macros
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 22 Jan 2018 16:01:42 +0000 (18:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2018 12:44:20 +0000 (13:44 +0100)
Some of the drivers may use the macro at runtime flow, like

  struct property_entry p[10];
...
  p[index++] = PROPERTY_ENTRY_U8("u8 property", u8_data);

In that case and absence of the data type compiler fails the build:

drivers/char/ipmi/ipmi_dmi.c:79:29: error: Expected ; at end of statement
drivers/char/ipmi/ipmi_dmi.c:79:29: error: got {

Acked-by: Corey Minyard <cminyard@mvista.com>
Cc: Corey Minyard <minyard@acm.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/property.h

index f6189a3ac63ca2f57d4a29ee49df68148a957675..2e3a7c24659e43978f4d099f5a104922b6bba9c5 100644 (file)
@@ -206,7 +206,7 @@ struct property_entry {
  */
 
 #define PROPERTY_ENTRY_INTEGER_ARRAY(_name_, _type_, _val_)    \
-{                                                              \
+(struct property_entry) {                                      \
        .name = _name_,                                         \
        .length = ARRAY_SIZE(_val_) * sizeof(_type_),           \
        .is_array = true,                                       \
@@ -224,7 +224,7 @@ struct property_entry {
        PROPERTY_ENTRY_INTEGER_ARRAY(_name_, u64, _val_)
 
 #define PROPERTY_ENTRY_STRING_ARRAY(_name_, _val_)             \
-{                                                              \
+(struct property_entry) {                                      \
        .name = _name_,                                         \
        .length = ARRAY_SIZE(_val_) * sizeof(const char *),     \
        .is_array = true,                                       \
@@ -233,7 +233,7 @@ struct property_entry {
 }
 
 #define PROPERTY_ENTRY_INTEGER(_name_, _type_, _val_)  \
-{                                                      \
+(struct property_entry) {                              \
        .name = _name_,                                 \
        .length = sizeof(_type_),                       \
        .is_string = false,                             \
@@ -250,7 +250,7 @@ struct property_entry {
        PROPERTY_ENTRY_INTEGER(_name_, u64, _val_)
 
 #define PROPERTY_ENTRY_STRING(_name_, _val_)           \
-{                                                      \
+(struct property_entry) {                              \
        .name = _name_,                                 \
        .length = sizeof(_val_),                        \
        .is_string = true,                              \
@@ -258,7 +258,7 @@ struct property_entry {
 }
 
 #define PROPERTY_ENTRY_BOOL(_name_)            \
-{                                              \
+(struct property_entry) {                      \
        .name = _name_,                         \
 }