Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1639356 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2017-05-11 14:30 +0200 |
| Last post | 2017-05-11 18:00 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 2/2] of: reserved_mem: fix 'const' annotation Arnd Bergmann <arnd@arndb.de> - 2017-05-11 14:30 +0200
Re: [PATCH 2/2] of: reserved_mem: fix 'const' annotation Rob Herring <robh+dt@kernel.org> - 2017-05-11 17:00 +0200
Re: [PATCH 2/2] of: reserved_mem: fix 'const' annotation Arnd Bergmann <arnd@arndb.de> - 2017-05-11 17:10 +0200
Re: [PATCH 2/2] of: reserved_mem: fix 'const' annotation Luc Van Oostenryck <luc.vanoostenryck@gmail.com> - 2017-05-11 18:00 +0200
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2017-05-11 14:30 +0200 |
| Subject | [PATCH 2/2] of: reserved_mem: fix 'const' annotation |
| Message-ID | <tFVod-6fr-1@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Rob Herring <robh+dt@kernel.org> |
|---|---|
| Date | 2017-05-11 17:00 +0200 |
| Message-ID | <tFXJn-7DY-15@gated-at.bofh.it> |
| In reply to | #1639356 |
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
[toc] | [prev] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2017-05-11 17:10 +0200 |
| Message-ID | <tFXT6-7X6-83@gated-at.bofh.it> |
| In reply to | #1639653 |
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
[toc] | [prev] | [next] | [standalone]
| From | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> |
|---|---|
| Date | 2017-05-11 18:00 +0200 |
| Message-ID | <tFYFu-8gi-69@gated-at.bofh.it> |
| In reply to | #1639653 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web