[PATCH 3/6] of/of_i2c: add support for dedicated OF I2C devices

From: Anton Vorontsov
Date: Tue Oct 28 2008 - 13:46:53 EST


of_i2c will create the OF platform device if it knows that the
device won't work without platform data. The OF platform driver
will fill the platform data and will register real I2C device.

Signed-off-by: Anton Vorontsov <avorontsov@xxxxxxxxxxxxx>
---
drivers/of/of_i2c.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
index 57de7c5..02aa1d6 100644
--- a/drivers/of/of_i2c.c
+++ b/drivers/of/of_i2c.c
@@ -13,6 +13,7 @@

#include <linux/i2c.h>
#include <linux/of.h>
+#include <linux/of_platform.h>
#include <linux/of_i2c.h>
#include <linux/module.h>

@@ -67,6 +68,17 @@ void of_register_i2c_devices(struct i2c_adapter *adap,
for_each_child_of_node(adap_node, node) {
struct i2c_board_info info = {};

+#ifdef CONFIG_PPC
+ /* TODO: of_platform_device_create() for SPARC. */
+ if (of_should_create_pdev(node)) {
+ struct of_device *of_pdev;
+
+ of_pdev = of_platform_device_create(node, NULL,
+ &adap->dev);
+ WARN_ON(!of_pdev);
+ continue;
+ }
+#endif
of_register_i2c_device(adap, &info, node);
}
}
--
1.5.6.3

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