From 443f94bec6c6834702ebdac845ef2283f49d04ad Mon Sep 17 00:00:00 2001 From: Ville Syrjala Date: Thu, 15 Mar 2012 18:11:05 +0100 Subject: [PATCH] --- yaml --- r: 288493 b: refs/heads/master c: 8ee161ce5e0cfc689eb677f227a6248191165fac h: refs/heads/master i: 288491: dac0bc793d4c5fed60fd27722a7cfb25052c94c8 v: v3 --- [refs] | 2 +- trunk/drivers/i2c/algos/i2c-algo-bit.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 686f410cf664..466d2b77945c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 834aa6f30c2f5f5ab7c858e37800c1a19dfde2fb +refs/heads/master: 8ee161ce5e0cfc689eb677f227a6248191165fac diff --git a/trunk/drivers/i2c/algos/i2c-algo-bit.c b/trunk/drivers/i2c/algos/i2c-algo-bit.c index 525c7345fa0b..24f94f4ae395 100644 --- a/trunk/drivers/i2c/algos/i2c-algo-bit.c +++ b/trunk/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