All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] device property: Define type of PROPERTY_ENRTY_*() macros
@ 2018-01-22 15:33 Andy Shevchenko
  2018-01-22 15:47 ` Corey Minyard
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2018-01-22 15:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel, Rafael J . Wysocki,
	Sakari Ailus, mika.westerberg
  Cc: Andy Shevchenko, Corey Minyard

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 {

Cc: Corey Minyard <minyard@acm.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 include/linux/property.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/linux/property.h b/include/linux/property.h
index 7eefaf2f22b9..f144be4f99e0 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -204,7 +204,7 @@ struct property_entry {
  */
 
 #define PROPERTY_ENTRY_INTEGER_ARRAY(_name_, _type_, _Type_, _val_)	\
-{									\
+(struct property_entry) {						\
 	.name = _name_,							\
 	.length = ARRAY_SIZE(_val_) * sizeof(_type_),			\
 	.is_array = true,						\
@@ -222,7 +222,7 @@ struct property_entry {
 	PROPERTY_ENTRY_INTEGER_ARRAY(_name_, u64, U64, _val_)
 
 #define PROPERTY_ENTRY_STRING_ARRAY(_name_, _val_)		\
-{								\
+(struct property_entry) {					\
 	.name = _name_,						\
 	.length = ARRAY_SIZE(_val_) * sizeof(const char *),	\
 	.is_array = true,					\
@@ -231,7 +231,7 @@ struct property_entry {
 }
 
 #define PROPERTY_ENTRY_INTEGER(_name_, _type_, _Type_, _val_)	\
-{								\
+(struct property_entry) {					\
 	.name = _name_,						\
 	.length = sizeof(_type_),				\
 	.type = DEV_PROP_##_Type_,				\
@@ -248,7 +248,7 @@ struct property_entry {
 	PROPERTY_ENTRY_INTEGER(_name_, u64, U64, _val_)
 
 #define PROPERTY_ENTRY_STRING(_name_, _val_)		\
-{							\
+(struct property_entry) {				\
 	.name = _name_,					\
 	.length = sizeof(_val_),			\
 	.type = DEV_PROP_STRING,			\
@@ -256,7 +256,7 @@ struct property_entry {
 }
 
 #define PROPERTY_ENTRY_BOOL(_name_)		\
-{						\
+(struct property_entry) {			\
 	.name = _name_,				\
 }
 
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] device property: Define type of PROPERTY_ENRTY_*() macros
  2018-01-22 15:33 [PATCH v1] device property: Define type of PROPERTY_ENRTY_*() macros Andy Shevchenko
@ 2018-01-22 15:47 ` Corey Minyard
  0 siblings, 0 replies; 2+ messages in thread
From: Corey Minyard @ 2018-01-22 15:47 UTC (permalink / raw)
  To: Andy Shevchenko, Greg Kroah-Hartman, linux-kernel,
	Rafael J . Wysocki, Sakari Ailus, mika.westerberg

On 01/22/2018 09:33 AM, Andy Shevchenko wrote:
> 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 {
>
> Cc: Corey Minyard <minyard@acm.org>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

This looks good to me.

Acked-by: Corey Minyard <cminyard@mvista.com>

> ---
>   include/linux/property.h | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/include/linux/property.h b/include/linux/property.h
> index 7eefaf2f22b9..f144be4f99e0 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -204,7 +204,7 @@ struct property_entry {
>    */
>   
>   #define PROPERTY_ENTRY_INTEGER_ARRAY(_name_, _type_, _Type_, _val_)	\
> -{									\
> +(struct property_entry) {						\
>   	.name = _name_,							\
>   	.length = ARRAY_SIZE(_val_) * sizeof(_type_),			\
>   	.is_array = true,						\
> @@ -222,7 +222,7 @@ struct property_entry {
>   	PROPERTY_ENTRY_INTEGER_ARRAY(_name_, u64, U64, _val_)
>   
>   #define PROPERTY_ENTRY_STRING_ARRAY(_name_, _val_)		\
> -{								\
> +(struct property_entry) {					\
>   	.name = _name_,						\
>   	.length = ARRAY_SIZE(_val_) * sizeof(const char *),	\
>   	.is_array = true,					\
> @@ -231,7 +231,7 @@ struct property_entry {
>   }
>   
>   #define PROPERTY_ENTRY_INTEGER(_name_, _type_, _Type_, _val_)	\
> -{								\
> +(struct property_entry) {					\
>   	.name = _name_,						\
>   	.length = sizeof(_type_),				\
>   	.type = DEV_PROP_##_Type_,				\
> @@ -248,7 +248,7 @@ struct property_entry {
>   	PROPERTY_ENTRY_INTEGER(_name_, u64, U64, _val_)
>   
>   #define PROPERTY_ENTRY_STRING(_name_, _val_)		\
> -{							\
> +(struct property_entry) {				\
>   	.name = _name_,					\
>   	.length = sizeof(_val_),			\
>   	.type = DEV_PROP_STRING,			\
> @@ -256,7 +256,7 @@ struct property_entry {
>   }
>   
>   #define PROPERTY_ENTRY_BOOL(_name_)		\
> -{						\
> +(struct property_entry) {			\
>   	.name = _name_,				\
>   }
>   

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-22 15:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-22 15:33 [PATCH v1] device property: Define type of PROPERTY_ENRTY_*() macros Andy Shevchenko
2018-01-22 15:47 ` Corey Minyard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.