[i2c] [PATCH] i2c: Add support for new-style clients to ibm-iic driver
Stefan Roese
sr at denx.de
Wed Aug 29 08:31:42 CEST 2007
[PATCH] i2c: Add support for new-style clients to ibm-iic driver
Use i2c_bit_add_numbered_bus() if device id specified, so that the
i2c-gpio adapter works well with new-style pre-declared devices.
Signed-off-by: Stefan Roese <sr at denx.de>
---
commit 3bfd60cedd025533b4d94cb678f21fbff5aa0005
tree f595880e13321b165630ad2b9316346e23548357
parent bcfc8d37d5abb8f60fcc05bccb1f4f118a238962
author Stefan Roese <sr at denx.de> Wed, 29 Aug 2007 08:30:05 +0200
committer Stefan Roese <sr at denx.de> Wed, 29 Aug 2007 08:30:05 +0200
drivers/i2c/busses/i2c-ibm_iic.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index b6d2766..aa57c19 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -742,7 +742,15 @@ static int __devinit iic_probe(struct ocp_device *ocp){
if (adap->dev.parent == NULL) {
adap->dev.parent = &platform_bus;
}
- 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;
More information about the i2c
mailing list