]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/i2c/busses/i2c-s3c2410.c
i2c: S3C2410: Pass the I2C bus number via drivers platform data
[linux-2.6-omap-h63xx.git] / drivers / i2c / busses / i2c-s3c2410.c
index 007390ad9810555b0fe7f2ba6077445601ec919b..eef35d3f60739fab34eab18a740dec379285e70f 100644 (file)
@@ -752,9 +752,12 @@ static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c)
 static int s3c24xx_i2c_probe(struct platform_device *pdev)
 {
        struct s3c24xx_i2c *i2c = &s3c24xx_i2c;
+       struct s3c2410_platform_i2c *pdata;
        struct resource *res;
        int ret;
 
+       pdata = s3c24xx_i2c_get_platformdata(&pdev->dev);
+
        /* find the clock and enable it */
 
        i2c->dev = &pdev->dev;
@@ -832,7 +835,15 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
        dev_dbg(&pdev->dev, "irq resource %p (%lu)\n", res,
                (unsigned long)res->start);
 
-       ret = i2c_add_adapter(&i2c->adap);
+       /* Note, previous versions of the driver used i2c_add_adapter()
+        * to add the bus at any number. We now pass the bus number via
+        * the platform data, so if unset it will now default to always
+        * being bus 0.
+        */
+
+       i2c->adap.nr = pdata->bus_num;
+
+       ret = i2c_add_numbered_adapter(&i2c->adap);
        if (ret < 0) {
                dev_err(&pdev->dev, "failed to add bus to i2c core\n");
                goto err_irq;