diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2011-07-25 11:49:43 -0400 |
---|---|---|
committer | Jean Delvare <khali@endymion.delvare> | 2011-07-25 11:49:43 -0400 |
commit | 488bf314bf219c66922305a1a320950efa86662f (patch) | |
tree | 84337cff8d57af18311129495f7cac4979845c55 /drivers/i2c/busses/i2c-cpm.c | |
parent | 3fea5df41df685de53aa985678ad7a9b2d6b3bb5 (diff) |
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>
Diffstat (limited to 'drivers/i2c/busses/i2c-cpm.c')
-rw-r--r-- | drivers/i2c/busses/i2c-cpm.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c index 3a20961bef1e..b1d9cd28d8da 100644 --- a/drivers/i2c/busses/i2c-cpm.c +++ b/drivers/i2c/busses/i2c-cpm.c | |||
@@ -662,11 +662,8 @@ static int __devinit cpm_i2c_probe(struct platform_device *ofdev) | |||
662 | /* register new adapter to i2c module... */ | 662 | /* register new adapter to i2c module... */ |
663 | 663 | ||
664 | data = of_get_property(ofdev->dev.of_node, "linux,i2c-index", &len); | 664 | data = of_get_property(ofdev->dev.of_node, "linux,i2c-index", &len); |
665 | if (data && len == 4) { | 665 | cpm->adap.nr = (data && len == 4) ? be32_to_cpup(data) : -1; |
666 | cpm->adap.nr = *data; | 666 | result = i2c_add_numbered_adapter(&cpm->adap); |
667 | result = i2c_add_numbered_adapter(&cpm->adap); | ||
668 | } else | ||
669 | result = i2c_add_adapter(&cpm->adap); | ||
670 | 667 | ||
671 | if (result < 0) { | 668 | if (result < 0) { |
672 | dev_err(&ofdev->dev, "Unable to register with I2C\n"); | 669 | dev_err(&ofdev->dev, "Unable to register with I2C\n"); |