summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2011-10-30 13:47:25 +0100
committerJean Delvare <khali@endymion.delvare>2011-10-30 13:47:25 +0100
commit4403988afc0a92b8faf59b46f51d25fafaf0e63d (patch)
tree0d3ddd323a5dcbb35e84014b3f33a4380c577dc2
parentabc01b2718ee1d26e83c4c62c4b79806b3240ac7 (diff)
downloadop-kernel-dev-4403988afc0a92b8faf59b46f51d25fafaf0e63d.zip
op-kernel-dev-4403988afc0a92b8faf59b46f51d25fafaf0e63d.tar.gz
i2c-algo-pca: Return standard fault codes
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@linux-fr.org> Cc: Wolfram Sang <w.sang@pengutronix.de>
-rw-r--r--drivers/i2c/algos/i2c-algo-pca.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c
index 4ca9cf9..beb9ffe 100644
--- a/drivers/i2c/algos/i2c-algo-pca.c
+++ b/drivers/i2c/algos/i2c-algo-pca.c
@@ -196,7 +196,7 @@ static int pca_xfer(struct i2c_adapter *i2c_adap,
} 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 *i2c_adap,
}
curmsg = 0;
- ret = -EREMOTEIO;
+ ret = -EIO;
while (curmsg < num) {
state = pca_status(adap);
@@ -259,6 +259,7 @@ static int pca_xfer(struct i2c_adapter *i2c_adap,
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 *i2c_adap,
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 */
OpenPOWER on IntegriCloud