aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/i2c/busses/i2c-ibm_iic.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index 8b14d14e60ca..e08bacadd6bc 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -738,7 +738,14 @@ static int __devinit iic_probe(struct ocp_device *ocp){
738 adap->timeout = 1; 738 adap->timeout = 1;
739 adap->retries = 1; 739 adap->retries = 1;
740 740
741 if ((ret = i2c_add_adapter(adap)) != 0){ 741 /*
742 * If "dev->idx" is negative we consider it as zero.
743 * The reason to do so is to avoid sysfs names that only make
744 * sense when there are multiple adapters.
745 */
746 adap->nr = dev->idx >= 0 ? dev->idx : 0;
747
748 if ((ret = i2c_add_numbered_adapter(adap)) < 0) {
742 printk(KERN_CRIT "ibm-iic%d: failed to register i2c adapter\n", 749 printk(KERN_CRIT "ibm-iic%d: failed to register i2c adapter\n",
743 dev->idx); 750 dev->idx);
744 goto fail; 751 goto fail;