summaryrefslogtreecommitdiffstats
path: root/include/linux/of.h
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2014-05-08 17:09:24 -0400
committerRob Herring <robh@kernel.org>2014-05-20 15:25:24 -0400
commit54196ccbe0ba1f268a646059473313589db35b01 (patch)
tree07443c68af484b0a74ce8456e58f97342f95cf25 /include/linux/of.h
parent826d8958419ae924ae2af12d214ee599ee713e91 (diff)
of: consolidate linker section OF match table declarations
We now have several OF match tables using linker sections that are nearly the same definition. The only variation is the callback function prototype. Create a common define for creating linker section OF match table entries which each table declaration can use. Acked-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'include/linux/of.h')
-rw-r--r--include/linux/of.h22
1 files changed, 22 insertions, 0 deletions
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
774typedef int (*of_init_fn_2)(struct device_node *, struct device_node *);
775typedef 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 */