Commit 7589a326 authored by Stefan Roese's avatar Stefan Roese Committed by Jean Delvare

i2c-ibm_iic: Add support for new-style clients

Use i2c_bit_add_numbered_adapter() if device id specified, so that the
i2c-ibm_iic adapter works well with new-style pre-declared devices.
Signed-off-by: default avatarStefan Roese <sr@denx.de>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent 8056c6cb
......@@ -738,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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment