Merge tag 'devicetree-for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firefly-linux-kernel-4.4.55.git] / include / linux / of.h
index fa362867b45323b28a40b4623c85c63bc37b5b18..196b34c1ef4e1b3bdd54cb851110715c584b43df 100644 (file)
@@ -764,4 +764,26 @@ static inline int of_get_available_child_count(const struct device_node *np)
        return num;
 }
 
+#ifdef CONFIG_OF
+#define _OF_DECLARE(table, name, compat, fn, fn_type)                  \
+       static const struct of_device_id __of_table_##name              \
+               __used __section(__##table##_of_table)                  \
+                = { .compatible = compat,                              \
+                    .data = (fn == (fn_type)NULL) ? fn : fn  }
+#else
+#define _OF_DECLARE(table, name, compat, fn, fn_type)                                  \
+       static const struct of_device_id __of_table_##name              \
+               __attribute__((unused))                                 \
+                = { .compatible = compat,                              \
+                    .data = (fn == (fn_type)NULL) ? fn : fn }
+#endif
+
+typedef int (*of_init_fn_2)(struct device_node *, struct device_node *);
+typedef void (*of_init_fn_1)(struct device_node *);
+
+#define OF_DECLARE_1(table, name, compat, fn) \
+               _OF_DECLARE(table, name, compat, fn, of_init_fn_1)
+#define OF_DECLARE_2(table, name, compat, fn) \
+               _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
+
 #endif /* _LINUX_OF_H */