diff options
author | Jean Delvare <khali@linux-fr.org> | 2011-10-30 08:47:25 -0400 |
---|---|---|
committer | Jean Delvare <khali@endymion.delvare> | 2011-10-30 08:47:25 -0400 |
commit | abc01b2718ee1d26e83c4c62c4b79806b3240ac7 (patch) | |
tree | f337e7b0a31e189fe23f1d4754cf3947a4d708cf /drivers/i2c/algos/i2c-algo-bit.c | |
parent | f6beb67d8e77454200acc3755344944bd946cded (diff) |
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 <khali@linux-fr.org>
Diffstat (limited to 'drivers/i2c/algos/i2c-algo-bit.c')
-rw-r--r-- | drivers/i2c/algos/i2c-algo-bit.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index c20530a98ca3..85584a547c25 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c | |||
@@ -443,7 +443,7 @@ static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) | |||
443 | acknak(i2c_adap, 0); | 443 | acknak(i2c_adap, 0); |
444 | dev_err(&i2c_adap->dev, "readbytes: invalid " | 444 | dev_err(&i2c_adap->dev, "readbytes: invalid " |
445 | "block length (%d)\n", inval); | 445 | "block length (%d)\n", inval); |
446 | return -EREMOTEIO; | 446 | return -EPROTO; |
447 | } | 447 | } |
448 | /* The original count value accounts for the extra | 448 | /* The original count value accounts for the extra |
449 | bytes, that is, either 1 for a regular transaction, | 449 | 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) | |||
472 | * reads, writes as well as 10bit-addresses. | 472 | * reads, writes as well as 10bit-addresses. |
473 | * returns: | 473 | * returns: |
474 | * 0 everything went okay, the chip ack'ed, or IGNORE_NAK flag was set | 474 | * 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 |
476 | * -ETIMEDOUT, for example if the lines are stuck...) | 476 | * -ETIMEDOUT, for example if the lines are stuck...) |
477 | */ | 477 | */ |
478 | static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) | 478 | 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) | |||
495 | if ((ret != 1) && !nak_ok) { | 495 | if ((ret != 1) && !nak_ok) { |
496 | dev_err(&i2c_adap->dev, | 496 | dev_err(&i2c_adap->dev, |
497 | "died at extended address code\n"); | 497 | "died at extended address code\n"); |
498 | return -EREMOTEIO; | 498 | return -ENXIO; |
499 | } | 499 | } |
500 | /* the remaining 8 bit address */ | 500 | /* the remaining 8 bit address */ |
501 | ret = i2c_outb(i2c_adap, msg->addr & 0x7f); | 501 | ret = i2c_outb(i2c_adap, msg->addr & 0x7f); |
502 | if ((ret != 1) && !nak_ok) { | 502 | if ((ret != 1) && !nak_ok) { |
503 | /* the chip did not ack / xmission error occurred */ | 503 | /* the chip did not ack / xmission error occurred */ |
504 | dev_err(&i2c_adap->dev, "died at 2nd address code\n"); | 504 | dev_err(&i2c_adap->dev, "died at 2nd address code\n"); |
505 | return -EREMOTEIO; | 505 | return -ENXIO; |
506 | } | 506 | } |
507 | if (flags & I2C_M_RD) { | 507 | if (flags & I2C_M_RD) { |
508 | bit_dbg(3, &i2c_adap->dev, "emitting repeated " | 508 | 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) | |||
514 | if ((ret != 1) && !nak_ok) { | 514 | if ((ret != 1) && !nak_ok) { |
515 | dev_err(&i2c_adap->dev, | 515 | dev_err(&i2c_adap->dev, |
516 | "died at repeated address code\n"); | 516 | "died at repeated address code\n"); |
517 | return -EREMOTEIO; | 517 | return -EIO; |
518 | } | 518 | } |
519 | } | 519 | } |
520 | } else { /* normal 7bit address */ | 520 | } else { /* normal 7bit address */ |
@@ -572,7 +572,7 @@ static int bit_xfer(struct i2c_adapter *i2c_adap, | |||
572 | ret, ret == 1 ? "" : "s"); | 572 | ret, ret == 1 ? "" : "s"); |
573 | if (ret < pmsg->len) { | 573 | if (ret < pmsg->len) { |
574 | if (ret >= 0) | 574 | if (ret >= 0) |
575 | ret = -EREMOTEIO; | 575 | ret = -EIO; |
576 | goto bailout; | 576 | goto bailout; |
577 | } | 577 | } |
578 | } else { | 578 | } else { |
@@ -583,7 +583,7 @@ static int bit_xfer(struct i2c_adapter *i2c_adap, | |||
583 | ret, ret == 1 ? "" : "s"); | 583 | ret, ret == 1 ? "" : "s"); |
584 | if (ret < pmsg->len) { | 584 | if (ret < pmsg->len) { |
585 | if (ret >= 0) | 585 | if (ret >= 0) |
586 | ret = -EREMOTEIO; | 586 | ret = -EIO; |
587 | goto bailout; | 587 | goto bailout; |
588 | } | 588 | } |
589 | } | 589 | } |