[RFC PATCH 2/4] PLATFORM: Introduce registration function for asyncplatform data maps

From: Andy Green
Date: Sat Mar 12 2011 - 17:32:40 EST


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@xxxxxxxxxx>
---

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

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_ */

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/