i2c: Allow i2c_add_numbered_adapter() to assign a bus id
Currently, if an i2c bus driver supports both static and dynamic bus ids, it needs to choose between calling i2c_add_numbered_adapter() and i2c_add_adapter(). This patch makes i2c_add_numbered_adapter() redirect to i2c_add_adapter() if the requested bus id is -1. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Jean Delvare <khali@linux-fr.org>
This commit is contained in:

committed by
Jean Delvare

parent
3fea5df41d
commit
488bf314bf
@@ -1079,7 +1079,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
|
||||
* The reason to do so is to avoid sysfs names that only make
|
||||
* sense when there are multiple adapters.
|
||||
*/
|
||||
i2c->adap.nr = dev->id != -1 ? dev->id : 0;
|
||||
i2c->adap.nr = dev->id;
|
||||
snprintf(i2c->adap.name, sizeof(i2c->adap.name), "pxa_i2c-i2c.%u",
|
||||
i2c->adap.nr);
|
||||
|
||||
@@ -1142,10 +1142,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
|
||||
i2c->adap.dev.of_node = dev->dev.of_node;
|
||||
#endif
|
||||
|
||||
if (i2c_type == REGS_CE4100)
|
||||
ret = i2c_add_adapter(&i2c->adap);
|
||||
else
|
||||
ret = i2c_add_numbered_adapter(&i2c->adap);
|
||||
ret = i2c_add_numbered_adapter(&i2c->adap);
|
||||
if (ret < 0) {
|
||||
printk(KERN_INFO "I2C: Failed to add bus\n");
|
||||
goto eadapt;
|
||||
|
Reference in New Issue
Block a user