aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorSean MacLennan <smaclennan@pikatech.com>2008-07-14 16:38:36 -0400
committerJean Delvare <khali@mahadeva.delvare>2008-07-14 16:38:36 -0400
commitb1204e6ec16468ebf89d9d818bfe425ca7adcdf3 (patch)
tree9648bdd1222645a20c4b574ee62e00b3f78bd1cb /drivers/i2c
parent2b7a5056a0a7ff17d5d2004c29c852a92a6bd632 (diff)
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: Sean MacLennan <smaclennan@pikatech.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-ibm_iic.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index 070f078b5f5c..651f2f1ae5b7 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -43,6 +43,7 @@
43#include <linux/i2c.h> 43#include <linux/i2c.h>
44#include <linux/i2c-id.h> 44#include <linux/i2c-id.h>
45#include <linux/of_platform.h> 45#include <linux/of_platform.h>
46#include <linux/of_i2c.h>
46 47
47#include "i2c-ibm_iic.h" 48#include "i2c-ibm_iic.h"
48 49
@@ -696,7 +697,7 @@ static int __devinit iic_probe(struct of_device *ofdev,
696 struct device_node *np = ofdev->node; 697 struct device_node *np = ofdev->node;
697 struct ibm_iic_private *dev; 698 struct ibm_iic_private *dev;
698 struct i2c_adapter *adap; 699 struct i2c_adapter *adap;
699 const u32 *indexp, *freq; 700 const u32 *freq;
700 int ret; 701 int ret;
701 702
702 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 703 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
@@ -707,14 +708,6 @@ static int __devinit iic_probe(struct of_device *ofdev,
707 708
708 dev_set_drvdata(&ofdev->dev, dev); 709 dev_set_drvdata(&ofdev->dev, dev);
709 710
710 indexp = of_get_property(np, "index", NULL);
711 if (!indexp) {
712 dev_err(&ofdev->dev, "no index specified\n");
713 ret = -EINVAL;
714 goto error_cleanup;
715 }
716 dev->idx = *indexp;
717
718 dev->vaddr = of_iomap(np, 0); 711 dev->vaddr = of_iomap(np, 0);
719 if (dev->vaddr == NULL) { 712 if (dev->vaddr == NULL) {
720 dev_err(&ofdev->dev, "failed to iomap device\n"); 713 dev_err(&ofdev->dev, "failed to iomap device\n");
@@ -757,14 +750,16 @@ static int __devinit iic_probe(struct of_device *ofdev,
757 adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; 750 adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
758 adap->algo = &iic_algo; 751 adap->algo = &iic_algo;
759 adap->timeout = 1; 752 adap->timeout = 1;
760 adap->nr = dev->idx;
761 753
762 ret = i2c_add_numbered_adapter(adap); 754 ret = i2c_add_adapter(adap);
763 if (ret < 0) { 755 if (ret < 0) {
764 dev_err(&ofdev->dev, "failed to register i2c adapter\n"); 756 dev_err(&ofdev->dev, "failed to register i2c adapter\n");
765 goto error_cleanup; 757 goto error_cleanup;
766 } 758 }
767 759
760 /* Now register all the child nodes */
761 of_register_i2c_devices(adap, np);
762
768 dev_info(&ofdev->dev, "using %s mode\n", 763 dev_info(&ofdev->dev, "using %s mode\n",
769 dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)"); 764 dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)");
770 765