Messages in this thread Patch in this message |  | | | Date | Tue, 28 Oct 2008 20:46:15 +0300 | | From | Anton Vorontsov <> | | Subject | [PATCH 3/6] of/of_i2c: add support for dedicated OF I2C devices |
| |
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@ru.mvista.com> --- 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
|  |