* [PATCH] i2c-algo-pca: Return standard fault codes
@ 2011-10-20 15:36 Jean Delvare
0 siblings, 0 replies; only message in thread
From: Jean Delvare @ 2011-10-20 15:36 UTC (permalink / raw)
To: Linux I2C; +Cc: Wolfram Sang
Adjust i2c-algo-pca to return fault codes compliant with
Documentation/i2c/fault-codes, rather than the undocumented and
vague -EREMOTEIO.
Signed-off-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Cc: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
Wolfram, could you please test this patch and confirm it works OK for
you? Tools like i2cdetect should behave much better with it.
drivers/i2c/algos/i2c-algo-pca.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- linux-3.1-rc10.orig/drivers/i2c/algos/i2c-algo-pca.c 2011-07-22 04:17:23.000000000 +0200
+++ linux-3.1-rc10/drivers/i2c/algos/i2c-algo-pca.c 2011-10-20 17:25:23.000000000 +0200
@@ -196,7 +196,7 @@ static int pca_xfer(struct i2c_adapter *
} else {
dev_dbg(&i2c_adap->dev, "bus is not idle. status is "
"%#04x\n", state);
- return -EAGAIN;
+ return -EBUSY;
}
}
@@ -224,7 +224,7 @@ static int pca_xfer(struct i2c_adapter *
}
curmsg = 0;
- ret = -EREMOTEIO;
+ ret = -EIO;
while (curmsg < num) {
state = pca_status(adap);
@@ -259,6 +259,7 @@ static int pca_xfer(struct i2c_adapter *
case 0x20: /* SLA+W has been transmitted; NOT ACK has been received */
DEB2("NOT ACK received after SLA+W\n");
pca_stop(adap);
+ ret = -ENXIO;
goto out;
case 0x40: /* SLA+R has been transmitted; ACK has been received */
@@ -283,6 +284,7 @@ static int pca_xfer(struct i2c_adapter *
case 0x48: /* SLA+R has been transmitted; NOT ACK has been received */
DEB2("NOT ACK received after SLA+R\n");
pca_stop(adap);
+ ret = -ENXIO;
goto out;
case 0x30: /* Data byte in I2CDAT has been transmitted; NOT ACK has been received */
--
Jean Delvare
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-10-20 15:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-20 15:36 [PATCH] i2c-algo-pca: Return standard fault codes Jean Delvare
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).