[PATCH 1/2] OF: Add of_match_ptr() macro

Ben Dooks ben-linux at fluff.org
Wed Aug 3 19:11:42 EST 2011


Add a macro of_match_ptr() that allows the .of_match_table
entry in the driver structures to be assigned without having
an #ifdef xxx NULL for the case that OF is not enabled

Signed-off-by: Ben Dooks <ben-linux at fluff.org>
---
 include/linux/of.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/of.h b/include/linux/of.h
index bd716f8..951e87b 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -234,6 +234,7 @@ extern void of_attach_node(struct device_node *);
 extern void of_detach_node(struct device_node *);
 #endif
 
+#define of_match_ptr(_ptr)	(_ptr)
 #else /* CONFIG_OF */
 
 static inline bool of_have_populated_dt(void)
@@ -253,6 +254,7 @@ static inline int of_property_read_string(struct device_node *np,
 	return -ENOSYS;
 }
 
+#define of_match_ptr(_ptr)	NULL
 #endif /* CONFIG_OF */
 
 static inline int of_property_read_u32(const struct device_node *np,
-- 
1.7.1



More information about the devicetree-discuss mailing list