diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-15 20:14:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-15 20:14:35 -0400 |
commit | 7c32442ff846b7ea8804785e90b81c1118115a5c (patch) | |
tree | 52ce8e32da45511ed0d1b7766a4cf230e8a19270 | |
parent | 538e7e96fd028e628d79f27c05a9a61ff9d01c7c (diff) | |
parent | 8ee161ce5e0cfc689eb677f227a6248191165fac (diff) |
Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
Pull i2c subsystem fixes from Jean Delvare.
* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
i2c-algo-bit: Fix spurious SCL timeouts under heavy load
i2c-core: Comment says "transmitted" but means "received"
-rw-r--r-- | drivers/i2c/algos/i2c-algo-bit.c | 8 | ||||
-rw-r--r-- | drivers/i2c/i2c-core.c | 12 |
2 files changed, 15 insertions, 5 deletions
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index 525c7345fa0b..24f94f4ae395 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c | |||
@@ -103,8 +103,14 @@ static int sclhi(struct i2c_algo_bit_data *adap) | |||
103 | * chips may hold it low ("clock stretching") while they | 103 | * chips may hold it low ("clock stretching") while they |
104 | * are processing data internally. | 104 | * are processing data internally. |
105 | */ | 105 | */ |
106 | if (time_after(jiffies, start + adap->timeout)) | 106 | if (time_after(jiffies, start + adap->timeout)) { |
107 | /* Test one last time, as we may have been preempted | ||
108 | * between last check and timeout test. | ||
109 | */ | ||
110 | if (getscl(adap)) | ||
111 | break; | ||
107 | return -ETIMEDOUT; | 112 | return -ETIMEDOUT; |
113 | } | ||
108 | cond_resched(); | 114 | cond_resched(); |
109 | } | 115 | } |
110 | #ifdef DEBUG | 116 | #ifdef DEBUG |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 1e5606185b4f..e9c18939eda7 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -1386,8 +1386,10 @@ int i2c_master_send(const struct i2c_client *client, const char *buf, int count) | |||
1386 | 1386 | ||
1387 | ret = i2c_transfer(adap, &msg, 1); | 1387 | ret = i2c_transfer(adap, &msg, 1); |
1388 | 1388 | ||
1389 | /* If everything went ok (i.e. 1 msg transmitted), return #bytes | 1389 | /* |
1390 | transmitted, else error code. */ | 1390 | * If everything went ok (i.e. 1 msg transmitted), return #bytes |
1391 | * transmitted, else error code. | ||
1392 | */ | ||
1391 | return (ret == 1) ? count : ret; | 1393 | return (ret == 1) ? count : ret; |
1392 | } | 1394 | } |
1393 | EXPORT_SYMBOL(i2c_master_send); | 1395 | EXPORT_SYMBOL(i2c_master_send); |
@@ -1414,8 +1416,10 @@ int i2c_master_recv(const struct i2c_client *client, char *buf, int count) | |||
1414 | 1416 | ||
1415 | ret = i2c_transfer(adap, &msg, 1); | 1417 | ret = i2c_transfer(adap, &msg, 1); |
1416 | 1418 | ||
1417 | /* If everything went ok (i.e. 1 msg transmitted), return #bytes | 1419 | /* |
1418 | transmitted, else error code. */ | 1420 | * If everything went ok (i.e. 1 msg received), return #bytes received, |
1421 | * else error code. | ||
1422 | */ | ||
1419 | return (ret == 1) ? count : ret; | 1423 | return (ret == 1) ? count : ret; |
1420 | } | 1424 | } |
1421 | EXPORT_SYMBOL(i2c_master_recv); | 1425 | EXPORT_SYMBOL(i2c_master_recv); |