Skip to content

Commit

Permalink
Partially Revert "of: fix sparse warnings in fdt, irq, reserved mem, …
Browse files Browse the repository at this point in the history
…and resolver code"

A change to function pointers 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]
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;

Turns out the sparse warnings were spurious and have been fixed in
upstream sparse since 0.5.0 in commit "sparse: treat function pointers
as pointers to const data".

This partially reverts commit 17a7035.

Fixes: 17a7035 ("of: fix sparse warnings in fdt, irq, reserved mem, and resolver code")
Reported-by: Arnd Bergmann <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
  • Loading branch information
robherring committed May 11, 2017
1 parent 17a7035 commit df3ed93
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/of/of_reserved_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
reservedmem_of_init_fn initfn = i->data;
const char *compat = i->compatible;

if (!of_flat_dt_is_compatible(rmem->fdt_node, compat))
Expand Down
2 changes: 1 addition & 1 deletion include/linux/of_irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit df3ed93

Please sign in to comment.