Skip to content

Commit 4403988

Browse files
Jean DelvareJean Delvare
Jean Delvare
authored and
Jean Delvare
committed
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 <[email protected]> Cc: Wolfram Sang <[email protected]>
1 parent abc01b2 commit 4403988

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/i2c/algos/i2c-algo-pca.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ static int pca_xfer(struct i2c_adapter *i2c_adap,
196196
} else {
197197
dev_dbg(&i2c_adap->dev, "bus is not idle. status is "
198198
"%#04x\n", state);
199-
return -EAGAIN;
199+
return -EBUSY;
200200
}
201201
}
202202

@@ -224,7 +224,7 @@ static int pca_xfer(struct i2c_adapter *i2c_adap,
224224
}
225225

226226
curmsg = 0;
227-
ret = -EREMOTEIO;
227+
ret = -EIO;
228228
while (curmsg < num) {
229229
state = pca_status(adap);
230230

@@ -259,6 +259,7 @@ static int pca_xfer(struct i2c_adapter *i2c_adap,
259259
case 0x20: /* SLA+W has been transmitted; NOT ACK has been received */
260260
DEB2("NOT ACK received after SLA+W\n");
261261
pca_stop(adap);
262+
ret = -ENXIO;
262263
goto out;
263264

264265
case 0x40: /* SLA+R has been transmitted; ACK has been received */
@@ -283,6 +284,7 @@ static int pca_xfer(struct i2c_adapter *i2c_adap,
283284
case 0x48: /* SLA+R has been transmitted; NOT ACK has been received */
284285
DEB2("NOT ACK received after SLA+R\n");
285286
pca_stop(adap);
287+
ret = -ENXIO;
286288
goto out;
287289

288290
case 0x30: /* Data byte in I2CDAT has been transmitted; NOT ACK has been received */

0 commit comments

Comments
 (0)