diff options
-rw-r--r-- | drivers/clocksource/clksrc-of.c | 2 | ||||
-rw-r--r-- | drivers/irqchip/irqchip.h | 7 | ||||
-rw-r--r-- | include/linux/clk-provider.h | 5 | ||||
-rw-r--r-- | include/linux/clocksource.h | 16 | ||||
-rw-r--r-- | include/linux/of.h | 22 | ||||
-rw-r--r-- | include/linux/of_reserved_mem.h | 18 |
6 files changed, 32 insertions, 38 deletions
diff --git a/drivers/clocksource/clksrc-of.c b/drivers/clocksource/clksrc-of.c index ae2e4278c42a..0093a8e49e14 100644 --- a/drivers/clocksource/clksrc-of.c +++ b/drivers/clocksource/clksrc-of.c | |||
@@ -27,7 +27,7 @@ void __init clocksource_of_init(void) | |||
27 | { | 27 | { |
28 | struct device_node *np; | 28 | struct device_node *np; |
29 | const struct of_device_id *match; | 29 | const struct of_device_id *match; |
30 | clocksource_of_init_fn init_func; | 30 | of_init_fn_1 init_func; |
31 | unsigned clocksources = 0; | 31 | unsigned clocksources = 0; |
32 | 32 | ||
33 | for_each_matching_node_and_match(np, __clksrc_of_table, &match) { | 33 | for_each_matching_node_and_match(np, __clksrc_of_table, &match) { |
diff --git a/drivers/irqchip/irqchip.h b/drivers/irqchip/irqchip.h index e445ba2d6add..0f6486d4f1b0 100644 --- a/drivers/irqchip/irqchip.h +++ b/drivers/irqchip/irqchip.h | |||
@@ -11,6 +11,8 @@ | |||
11 | #ifndef _IRQCHIP_H | 11 | #ifndef _IRQCHIP_H |
12 | #define _IRQCHIP_H | 12 | #define _IRQCHIP_H |
13 | 13 | ||
14 | #include <linux/of.h> | ||
15 | |||
14 | /* | 16 | /* |
15 | * This macro must be used by the different irqchip drivers to declare | 17 | * This macro must be used by the different irqchip drivers to declare |
16 | * the association between their DT compatible string and their | 18 | * the association between their DT compatible string and their |
@@ -21,9 +23,6 @@ | |||
21 | * @compstr: compatible string of the irqchip driver | 23 | * @compstr: compatible string of the irqchip driver |
22 | * @fn: initialization function | 24 | * @fn: initialization function |
23 | */ | 25 | */ |
24 | #define IRQCHIP_DECLARE(name,compstr,fn) \ | 26 | #define IRQCHIP_DECLARE(name, compat, fn) OF_DECLARE_2(irqchip, name, compat, fn) |
25 | static const struct of_device_id irqchip_of_match_##name \ | ||
26 | __used __section(__irqchip_of_table) \ | ||
27 | = { .compatible = compstr, .data = fn } | ||
28 | 27 | ||
29 | #endif | 28 | #endif |
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 511917416fb0..a6e4008a0bf7 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h | |||
@@ -498,10 +498,7 @@ struct clk_onecell_data { | |||
498 | 498 | ||
499 | extern struct of_device_id __clk_of_table; | 499 | extern struct of_device_id __clk_of_table; |
500 | 500 | ||
501 | #define CLK_OF_DECLARE(name, compat, fn) \ | 501 | #define CLK_OF_DECLARE(name, compat, fn) OF_DECLARE_1(clk, name, compat, fn) |
502 | static const struct of_device_id __clk_of_table_##name \ | ||
503 | __used __section(__clk_of_table) \ | ||
504 | = { .compatible = compat, .data = fn }; | ||
505 | 502 | ||
506 | #ifdef CONFIG_OF | 503 | #ifdef CONFIG_OF |
507 | int of_clk_add_provider(struct device_node *np, | 504 | int of_clk_add_provider(struct device_node *np, |
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 67301a405712..a16b497d5159 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
@@ -339,23 +339,13 @@ extern int clocksource_mmio_init(void __iomem *, const char *, | |||
339 | 339 | ||
340 | extern int clocksource_i8253_init(void); | 340 | extern int clocksource_i8253_init(void); |
341 | 341 | ||
342 | struct device_node; | 342 | #define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \ |
343 | typedef void(*clocksource_of_init_fn)(struct device_node *); | 343 | OF_DECLARE_1(clksrc, name, compat, fn) |
344 | |||
344 | #ifdef CONFIG_CLKSRC_OF | 345 | #ifdef CONFIG_CLKSRC_OF |
345 | extern void clocksource_of_init(void); | 346 | extern void clocksource_of_init(void); |
346 | |||
347 | #define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \ | ||
348 | static const struct of_device_id __clksrc_of_table_##name \ | ||
349 | __used __section(__clksrc_of_table) \ | ||
350 | = { .compatible = compat, \ | ||
351 | .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn } | ||
352 | #else | 347 | #else |
353 | static inline void clocksource_of_init(void) {} | 348 | static inline void clocksource_of_init(void) {} |
354 | #define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \ | ||
355 | static const struct of_device_id __clksrc_of_table_##name \ | ||
356 | __attribute__((unused)) \ | ||
357 | = { .compatible = compat, \ | ||
358 | .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn } | ||
359 | #endif | 349 | #endif |
360 | 350 | ||
361 | #endif /* _LINUX_CLOCKSOURCE_H */ | 351 | #endif /* _LINUX_CLOCKSOURCE_H */ |
diff --git a/include/linux/of.h b/include/linux/of.h index 3bad8d106e0e..bf65335b4d05 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -757,4 +757,26 @@ static inline int of_get_available_child_count(const struct device_node *np) | |||
757 | return num; | 757 | return num; |
758 | } | 758 | } |
759 | 759 | ||
760 | #ifdef CONFIG_OF | ||
761 | #define _OF_DECLARE(table, name, compat, fn, fn_type) \ | ||
762 | static const struct of_device_id __of_table_##name \ | ||
763 | __used __section(__##table##_of_table) \ | ||
764 | = { .compatible = compat, \ | ||
765 | .data = (fn == (fn_type)NULL) ? fn : fn } | ||
766 | #else | ||
767 | #define _OF_DECLARE(table, name, compat, fn, fn_type) \ | ||
768 | static const struct of_device_id __of_table_##name \ | ||
769 | __attribute__((unused)) \ | ||
770 | = { .compatible = compat, \ | ||
771 | .data = (fn == (fn_type)NULL) ? fn : fn } | ||
772 | #endif | ||
773 | |||
774 | typedef int (*of_init_fn_2)(struct device_node *, struct device_node *); | ||
775 | typedef void (*of_init_fn_1)(struct device_node *); | ||
776 | |||
777 | #define OF_DECLARE_1(table, name, compat, fn) \ | ||
778 | _OF_DECLARE(table, name, compat, fn, of_init_fn_1) | ||
779 | #define OF_DECLARE_2(table, name, compat, fn) \ | ||
780 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2) | ||
781 | |||
760 | #endif /* _LINUX_OF_H */ | 782 | #endif /* _LINUX_OF_H */ |
diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h index 4c81b84e95ff..4669ddfdd5af 100644 --- a/include/linux/of_reserved_mem.h +++ b/include/linux/of_reserved_mem.h | |||
@@ -23,31 +23,17 @@ struct reserved_mem_ops { | |||
23 | 23 | ||
24 | typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem); | 24 | typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem); |
25 | 25 | ||
26 | #define RESERVEDMEM_OF_DECLARE(name, compat, init) \ | ||
27 | _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn) | ||
26 | 28 | ||
27 | #ifdef CONFIG_OF_RESERVED_MEM | 29 | #ifdef CONFIG_OF_RESERVED_MEM |
28 | void fdt_init_reserved_mem(void); | 30 | void fdt_init_reserved_mem(void); |
29 | void fdt_reserved_mem_save_node(unsigned long node, const char *uname, | 31 | void fdt_reserved_mem_save_node(unsigned long node, const char *uname, |
30 | phys_addr_t base, phys_addr_t size); | 32 | phys_addr_t base, phys_addr_t size); |
31 | |||
32 | #define RESERVEDMEM_OF_DECLARE(name, compat, init) \ | ||
33 | static const struct of_device_id __reservedmem_of_table_##name \ | ||
34 | __used __section(__reservedmem_of_table) \ | ||
35 | = { .compatible = compat, \ | ||
36 | .data = (init == (reservedmem_of_init_fn)NULL) ? \ | ||
37 | init : init } | ||
38 | |||
39 | #else | 33 | #else |
40 | static inline void fdt_init_reserved_mem(void) { } | 34 | static inline void fdt_init_reserved_mem(void) { } |
41 | static inline void fdt_reserved_mem_save_node(unsigned long node, | 35 | static inline void fdt_reserved_mem_save_node(unsigned long node, |
42 | const char *uname, phys_addr_t base, phys_addr_t size) { } | 36 | const char *uname, phys_addr_t base, phys_addr_t size) { } |
43 | |||
44 | #define RESERVEDMEM_OF_DECLARE(name, compat, init) \ | ||
45 | static const struct of_device_id __reservedmem_of_table_##name \ | ||
46 | __attribute__((unused)) \ | ||
47 | = { .compatible = compat, \ | ||
48 | .data = (init == (reservedmem_of_init_fn)NULL) ? \ | ||
49 | init : init } | ||
50 | |||
51 | #endif | 37 | #endif |
52 | 38 | ||
53 | #endif /* __OF_RESERVED_MEM_H */ | 39 | #endif /* __OF_RESERVED_MEM_H */ |