]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/i2c/busses/i2c-ibm_iic.c
Convert files to UTF-8 and some cleanups
[mirror_ubuntu-bionic-kernel.git] / drivers / i2c / busses / i2c-ibm_iic.c
index 1898e9987021606c78af90c3b97869066355aa7d..9b43ff7270d0213db406e034ec486e78af984336 100644 (file)
@@ -18,7 +18,7 @@
  *     Copyright 1995-97 Simon G. Vogl
  *                1998-99 Hans Berglund
  *
- *     With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> 
+ *     With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi>
  *     and even Frodo Looijaard <frodol@dds.nl>
  *
  * This program is free software; you can redistribute  it and/or modify it
@@ -727,6 +727,7 @@ static int __devinit iic_probe(struct ocp_device *ocp){
        
        /* Register it with i2c layer */
        adap = &dev->adap;
+       adap->dev.parent = &ocp->dev;
        strcpy(adap->name, "IBM IIC");
        i2c_set_adapdata(adap, dev);
        adap->id = I2C_HW_OCP;
@@ -737,7 +738,14 @@ static int __devinit iic_probe(struct ocp_device *ocp){
        adap->timeout = 1;
        adap->retries = 1;
 
-       if ((ret = i2c_add_adapter(adap)) != 0){
+       /*
+        * If "dev->idx" 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.
+        */
+       adap->nr = dev->idx >= 0 ? dev->idx : 0;
+
+       if ((ret = i2c_add_numbered_adapter(adap)) < 0) {
                printk(KERN_CRIT "ibm-iic%d: failed to register i2c adapter\n",
                        dev->idx);
                goto fail;