Skip to content

Commit

Permalink
device property: Define type of PROPERTY_ENRTY_*() macros
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Corey Minyard <[email protected]>
Signed-off-by: Andy Shevchenko <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
andy-shev authored and gregkh committed Jan 25, 2018
1 parent b2ca8bd commit c505cbd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions include/linux/property.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
Expand All @@ -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, \
Expand All @@ -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, \
Expand All @@ -250,15 +250,15 @@ 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, \
{ .value = { .str = _val_ } }, \
}

#define PROPERTY_ENTRY_BOOL(_name_) \
{ \
(struct property_entry) { \
.name = _name_, \
}

Expand Down

0 comments on commit c505cbd

Please sign in to comment.