* [PATCH 1/2] of: remove extraneous 'const' in typedef
@ 2017-05-11 12:24 Arnd Bergmann
2017-05-11 12:24 ` [PATCH 2/2] of: reserved_mem: fix 'const' annotation Arnd Bergmann
2017-05-11 14:44 ` [PATCH 1/2] of: remove extraneous 'const' in typedef Rob Herring
0 siblings, 2 replies; 8+ messages in thread
From: Arnd Bergmann @ 2017-05-11 12:24 UTC (permalink / raw)
To: Rob Herring, Frank Rowand; +Cc: Arnd Bergmann, devicetree, linux-kernel
One change that was meant to address a sparse warning turned out
to cause hundreds of new gcc-7 warnings:
include/linux/of_irq.h:11:13: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers]
After reverting the change, the gcc warnings are gone again, and I
can't reproduce the sparse warnings either.
Fixes: 17a70355ea57 ("of: fix sparse warnings in fdt, irq, reserved mem, and resolver code")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
include/linux/of_irq.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index ec6b11deb773..1e0deb8e8494 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -8,7 +8,7 @@
#include <linux/ioport.h>
#include <linux/of.h>
-typedef int const (*of_irq_init_cb_t)(struct device_node *, struct device_node *);
+typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *);
/*
* Workarounds only applied to 32bit powermac machines
--
2.9.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] of: reserved_mem: fix 'const' annotation
2017-05-11 12:24 [PATCH 1/2] of: remove extraneous 'const' in typedef Arnd Bergmann
@ 2017-05-11 12:24 ` Arnd Bergmann
2017-05-11 14:50 ` Rob Herring
2017-05-11 14:44 ` [PATCH 1/2] of: remove extraneous 'const' in typedef Rob Herring
1 sibling, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2017-05-11 12:24 UTC (permalink / raw)
To: Rob Herring, Frank Rowand
Cc: Arnd Bergmann, Marek Szyprowski, devicetree, linux-kernel
It's the pointer that is supposed to be const, not the return
type of the function.
drivers/of/of_reserved_mem.c: In function '__reserved_mem_init_node':
drivers/of/of_reserved_mem.c:200:7: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers]
int const (*initfn)(struct reserved_mem *rmem) = i->data;
Fixes: 17a70355ea57 ("of: fix sparse warnings in fdt, irq, reserved mem, and resolver code")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/of/of_reserved_mem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 4dec07ea510f..3f03ec004829 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -197,7 +197,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem)
const struct of_device_id *i;
for (i = __reservedmem_of_table; i < &__rmem_of_table_sentinel; i++) {
- int const (*initfn)(struct reserved_mem *rmem) = i->data;
+ int (* const initfn)(struct reserved_mem *rmem) = i->data;
const char *compat = i->compatible;
if (!of_flat_dt_is_compatible(rmem->fdt_node, compat))
--
2.9.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] of: remove extraneous 'const' in typedef
2017-05-11 12:24 [PATCH 1/2] of: remove extraneous 'const' in typedef Arnd Bergmann
2017-05-11 12:24 ` [PATCH 2/2] of: reserved_mem: fix 'const' annotation Arnd Bergmann
@ 2017-05-11 14:44 ` Rob Herring
2017-05-11 15:03 ` Arnd Bergmann
1 sibling, 1 reply; 8+ messages in thread
From: Rob Herring @ 2017-05-11 14:44 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: Frank Rowand, devicetree, linux-kernel
On Thu, May 11, 2017 at 7:24 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> One change that was meant to address a sparse warning turned out
> to cause hundreds of new gcc-7 warnings:
I guess you are the only one on gcc-7.
> include/linux/of_irq.h:11:13: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers]
>
> After reverting the change, the gcc warnings are gone again, and I
> can't reproduce the sparse warnings either.
Humm, maybe different sparse versions? I'm on 0.5.0.
>
> Fixes: 17a70355ea57 ("of: fix sparse warnings in fdt, irq, reserved mem, and resolver code")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> include/linux/of_irq.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
> index ec6b11deb773..1e0deb8e8494 100644
> --- a/include/linux/of_irq.h
> +++ b/include/linux/of_irq.h
> @@ -8,7 +8,7 @@
> #include <linux/ioport.h>
> #include <linux/of.h>
>
> -typedef int const (*of_irq_init_cb_t)(struct device_node *, struct device_node *);
> +typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *);
>
> /*
> * Workarounds only applied to 32bit powermac machines
> --
> 2.9.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] of: reserved_mem: fix 'const' annotation
2017-05-11 12:24 ` [PATCH 2/2] of: reserved_mem: fix 'const' annotation Arnd Bergmann
@ 2017-05-11 14:50 ` Rob Herring
2017-05-11 15:00 ` Arnd Bergmann
2017-05-11 15:59 ` Luc Van Oostenryck
0 siblings, 2 replies; 8+ messages in thread
From: Rob Herring @ 2017-05-11 14:50 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: Frank Rowand, Marek Szyprowski, devicetree, linux-kernel
On Thu, May 11, 2017 at 7:24 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> It's the pointer that is supposed to be const, not the return
> type of the function.
>
> drivers/of/of_reserved_mem.c: In function '__reserved_mem_init_node':
> drivers/of/of_reserved_mem.c:200:7: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers]
> int const (*initfn)(struct reserved_mem *rmem) = i->data;
>
> Fixes: 17a70355ea57 ("of: fix sparse warnings in fdt, irq, reserved mem, and resolver code")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/of/of_reserved_mem.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
> index 4dec07ea510f..3f03ec004829 100644
> --- a/drivers/of/of_reserved_mem.c
> +++ b/drivers/of/of_reserved_mem.c
> @@ -197,7 +197,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem)
> const struct of_device_id *i;
>
> for (i = __reservedmem_of_table; i < &__rmem_of_table_sentinel; i++) {
> - int const (*initfn)(struct reserved_mem *rmem) = i->data;
> + int (* const initfn)(struct reserved_mem *rmem) = i->data;
Why did you move the const here? That doesn't seem to help with sparse.
I think I'll just revert this back to using reservedmem_of_init_fn.
Rob
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] of: reserved_mem: fix 'const' annotation
2017-05-11 14:50 ` Rob Herring
@ 2017-05-11 15:00 ` Arnd Bergmann
2017-05-11 15:59 ` Luc Van Oostenryck
1 sibling, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2017-05-11 15:00 UTC (permalink / raw)
To: Rob Herring; +Cc: Frank Rowand, Marek Szyprowski, devicetree, linux-kernel
On Thu, May 11, 2017 at 4:50 PM, Rob Herring <robh+dt@kernel.org> wrote:
> On Thu, May 11, 2017 at 7:24 AM, Arnd Bergmann <arnd@arndb.de> wrote:
>> It's the pointer that is supposed to be const, not the return
>> type of the function.
>>
>> drivers/of/of_reserved_mem.c: In function '__reserved_mem_init_node':
>> drivers/of/of_reserved_mem.c:200:7: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers]
>> int const (*initfn)(struct reserved_mem *rmem) = i->data;
>>
>> Fixes: 17a70355ea57 ("of: fix sparse warnings in fdt, irq, reserved mem, and resolver code")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>> drivers/of/of_reserved_mem.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
>> index 4dec07ea510f..3f03ec004829 100644
>> --- a/drivers/of/of_reserved_mem.c
>> +++ b/drivers/of/of_reserved_mem.c
>> @@ -197,7 +197,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem)
>> const struct of_device_id *i;
>>
>> for (i = __reservedmem_of_table; i < &__rmem_of_table_sentinel; i++) {
>> - int const (*initfn)(struct reserved_mem *rmem) = i->data;
>> + int (* const initfn)(struct reserved_mem *rmem) = i->data;
>
> Why did you move the const here? That doesn't seem to help with sparse.
I must have misread the sparse warning.
> I think I'll just revert this back to using reservedmem_of_init_fn.
Sounds good, thanks.
Arnd
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] of: remove extraneous 'const' in typedef
2017-05-11 14:44 ` [PATCH 1/2] of: remove extraneous 'const' in typedef Rob Herring
@ 2017-05-11 15:03 ` Arnd Bergmann
2017-05-11 15:13 ` Rob Herring
0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2017-05-11 15:03 UTC (permalink / raw)
To: Rob Herring; +Cc: Frank Rowand, devicetree, linux-kernel
On Thu, May 11, 2017 at 4:44 PM, Rob Herring <robh+dt@kernel.org> wrote:
> On Thu, May 11, 2017 at 7:24 AM, Arnd Bergmann <arnd@arndb.de> wrote:
>> One change that was meant to address a sparse warning turned out
>> to cause hundreds of new gcc-7 warnings:
>
> I guess you are the only one on gcc-7.
It was just released last week or so. I actually had been using it for
a while but accidentally disabled a lot of the warning output until now
some others started using it too and asked me about it.
>> include/linux/of_irq.h:11:13: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers]
>>
>> After reverting the change, the gcc warnings are gone again, and I
>> can't reproduce the sparse warnings either.
>
> Humm, maybe different sparse versions? I'm on 0.5.0.
I have v0.5.0-183-gfbbfc73. To clarify, I did not get a sparse warning after my
patch, I did not try reverting your patch first.
Arnd
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] of: remove extraneous 'const' in typedef
2017-05-11 15:03 ` Arnd Bergmann
@ 2017-05-11 15:13 ` Rob Herring
0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2017-05-11 15:13 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: Frank Rowand, devicetree, linux-kernel
On Thu, May 11, 2017 at 10:03 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Thu, May 11, 2017 at 4:44 PM, Rob Herring <robh+dt@kernel.org> wrote:
>> On Thu, May 11, 2017 at 7:24 AM, Arnd Bergmann <arnd@arndb.de> wrote:
>>> One change that was meant to address a sparse warning turned out
>>> to cause hundreds of new gcc-7 warnings:
>>
>> I guess you are the only one on gcc-7.
>
> It was just released last week or so. I actually had been using it for
> a while but accidentally disabled a lot of the warning output until now
> some others started using it too and asked me about it.
>
>>> include/linux/of_irq.h:11:13: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers]
>>>
>>> After reverting the change, the gcc warnings are gone again, and I
>>> can't reproduce the sparse warnings either.
>>
>> Humm, maybe different sparse versions? I'm on 0.5.0.
>
> I have v0.5.0-183-gfbbfc73. To clarify, I did not get a sparse warning after my
> patch, I did not try reverting your patch first.
Indeed, the warnings are gone with current sparse from git.
Rob
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] of: reserved_mem: fix 'const' annotation
2017-05-11 14:50 ` Rob Herring
2017-05-11 15:00 ` Arnd Bergmann
@ 2017-05-11 15:59 ` Luc Van Oostenryck
1 sibling, 0 replies; 8+ messages in thread
From: Luc Van Oostenryck @ 2017-05-11 15:59 UTC (permalink / raw)
To: Rob Herring
Cc: Arnd Bergmann, Frank Rowand, Marek Szyprowski, devicetree, linux-kernel
On Thu, May 11, 2017 at 4:50 PM, Rob Herring <robh+dt@kernel.org> wrote:
> On Thu, May 11, 2017 at 7:24 AM, Arnd Bergmann <arnd@arndb.de> wrote:
>> It's the pointer that is supposed to be const, not the return
>> type of the function.
>>
>> drivers/of/of_reserved_mem.c: In function '__reserved_mem_init_node':
>> drivers/of/of_reserved_mem.c:200:7: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers]
>> int const (*initfn)(struct reserved_mem *rmem) = i->data;
>>
>> Fixes: 17a70355ea57 ("of: fix sparse warnings in fdt, irq, reserved mem, and resolver code")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>> drivers/of/of_reserved_mem.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
>> index 4dec07ea510f..3f03ec004829 100644
>> --- a/drivers/of/of_reserved_mem.c
>> +++ b/drivers/of/of_reserved_mem.c
>> @@ -197,7 +197,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem)
>> const struct of_device_id *i;
>>
>> for (i = __reservedmem_of_table; i < &__rmem_of_table_sentinel; i++) {
>> - int const (*initfn)(struct reserved_mem *rmem) = i->data;
>> + int (* const initfn)(struct reserved_mem *rmem) = i->data;
>
> Why did you move the const here? That doesn't seem to help with sparse.
The original sparse warning was:
../drivers/of/of_reserved_mem.c:200:50: warning: incorrect type in
initializer (different modifiers)
../drivers/of/of_reserved_mem.c:200:50: expected int (
*[usertype] initfn )( ... )
../drivers/of/of_reserved_mem.c:200:50: got void const *const data
right?
And we're talking about a function (pointer) type.
Functions return a rvalue thus qualifiers are irrelevant for them,
so having 'int const (*initfn)(...)' instead of 'int (*initfn)()' should
solve nothing.
Same for the others patch in this series.
-- Luc Van Oostenryck
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-05-11 15:59 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-11 12:24 [PATCH 1/2] of: remove extraneous 'const' in typedef Arnd Bergmann
2017-05-11 12:24 ` [PATCH 2/2] of: reserved_mem: fix 'const' annotation Arnd Bergmann
2017-05-11 14:50 ` Rob Herring
2017-05-11 15:00 ` Arnd Bergmann
2017-05-11 15:59 ` Luc Van Oostenryck
2017-05-11 14:44 ` [PATCH 1/2] of: remove extraneous 'const' in typedef Rob Herring
2017-05-11 15:03 ` Arnd Bergmann
2017-05-11 15:13 ` Rob Herring
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).