[RFC PATCH 06/14] platform: add function to initialize OF match table

Lorenzo Pieralisi lorenzo.pieralisi at arm.com
Thu Aug 19 04:59:52 EST 2010


If the kernel is configured to enable the Open Firmware device tree
infrastructure, the driver member of struct platform_driver has an
additional member, the match table, that has to be initialized in
order for the kernel to be capable of probing drivers at run-time
using the OF methodology.

This patch adds a static inline function that should be used to
initialize the match table member for platform drivers. When OF is
not enabled, the function is empty and it is just optimized out.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi at arm.com>
---
 include/linux/platform_device.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 5417944..bdfe6f3 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -84,6 +84,17 @@ extern struct platform_device *platform_create_bundle(struct platform_driver *dr
 					struct resource *res, unsigned int n_res,
 					const void *data, size_t size);
 
+#ifndef CONFIG_OF
+static inline void platform_init_match(struct platform_driver *pdriver,
+		const struct of_device_id *ids) { }
+#else
+static inline void platform_init_match(struct platform_driver *pdriver,
+		const struct of_device_id *ids)
+{
+	pdriver->driver.of_match_table = ids;
+}
+#endif
+
 /* early platform driver interface */
 struct early_platform_driver {
 	const char *class_str;
-- 
1.6.3.3



More information about the devicetree-discuss mailing list