i2c: S3C2410: Pass the I2C bus number via drivers platform data
[pandora-kernel.git] / drivers / i2c / busses / i2c-s3c2410.c
index 9e8c875..eef35d3 100644 (file)
@@ -590,7 +590,7 @@ static struct s3c24xx_i2c s3c24xx_i2c = {
                .owner                  = THIS_MODULE,
                .algo                   = &s3c24xx_i2c_algorithm,
                .retries                = 2,
-               .class                  = I2C_CLASS_HWMON,
+               .class                  = I2C_CLASS_HWMON | I2C_CLASS_SPD,
        },
 };
 
@@ -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;