From: Srinivas Kandagatla <[email protected]>
Most of the drivers have of_device_id table setup with single compatible
entry, this use case is very simple and common.
static struct of_device_id xxx_of_match[] = {
{ .compatible = "yyy,zzz" },
{ },
};
MODULE_DEVICE_TABLE(of, xxx_of_match);
This patch adds a macro for this simple type of device table.
Other subsystems like pm, platform, have similar macros in kernel for
simplest cases.
Now the user can just replace the above code with
of_simple_module_id_table(xxx_of_match, "yyy,zzz");
macro without worrrying about ifdef'ng it.
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
include/linux/of.h | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/include/linux/of.h b/include/linux/of.h
index b4e50d5..adb812b 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -280,6 +280,15 @@ extern void of_detach_node(struct device_node *);
#define of_match_ptr(_ptr) (_ptr)
+#define of_simple_module_id_table(name, compat) \
+ static struct of_device_id name[] = { \
+ { \
+ .compatible = compat, \
+ }, \
+ {} \
+}; \
+MODULE_DEVICE_TABLE(of, name)
+
/*
* struct property *prop;
* const __be32 *p;
@@ -438,6 +447,7 @@ static inline int of_machine_is_compatible(const char
*compat)
}
#define of_match_ptr(_ptr) NULL
+#define of_simple_module_id_table(name, compat)
#define of_match_node(_matches, _node) NULL
#define of_property_for_each_u32(np, propname, prop, p, u) \
while (0)
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html