i2c-pxa: Support new-style I2C drivers
authorRodolfo Giometti <giometti@enneenne.com>
Thu, 12 Jul 2007 12:12:30 +0000 (14:12 +0200)
committerJean Delvare <khali@hyperion.delvare>
Thu, 12 Jul 2007 12:12:30 +0000 (14:12 +0200)
Signed-off-by: Rodolfo Giometti <giometti@linux.it>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
drivers/i2c/busses/i2c-pxa.c

index 28e7b91a4553ff3d33f5e830fb881a0e7c8f6886..9d6b790d43210fa3e21ff7b3b3c9fc6b6011c941 100644 (file)
@@ -921,7 +921,14 @@ static int i2c_pxa_probe(struct platform_device *dev)
                i2c->adap.class = plat->class;
        }
 
-       ret = i2c_add_adapter(&i2c->adap);
+       /*
+        * If "dev->id" is negative we consider it as zero.
+        * The reason to do so is to avoid sysfs names that only make
+        * sense when there are multiple adapters.
+        */
+       i2c->adap.nr = dev->id >= 0 ? dev->id : 0;
+
+       ret = i2c_add_numbered_adapter(&i2c->adap);
        if (ret < 0) {
                printk(KERN_INFO "I2C: Failed to add bus\n");
                goto eadapt;