diff options
Diffstat (limited to 'drivers/i2c/algos/i2c-algo-bit.c')
-rw-r--r-- | drivers/i2c/algos/i2c-algo-bit.c | 8 |
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) | |||
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 |