Skip to content

Commit abc01b2

Browse files
Jean DelvareJean Delvare
Jean Delvare
authored and
Jean Delvare
committed
i2c-algo-bit: Return standard fault codes
Adjust i2c-algo-bit to return fault codes compliant with Documentation/i2c/fault-codes, rather than the undocumented and vague -EREMOTEIO. Signed-off-by: Jean Delvare <[email protected]>
1 parent f6beb67 commit abc01b2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
443443
acknak(i2c_adap, 0);
444444
dev_err(&i2c_adap->dev, "readbytes: invalid "
445445
"block length (%d)\n", inval);
446-
return -EREMOTEIO;
446+
return -EPROTO;
447447
}
448448
/* The original count value accounts for the extra
449449
bytes, that is, either 1 for a regular transaction,
@@ -472,7 +472,7 @@ static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
472472
* reads, writes as well as 10bit-addresses.
473473
* returns:
474474
* 0 everything went okay, the chip ack'ed, or IGNORE_NAK flag was set
475-
* -x an error occurred (like: -EREMOTEIO if the device did not answer, or
475+
* -x an error occurred (like: -ENXIO if the device did not answer, or
476476
* -ETIMEDOUT, for example if the lines are stuck...)
477477
*/
478478
static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
@@ -495,14 +495,14 @@ static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
495495
if ((ret != 1) && !nak_ok) {
496496
dev_err(&i2c_adap->dev,
497497
"died at extended address code\n");
498-
return -EREMOTEIO;
498+
return -ENXIO;
499499
}
500500
/* the remaining 8 bit address */
501501
ret = i2c_outb(i2c_adap, msg->addr & 0x7f);
502502
if ((ret != 1) && !nak_ok) {
503503
/* the chip did not ack / xmission error occurred */
504504
dev_err(&i2c_adap->dev, "died at 2nd address code\n");
505-
return -EREMOTEIO;
505+
return -ENXIO;
506506
}
507507
if (flags & I2C_M_RD) {
508508
bit_dbg(3, &i2c_adap->dev, "emitting repeated "
@@ -514,7 +514,7 @@ static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
514514
if ((ret != 1) && !nak_ok) {
515515
dev_err(&i2c_adap->dev,
516516
"died at repeated address code\n");
517-
return -EREMOTEIO;
517+
return -EIO;
518518
}
519519
}
520520
} else { /* normal 7bit address */
@@ -572,7 +572,7 @@ static int bit_xfer(struct i2c_adapter *i2c_adap,
572572
ret, ret == 1 ? "" : "s");
573573
if (ret < pmsg->len) {
574574
if (ret >= 0)
575-
ret = -EREMOTEIO;
575+
ret = -EIO;
576576
goto bailout;
577577
}
578578
} else {
@@ -583,7 +583,7 @@ static int bit_xfer(struct i2c_adapter *i2c_adap,
583583
ret, ret == 1 ? "" : "s");
584584
if (ret < pmsg->len) {
585585
if (ret >= 0)
586-
ret = -EREMOTEIO;
586+
ret = -EIO;
587587
goto bailout;
588588
}
589589
}

0 commit comments

Comments
 (0)