diff mbox

[RFC,2/4] PLATFORM: Introduce registration function for async platform data maps

Message ID 20110312223219.27020.60965.stgit@otae.warmcat.com
State New
Headers show

Commit Message

Andy Green March 12, 2011, 10:32 p.m. UTC
This adds a small platform API that lets a board definition file
register a mapping structure for asynchronously probed devices so
platform_data can be attached to them at probe time.

Signed-off-by: Andy Green <andy.green@linaro.org>
---

 drivers/base/platform.c         |   21 +++++++++++++++++++++
 include/linux/platform_device.h |    3 +++
 2 files changed, 24 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index f051cff..180e372 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -31,6 +31,12 @@  struct device platform_bus = {
 };
 EXPORT_SYMBOL_GPL(platform_bus);
 
+struct platform_async_platform_data *platform_async_platform_data_map;
+EXPORT_SYMBOL_GPL(platform_async_platform_data_map);
+
+int platform_async_platform_data_count;
+EXPORT_SYMBOL_GPL(platform_async_platform_data_count);
+
 /**
  * platform_get_resource - get a resource for a device
  * @dev: platform device
@@ -1332,3 +1338,18 @@  void __init early_platform_cleanup(void)
 	}
 }
 
+/**
+ * platform_async_platform_data_register - register an array of async-
+ *				probed bus / device names mapping to
+ *				plaform_data for that device.
+ * @map:	the array of devname vs platform_data mapping structs
+ * @count:	the count of structs in the @map array
+ */
+
+void platform_async_platform_data_register(
+			    struct platform_async_platform_data *map, int count)
+{
+	platform_async_platform_data_map = map;
+	platform_async_platform_data_count = count;
+}
+EXPORT_SYMBOL_GPL(platform_async_platform_data_register);
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index d8c0ba9..19ea497 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -210,4 +210,7 @@  struct platform_async_platform_data {
 	void *platform_data;
 };
 
+extern void platform_async_platform_data_register(
+			   struct platform_async_platform_data *map, int count);
+
 #endif /* _PLATFORM_DEVICE_H_ */