diff options
author | David Brownell <david-b@pacbell.net> | 2008-07-14 16:38:25 -0400 |
---|---|---|
committer | Jean Delvare <khali@mahadeva.delvare> | 2008-07-14 16:38:25 -0400 |
commit | 97140342e69d479a3ad82bfd4c154c0b08fe3eea (patch) | |
tree | 2ee2ad225c7e4850a30bc57c4bf07251c1da1085 /drivers/i2c/algos/i2c-algo-bit.c | |
parent | 6ea438ec8da4ec56bf415f5ea360e6b0cb59c6c3 (diff) |
i2c: Bus drivers return -Errno not -1
Tighten error paths used by various i2c adapters (mostly x86) so
they return real fault/errno codes instead of a "-1" (which is
most often interpreted as "-EPERM"). Build tested, with eyeball
review.
One minor initial goal is to have adapters consistently return
the code "-ENXIO" when addressing a device doesn't get an ACK
response, at least in the probe paths where they are already
good at stifling related logspam.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
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 | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index 35812823787b..eb8f72ca02f4 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c | |||
@@ -320,7 +320,7 @@ static int try_address(struct i2c_adapter *i2c_adap, | |||
320 | unsigned char addr, int retries) | 320 | unsigned char addr, int retries) |
321 | { | 321 | { |
322 | struct i2c_algo_bit_data *adap = i2c_adap->algo_data; | 322 | struct i2c_algo_bit_data *adap = i2c_adap->algo_data; |
323 | int i, ret = -1; | 323 | int i, ret = 0; |
324 | 324 | ||
325 | for (i = 0; i <= retries; i++) { | 325 | for (i = 0; i <= retries; i++) { |
326 | ret = i2c_outb(i2c_adap, addr); | 326 | ret = i2c_outb(i2c_adap, addr); |
@@ -508,7 +508,7 @@ static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) | |||
508 | addr ^= 1; | 508 | addr ^= 1; |
509 | ret = try_address(i2c_adap, addr, retries); | 509 | ret = try_address(i2c_adap, addr, retries); |
510 | if ((ret != 1) && !nak_ok) | 510 | if ((ret != 1) && !nak_ok) |
511 | return -EREMOTEIO; | 511 | return -ENXIO; |
512 | } | 512 | } |
513 | 513 | ||
514 | return 0; | 514 | return 0; |