Commit b1204e6e authored by Sean MacLennan's avatar Sean MacLennan Committed by Jean Delvare

i2c-ibm_iic: Register child nodes

This patch completes the conversion of the IBM IIC driver to an
of-platform driver.

It removes the index from the IBM IIC driver and makes it an unnumbered
driver. It then calls of_register_i2c_devices to properly register all
the child nodes in the DTS.
Signed-off-by: default avatarSean MacLennan <smaclennan@pikatech.com>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent 2b7a5056
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-id.h> #include <linux/i2c-id.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/of_i2c.h>
#include "i2c-ibm_iic.h" #include "i2c-ibm_iic.h"
...@@ -696,7 +697,7 @@ static int __devinit iic_probe(struct of_device *ofdev, ...@@ -696,7 +697,7 @@ static int __devinit iic_probe(struct of_device *ofdev,
struct device_node *np = ofdev->node; struct device_node *np = ofdev->node;
struct ibm_iic_private *dev; struct ibm_iic_private *dev;
struct i2c_adapter *adap; struct i2c_adapter *adap;
const u32 *indexp, *freq; const u32 *freq;
int ret; int ret;
dev = kzalloc(sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
...@@ -707,14 +708,6 @@ static int __devinit iic_probe(struct of_device *ofdev, ...@@ -707,14 +708,6 @@ static int __devinit iic_probe(struct of_device *ofdev,
dev_set_drvdata(&ofdev->dev, dev); dev_set_drvdata(&ofdev->dev, dev);
indexp = of_get_property(np, "index", NULL);
if (!indexp) {
dev_err(&ofdev->dev, "no index specified\n");
ret = -EINVAL;
goto error_cleanup;
}
dev->idx = *indexp;
dev->vaddr = of_iomap(np, 0); dev->vaddr = of_iomap(np, 0);
if (dev->vaddr == NULL) { if (dev->vaddr == NULL) {
dev_err(&ofdev->dev, "failed to iomap device\n"); dev_err(&ofdev->dev, "failed to iomap device\n");
...@@ -757,14 +750,16 @@ static int __devinit iic_probe(struct of_device *ofdev, ...@@ -757,14 +750,16 @@ static int __devinit iic_probe(struct of_device *ofdev,
adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
adap->algo = &iic_algo; adap->algo = &iic_algo;
adap->timeout = 1; adap->timeout = 1;
adap->nr = dev->idx;
ret = i2c_add_numbered_adapter(adap); ret = i2c_add_adapter(adap);
if (ret < 0) { if (ret < 0) {
dev_err(&ofdev->dev, "failed to register i2c adapter\n"); dev_err(&ofdev->dev, "failed to register i2c adapter\n");
goto error_cleanup; goto error_cleanup;
} }
/* Now register all the child nodes */
of_register_i2c_devices(adap, np);
dev_info(&ofdev->dev, "using %s mode\n", dev_info(&ofdev->dev, "using %s mode\n",
dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)"); dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment