aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/algos/i2c-algo-bit.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-15 17:14:35 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-15 17:14:35 -0700
commit7c32442ff846b7ea8804785e90b81c1118115a5c (patch)
tree52ce8e32da45511ed0d1b7766a4cf230e8a19270 /drivers/i2c/algos/i2c-algo-bit.c
parent538e7e96fd028e628d79f27c05a9a61ff9d01c7c (diff)
parent8ee161ce5e0cfc689eb677f227a6248191165fac (diff)
downloadlinux-7c32442ff846b7ea8804785e90b81c1118115a5c.tar.gz
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"
Diffstat (limited to 'drivers/i2c/algos/i2c-algo-bit.c')
-rw-r--r--drivers/i2c/algos/i2c-algo-bit.c8
1 files changed, 7 insertions, 1 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)
* chips may hold it low ("clock stretching") while they
* are processing data internally.
*/
- if (time_after(jiffies, start + adap->timeout))
+ if (time_after(jiffies, start + adap->timeout)) {
+ /* Test one last time, as we may have been preempted
+ * between last check and timeout test.
+ */
+ if (getscl(adap))
+ break;
return -ETIMEDOUT;
+ }
cond_resched();
}
#ifdef DEBUG