linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] device property: post merge fixes
@ 2015-12-23 13:34 Andy Shevchenko
  2015-12-23 13:34 ` [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Andy Shevchenko @ 2015-12-23 13:34 UTC (permalink / raw)
  To: Stephen Rothwell, linux-next, akpm, linux-kernel,
	heikki.krogerus, Rafael J. Wysocki, linux-acpi
  Cc: Andy Shevchenko

Three fixes to device property API.

Patch 1 is a simple style fix to be folded into previous Andrew's patch to
allow old gcc to build.

There is a crash in linux-next
 BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
 IP: [<ffffffff8145e8a6>] fwnode_property_present+0x16/0x30

Check for fwnode pointer before dereference (patch 2).

Patch 3 prevents to allocate buffers with 0 length (the result maybe surprising
to someone).


Andy Shevchenko (2):
  device property: add spaces to PROPERTY_ENTRY_STRING macro
  device property: avoid allocations of 0 length

Heikki Krogerus (1):
  device property: the secondary fwnode needs to depend on the primary

 drivers/base/property.c  | 14 ++++++++++----
 include/linux/property.h |  2 +-
 2 files changed, 11 insertions(+), 5 deletions(-)

-- 
2.6.4


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

* [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
  2015-12-23 13:34 [PATCH v2 0/3] device property: post merge fixes Andy Shevchenko
@ 2015-12-23 13:34 ` Andy Shevchenko
  2015-12-28  1:12   ` Rafael J. Wysocki
  2015-12-23 13:34 ` [PATCH v2 2/3] device property: the secondary fwnode needs to depend on the primary Andy Shevchenko
  2015-12-23 13:34 ` [PATCH v2 3/3] device property: avoid allocations of 0 length Andy Shevchenko
  2 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2015-12-23 13:34 UTC (permalink / raw)
  To: Stephen Rothwell, linux-next, akpm, linux-kernel,
	heikki.krogerus, Rafael J. Wysocki, linux-acpi
  Cc: Andy Shevchenko

Just a style fix, no functional changes.

To be folded to Andrew's patch.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 include/linux/property.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/property.h b/include/linux/property.h
index b8c4e42..b51fcd3 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -230,7 +230,7 @@ struct property_entry {
 	.name = _name_,					\
 	.length = sizeof(_val_),			\
 	.is_string = true,				\
-	{ .value = {.str = _val_} },			\
+	{ .value = { .str = _val_ } },			\
 }
 
 #define PROPERTY_ENTRY_BOOL(_name_)		\
-- 
2.6.4


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

* [PATCH v2 2/3] device property: the secondary fwnode needs to depend on the primary
  2015-12-23 13:34 [PATCH v2 0/3] device property: post merge fixes Andy Shevchenko
  2015-12-23 13:34 ` [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro Andy Shevchenko
@ 2015-12-23 13:34 ` Andy Shevchenko
  2015-12-29  8:40   ` Heikki Krogerus
  2015-12-23 13:34 ` [PATCH v2 3/3] device property: avoid allocations of 0 length Andy Shevchenko
  2 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2015-12-23 13:34 UTC (permalink / raw)
  To: Stephen Rothwell, linux-next, akpm, linux-kernel,
	heikki.krogerus, Rafael J. Wysocki, linux-acpi
  Cc: Andy Shevchenko

From: Heikki Krogerus <heikki.krogerus@linux.intel.com>

This fixes NULL pointer dereference when the primary fwnode handle
does not exist, for example with PCI devices that do not have ACPI
companion.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/base/property.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/base/property.c b/drivers/base/property.c
index 0b22c8a..6c04d18 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -218,7 +218,7 @@ bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname)
 	bool ret;
 
 	ret = __fwnode_property_present(fwnode, propname);
-	if (ret == false && fwnode->secondary)
+	if (ret == false && fwnode && fwnode->secondary)
 		ret = __fwnode_property_present(fwnode->secondary, propname);
 	return ret;
 }
@@ -423,7 +423,7 @@ EXPORT_SYMBOL_GPL(device_property_match_string);
 	int _ret_;									\
 	_ret_ = FWNODE_PROP_READ(_fwnode_, _propname_, _type_, _proptype_,		\
 				 _val_, _nval_);					\
-	if (_ret_ == -EINVAL && _fwnode_->secondary)					\
+	if (_ret_ == -EINVAL && fwnode && _fwnode_->secondary)				\
 		_ret_ = FWNODE_PROP_READ(_fwnode_->secondary, _propname_, _type_,	\
 				_proptype_, _val_, _nval_);				\
 	_ret_;										\
@@ -593,7 +593,7 @@ int fwnode_property_read_string_array(struct fwnode_handle *fwnode,
 	int ret;
 
 	ret = __fwnode_property_read_string_array(fwnode, propname, val, nval);
-	if (ret == -EINVAL && fwnode->secondary)
+	if (ret == -EINVAL && fwnode && fwnode->secondary)
 		ret = __fwnode_property_read_string_array(fwnode->secondary,
 							  propname, val, nval);
 	return ret;
@@ -621,7 +621,7 @@ int fwnode_property_read_string(struct fwnode_handle *fwnode,
 	int ret;
 
 	ret = __fwnode_property_read_string(fwnode, propname, val);
-	if (ret == -EINVAL && fwnode->secondary)
+	if (ret == -EINVAL && fwnode && fwnode->secondary)
 		ret = __fwnode_property_read_string(fwnode->secondary,
 						    propname, val);
 	return ret;
-- 
2.6.4


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

* [PATCH v2 3/3] device property: avoid allocations of 0 length
  2015-12-23 13:34 [PATCH v2 0/3] device property: post merge fixes Andy Shevchenko
  2015-12-23 13:34 ` [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro Andy Shevchenko
  2015-12-23 13:34 ` [PATCH v2 2/3] device property: the secondary fwnode needs to depend on the primary Andy Shevchenko
@ 2015-12-23 13:34 ` Andy Shevchenko
  2 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2015-12-23 13:34 UTC (permalink / raw)
  To: Stephen Rothwell, linux-next, akpm, linux-kernel,
	heikki.krogerus, Rafael J. Wysocki, linux-acpi
  Cc: Andy Shevchenko

Arrays can not have zero elements by definition of the unified device
properties. If such property comes from outside we should not allow it to pass.
Otherwise memory allocation on 0 length will return non-NULL value, which we
currently don't check.

Prevent memory allocations of 0 length.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/base/property.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/base/property.c b/drivers/base/property.c
index 6c04d18..7e2061b 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -653,6 +653,9 @@ int fwnode_property_match_string(struct fwnode_handle *fwnode,
 	if (nval < 0)
 		return nval;
 
+	if (nval == 0)
+		return -ENODATA;
+
 	values = kcalloc(nval, sizeof(*values), GFP_KERNEL);
 	if (!values)
 		return -ENOMEM;
@@ -718,6 +721,9 @@ static int pset_copy_entry(struct property_entry *dst,
 		return -ENOMEM;
 
 	if (src->is_array) {
+		if (!src->length)
+			return -ENODATA;
+
 		if (src->is_string) {
 			nval = src->length / sizeof(const char *);
 			dst->pointer.str = kcalloc(nval, sizeof(const char *),
-- 
2.6.4


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

* Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
  2015-12-23 13:34 ` [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro Andy Shevchenko
@ 2015-12-28  1:12   ` Rafael J. Wysocki
  2015-12-28 11:24     ` Andy Shevchenko
  0 siblings, 1 reply; 15+ messages in thread
From: Rafael J. Wysocki @ 2015-12-28  1:12 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Stephen Rothwell, linux-next, akpm, linux-kernel,
	heikki.krogerus, linux-acpi

On Wednesday, December 23, 2015 03:34:42 PM Andy Shevchenko wrote:
> Just a style fix, no functional changes.
> 
> To be folded to Andrew's patch.

What patch?

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  include/linux/property.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/property.h b/include/linux/property.h
> index b8c4e42..b51fcd3 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -230,7 +230,7 @@ struct property_entry {
>  	.name = _name_,					\
>  	.length = sizeof(_val_),			\
>  	.is_string = true,				\
> -	{ .value = {.str = _val_} },			\
> +	{ .value = { .str = _val_ } },			\
>  }
>  
>  #define PROPERTY_ENTRY_BOOL(_name_)		\
> 

Thanks,
Rafael


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

* Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
  2015-12-28  1:12   ` Rafael J. Wysocki
@ 2015-12-28 11:24     ` Andy Shevchenko
  2015-12-30  1:49       ` Rafael J. Wysocki
  0 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2015-12-28 11:24 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Stephen Rothwell, linux-next, akpm, linux-kernel,
	heikki.krogerus, linux-acpi

On Mon, 2015-12-28 at 02:12 +0100, Rafael J. Wysocki wrote:
> On Wednesday, December 23, 2015 03:34:42 PM Andy Shevchenko wrote:
> > Just a style fix, no functional changes.
> > 
> > To be folded to Andrew's patch.
> 
> What patch?

In linux-next from Andrew:

e39ece7 include-linux-propertyh-fix-build-issues-with-gcc-444-fix
40bb8a1 include/linux/property.h: fix build issues with gcc-4.4.4

> 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  include/linux/property.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/include/linux/property.h b/include/linux/property.h
> > index b8c4e42..b51fcd3 100644
> > --- a/include/linux/property.h
> > +++ b/include/linux/property.h
> > @@ -230,7 +230,7 @@ struct property_entry {
> >  	.name = _name_,					\
> >  	.length = sizeof(_val_),			\
> >  	.is_string = true,				\
> > -	{ .value = {.str = _val_} },			\
> > +	{ .value = { .str = _val_ } },			\
> >  }
> >  
> >  #define PROPERTY_ENTRY_BOOL(_name_)		\
> > 
> 
> Thanks,
> Rafael
> 

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy


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

* Re: [PATCH v2 2/3] device property: the secondary fwnode needs to depend on the primary
  2015-12-23 13:34 ` [PATCH v2 2/3] device property: the secondary fwnode needs to depend on the primary Andy Shevchenko
@ 2015-12-29  8:40   ` Heikki Krogerus
  2015-12-29 10:57     ` Andy Shevchenko
  0 siblings, 1 reply; 15+ messages in thread
From: Heikki Krogerus @ 2015-12-29  8:40 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Stephen Rothwell, linux-next, akpm, linux-kernel,
	Rafael J. Wysocki, linux-acpi

Hi Andy,

Found a bug from my code..

> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index 0b22c8a..6c04d18 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -218,7 +218,7 @@ bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname)
>  	bool ret;
>  
>  	ret = __fwnode_property_present(fwnode, propname);
> -	if (ret == false && fwnode->secondary)
> +	if (ret == false && fwnode && fwnode->secondary)
>  		ret = __fwnode_property_present(fwnode->secondary, propname);
>  	return ret;
>  }
> @@ -423,7 +423,7 @@ EXPORT_SYMBOL_GPL(device_property_match_string);
>  	int _ret_;									\
>  	_ret_ = FWNODE_PROP_READ(_fwnode_, _propname_, _type_, _proptype_,		\
>  				 _val_, _nval_);					\
> -	if (_ret_ == -EINVAL && _fwnode_->secondary)					\
> +	if (_ret_ == -EINVAL && fwnode && _fwnode_->secondary)				\

This should be .._fwnode_ && _fwnode_->secondary)

>  		_ret_ = FWNODE_PROP_READ(_fwnode_->secondary, _propname_, _type_,	\
>  				_proptype_, _val_, _nval_);				\
>  	_ret_;										\


Cheers,

-- 
heikki

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

* Re: [PATCH v2 2/3] device property: the secondary fwnode needs to depend on the primary
  2015-12-29  8:40   ` Heikki Krogerus
@ 2015-12-29 10:57     ` Andy Shevchenko
  0 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2015-12-29 10:57 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: Stephen Rothwell, linux-next, akpm, linux-kernel,
	Rafael J. Wysocki, linux-acpi

On Tue, 2015-12-29 at 10:40 +0200, Heikki Krogerus wrote:
> Hi Andy,
> 
> Found a bug from my code..
> 
> > diff --git a/drivers/base/property.c b/drivers/base/property.c
> > index 0b22c8a..6c04d18 100644
> > --- a/drivers/base/property.c
> > +++ b/drivers/base/property.c
> > @@ -218,7 +218,7 @@ bool fwnode_property_present(struct
> > fwnode_handle *fwnode, const char *propname)
> >  	bool ret;
> >  
> >  	ret = __fwnode_property_present(fwnode, propname);
> > -	if (ret == false && fwnode->secondary)
> > +	if (ret == false && fwnode && fwnode->secondary)
> >  		ret = __fwnode_property_present(fwnode->secondary, 
> > propname);
> >  	return ret;
> >  }
> > @@ -423,7 +423,7 @@
> > EXPORT_SYMBOL_GPL(device_property_match_string);
> >  	int _ret_;							
> > 		\
> >  	_ret_ = FWNODE_PROP_READ(_fwnode_, _propname_, _type_,
> > _proptype_,		\
> >  				 _val_, _nval_);			
> > 		\
> > -	if (_ret_ == -EINVAL && _fwnode_->secondary)		
> > 			\
> > +	if (_ret_ == -EINVAL && fwnode && _fwnode_->secondary)	
> > 			\
> 
> This should be .._fwnode_ && _fwnode_->secondary)

Yeah, we compiled it correctly due to fwnode presents in all
occurrences of this macro.

I will fix and resend a new version.

> 
> >  		_ret_ = FWNODE_PROP_READ(_fwnode_->secondary,
> > _propname_, _type_,	\
> >  				_proptype_, _val_, _nval_);	
> > 			\
> >  	_ret_;							
> > 			\
> 
> 
> Cheers,
> 

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy


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

* Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
  2015-12-30  1:49       ` Rafael J. Wysocki
@ 2015-12-30  1:24         ` Andrew Morton
  2015-12-30  2:06           ` Rafael J. Wysocki
  2015-12-30  1:29         ` Andy Shevchenko
  1 sibling, 1 reply; 15+ messages in thread
From: Andrew Morton @ 2015-12-30  1:24 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Andy Shevchenko, Stephen Rothwell, linux-next, linux-kernel,
	heikki.krogerus, linux-acpi

On Wed, 30 Dec 2015 02:49:26 +0100 "Rafael J. Wysocki" <rjw@rjwysocki.net> wrote:

> On Monday, December 28, 2015 01:24:13 PM Andy Shevchenko wrote:
> > On Mon, 2015-12-28 at 02:12 +0100, Rafael J. Wysocki wrote:
> > > On Wednesday, December 23, 2015 03:34:42 PM Andy Shevchenko wrote:
> > > > Just a style fix, no functional changes.
> > > > 
> > > > To be folded to Andrew's patch.
> > > 
> > > What patch?
> > 
> > In linux-next from Andrew:
> > 
> > e39ece7 include-linux-propertyh-fix-build-issues-with-gcc-444-fix
> > 40bb8a1 include/linux/property.h: fix build issues with gcc-4.4.4
> 
> Any pointers to the original patch submission(s)?

I think it was discussed in some followup to something else, I forget.

This:

From: Andrew Morton <akpm@linux-foundation.org>
Subject: 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.

Cc: Kevin Fenzi <kevin@scrye.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/property.h |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff -puN include/linux/property.h~include-linux-propertyh-fix-build-issues-with-gcc-444 include/linux/property.h
--- a/include/linux/property.h~include-linux-propertyh-fix-build-issues-with-gcc-444
+++ a/include/linux/property.h
@@ -175,12 +175,19 @@ struct property_entry {
 	};
 };
 
+/*
+ * Note: the below four initializers for the anonymous union are carefully
+ * crafted to avoid gcc-4.4.4's problems with initialization of anon unions
+ * and structs.
+ */
+
 #define PROPERTY_ENTRY_INTEGER_ARRAY(_name_, _type_, _val_)	\
 {								\
 	.name = _name_,						\
 	.length = ARRAY_SIZE(_val_) * sizeof(_type_),		\
 	.is_array = true,					\
-	.pointer._type_##_data = _val_,				\
+	.is_string = false,					\
+	{ .pointer = _type_##_data = _val_ } },			\
 }
 
 #define PROPERTY_ENTRY_U8_ARRAY(_name_, _val_)			\
@@ -198,14 +205,15 @@ struct property_entry {
 	.length = ARRAY_SIZE(_val_) * sizeof(const char *),	\
 	.is_array = true,					\
 	.is_string = true,					\
-	.pointer.str = _val_,					\
+	{ .pointer = { .str = _val_ } },			\
 }
 
 #define PROPERTY_ENTRY_INTEGER(_name_, _type_, _val_)	\
 {							\
 	.name = _name_,					\
 	.length = sizeof(_type_),			\
-	.value._type_##_data = _val_,			\
+	.is_string = false,				\
+	{ .value = { ._type_##_data = _val_ } },	\
 }
 
 #define PROPERTY_ENTRY_U8(_name_, _val_)		\
@@ -222,7 +230,7 @@ struct property_entry {
 	.name = _name_,					\
 	.length = sizeof(_val_),			\
 	.is_string = true,				\
-	.value.str = _val_,				\
+	{ .value = {.str = _val_} },			\
 }
 
 #define PROPERTY_ENTRY_BOOL(_name_)		\
_


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

* Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
  2015-12-30  1:49       ` Rafael J. Wysocki
  2015-12-30  1:24         ` Andrew Morton
@ 2015-12-30  1:29         ` Andy Shevchenko
  1 sibling, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2015-12-30  1:29 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Andy Shevchenko, Stephen Rothwell, linux-next, Andrew Morton,
	linux-kernel, Krogerus, Heikki, linux-acpi

On Wed, Dec 30, 2015 at 3:49 AM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Monday, December 28, 2015 01:24:13 PM Andy Shevchenko wrote:
>> On Mon, 2015-12-28 at 02:12 +0100, Rafael J. Wysocki wrote:
>> > On Wednesday, December 23, 2015 03:34:42 PM Andy Shevchenko wrote:
>> > > Just a style fix, no functional changes.
>> > >
>> > > To be folded to Andrew's patch.
>> >
>> > What patch?
>>
>> In linux-next from Andrew:
>>
>> e39ece7 include-linux-propertyh-fix-build-issues-with-gcc-444-fix
>> 40bb8a1 include/linux/property.h: fix build issues with gcc-4.4.4
>
> Any pointers to the original patch submission(s)?

Yes, I found one [1] and added to v3 of this patch [2]

[1] http://comments.gmane.org/gmane.linux.kernel.commits.mm/97592
[2] http://www.spinics.net/lists/kernel/msg2151801.html

>
> Thanks,
> Rafael
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
  2015-12-30  2:06           ` Rafael J. Wysocki
@ 2015-12-30  1:43             ` Andy Shevchenko
  2015-12-30  1:44             ` Andrew Morton
  1 sibling, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2015-12-30  1:43 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Andrew Morton, Andy Shevchenko, Stephen Rothwell, linux-next,
	linux-kernel, Krogerus, Heikki, linux-acpi

On Wed, Dec 30, 2015 at 4:06 AM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Tuesday, December 29, 2015 05:24:53 PM Andrew Morton wrote:
>> On Wed, 30 Dec 2015 02:49:26 +0100 "Rafael J. Wysocki" <rjw@rjwysocki.net> wrote:
>>
>> > On Monday, December 28, 2015 01:24:13 PM Andy Shevchenko wrote:
>> > > On Mon, 2015-12-28 at 02:12 +0100, Rafael J. Wysocki wrote:
>> > > > On Wednesday, December 23, 2015 03:34:42 PM Andy Shevchenko wrote:
>> > > > > Just a style fix, no functional changes.
>> > > > >
>> > > > > To be folded to Andrew's patch.
>> > > >
>> > > > What patch?
>> > >
>> > > In linux-next from Andrew:
>> > >
>> > > e39ece7 include-linux-propertyh-fix-build-issues-with-gcc-444-fix
>> > > 40bb8a1 include/linux/property.h: fix build issues with gcc-4.4.4
>> >
>> > Any pointers to the original patch submission(s)?
>>
>> I think it was discussed in some followup to something else, I forget.
>>
>> This:
>>
>> From: Andrew Morton <akpm@linux-foundation.org>
>> Subject: include/linux/property.h: fix build issues with gcc-4.4.4
>
> OK, thanks!
>
> I'll apply it to my tree if you don't mind with the Andy's [1/3] on top
> so we have all of that in one place.

Be aware that there are actually _two_ patches from Andrew and _one_
from me to be all folded together.
I think there is no need to have 3 of them.

>
> Thanks,
> Rafael
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
  2015-12-30  2:06           ` Rafael J. Wysocki
  2015-12-30  1:43             ` Andy Shevchenko
@ 2015-12-30  1:44             ` Andrew Morton
  2016-01-01  0:53               ` Rafael J. Wysocki
  1 sibling, 1 reply; 15+ messages in thread
From: Andrew Morton @ 2015-12-30  1:44 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Andy Shevchenko, Stephen Rothwell, linux-next, linux-kernel,
	heikki.krogerus, linux-acpi

On Wed, 30 Dec 2015 03:06:23 +0100 "Rafael J. Wysocki" <rjw@rjwysocki.net> wrote:

> I'll apply it to my tree if you don't mind with the Andy's [1/3] on top
> so we have all of that in one place.

That version needed a fix.  Here's the one to apply:


From: Andrew Morton <akpm@linux-foundation.org>
Subject: 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.

Cc: Kevin Fenzi <kevin@scrye.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/property.h |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff -puN include/linux/property.h~include-linux-propertyh-fix-build-issues-with-gcc-444 include/linux/property.h
--- a/include/linux/property.h~include-linux-propertyh-fix-build-issues-with-gcc-444
+++ a/include/linux/property.h
@@ -175,12 +175,19 @@ struct property_entry {
 	};
 };
 
+/*
+ * Note: the below four initializers for the anonymous union are carefully
+ * crafted to avoid gcc-4.4.4's problems with initialization of anon unions
+ * and structs.
+ */
+
 #define PROPERTY_ENTRY_INTEGER_ARRAY(_name_, _type_, _val_)	\
 {								\
 	.name = _name_,						\
 	.length = ARRAY_SIZE(_val_) * sizeof(_type_),		\
 	.is_array = true,					\
-	.pointer._type_##_data = _val_,				\
+	.is_string = false,					\
+	{ .pointer = { _type_##_data = _val_ } },		\
 }
 
 #define PROPERTY_ENTRY_U8_ARRAY(_name_, _val_)			\
@@ -198,14 +205,15 @@ struct property_entry {
 	.length = ARRAY_SIZE(_val_) * sizeof(const char *),	\
 	.is_array = true,					\
 	.is_string = true,					\
-	.pointer.str = _val_,					\
+	{ .pointer = { .str = _val_ } },			\
 }
 
 #define PROPERTY_ENTRY_INTEGER(_name_, _type_, _val_)	\
 {							\
 	.name = _name_,					\
 	.length = sizeof(_type_),			\
-	.value._type_##_data = _val_,			\
+	.is_string = false,				\
+	{ .value = { ._type_##_data = _val_ } },	\
 }
 
 #define PROPERTY_ENTRY_U8(_name_, _val_)		\
@@ -222,7 +230,7 @@ struct property_entry {
 	.name = _name_,					\
 	.length = sizeof(_val_),			\
 	.is_string = true,				\
-	.value.str = _val_,				\
+	{ .value = {.str = _val_} },			\
 }
 
 #define PROPERTY_ENTRY_BOOL(_name_)		\
_


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

* Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
  2015-12-28 11:24     ` Andy Shevchenko
@ 2015-12-30  1:49       ` Rafael J. Wysocki
  2015-12-30  1:24         ` Andrew Morton
  2015-12-30  1:29         ` Andy Shevchenko
  0 siblings, 2 replies; 15+ messages in thread
From: Rafael J. Wysocki @ 2015-12-30  1:49 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Stephen Rothwell, linux-next, akpm, linux-kernel,
	heikki.krogerus, linux-acpi

On Monday, December 28, 2015 01:24:13 PM Andy Shevchenko wrote:
> On Mon, 2015-12-28 at 02:12 +0100, Rafael J. Wysocki wrote:
> > On Wednesday, December 23, 2015 03:34:42 PM Andy Shevchenko wrote:
> > > Just a style fix, no functional changes.
> > > 
> > > To be folded to Andrew's patch.
> > 
> > What patch?
> 
> In linux-next from Andrew:
> 
> e39ece7 include-linux-propertyh-fix-build-issues-with-gcc-444-fix
> 40bb8a1 include/linux/property.h: fix build issues with gcc-4.4.4

Any pointers to the original patch submission(s)?

Thanks,
Rafael


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

* Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
  2015-12-30  1:24         ` Andrew Morton
@ 2015-12-30  2:06           ` Rafael J. Wysocki
  2015-12-30  1:43             ` Andy Shevchenko
  2015-12-30  1:44             ` Andrew Morton
  0 siblings, 2 replies; 15+ messages in thread
From: Rafael J. Wysocki @ 2015-12-30  2:06 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Andy Shevchenko, Stephen Rothwell, linux-next, linux-kernel,
	heikki.krogerus, linux-acpi

On Tuesday, December 29, 2015 05:24:53 PM Andrew Morton wrote:
> On Wed, 30 Dec 2015 02:49:26 +0100 "Rafael J. Wysocki" <rjw@rjwysocki.net> wrote:
> 
> > On Monday, December 28, 2015 01:24:13 PM Andy Shevchenko wrote:
> > > On Mon, 2015-12-28 at 02:12 +0100, Rafael J. Wysocki wrote:
> > > > On Wednesday, December 23, 2015 03:34:42 PM Andy Shevchenko wrote:
> > > > > Just a style fix, no functional changes.
> > > > > 
> > > > > To be folded to Andrew's patch.
> > > > 
> > > > What patch?
> > > 
> > > In linux-next from Andrew:
> > > 
> > > e39ece7 include-linux-propertyh-fix-build-issues-with-gcc-444-fix
> > > 40bb8a1 include/linux/property.h: fix build issues with gcc-4.4.4
> > 
> > Any pointers to the original patch submission(s)?
> 
> I think it was discussed in some followup to something else, I forget.
> 
> This:
> 
> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: include/linux/property.h: fix build issues with gcc-4.4.4

OK, thanks!

I'll apply it to my tree if you don't mind with the Andy's [1/3] on top
so we have all of that in one place.

Thanks,
Rafael


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

* Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
  2015-12-30  1:44             ` Andrew Morton
@ 2016-01-01  0:53               ` Rafael J. Wysocki
  0 siblings, 0 replies; 15+ messages in thread
From: Rafael J. Wysocki @ 2016-01-01  0:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Andy Shevchenko, Stephen Rothwell, linux-next, linux-kernel,
	heikki.krogerus, linux-acpi

On Tuesday, December 29, 2015 05:44:48 PM Andrew Morton wrote:
> On Wed, 30 Dec 2015 03:06:23 +0100 "Rafael J. Wysocki" <rjw@rjwysocki.net> wrote:
> 
> > I'll apply it to my tree if you don't mind with the Andy's [1/3] on top
> > so we have all of that in one place.
> 
> That version needed a fix.  Here's the one to apply:

OK, thanks!


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

end of thread, other threads:[~2016-01-01  0:22 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-23 13:34 [PATCH v2 0/3] device property: post merge fixes Andy Shevchenko
2015-12-23 13:34 ` [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro Andy Shevchenko
2015-12-28  1:12   ` Rafael J. Wysocki
2015-12-28 11:24     ` Andy Shevchenko
2015-12-30  1:49       ` Rafael J. Wysocki
2015-12-30  1:24         ` Andrew Morton
2015-12-30  2:06           ` Rafael J. Wysocki
2015-12-30  1:43             ` Andy Shevchenko
2015-12-30  1:44             ` Andrew Morton
2016-01-01  0:53               ` Rafael J. Wysocki
2015-12-30  1:29         ` Andy Shevchenko
2015-12-23 13:34 ` [PATCH v2 2/3] device property: the secondary fwnode needs to depend on the primary Andy Shevchenko
2015-12-29  8:40   ` Heikki Krogerus
2015-12-29 10:57     ` Andy Shevchenko
2015-12-23 13:34 ` [PATCH v2 3/3] device property: avoid allocations of 0 length Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).