projects/linux·commit 41101a33

i2c-algo-bit: Don't resched on clock stretching

41101a33 · Jean Delvare <[email protected]> · 2012-03-26 21:47:19 +02:00

Clock stretching is not supposed to last long, so asking to be
rescheduled while waiting for the clock line to be released by a slave
makes little sense. Odds are that the clock line will long have been
released when we run again, so we will have lost time and may even
get an SMBus timeout because of this.

So just busy-wait in that case. This also participates in the effort
to make i2c-algo-bit usable in contexts that can't sleep.

Signed-off-by: Jean Delvare <[email protected]>
Cc: Ben Skeggs <[email protected]>
Commit
41101a33026c215a09e5d3549aedfcdae9105515
Parents
5694f8a8

Changes

1 files changed · +1 −1

FileStatusAddDelContent
drivers/i2c/algos/i2c-algo-bit.cmodified+1−1View file

drivers/i2c/algos/i2c-algo-bit.c

View file
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index 69902c8..7f0b832 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -112,7 +112,7 @@ static int sclhi(struct i2c_algo_bit_data *adap)
break;
return -ETIMEDOUT;
}
- cond_resched();
+ cpu_relax();
}
#ifdef DEBUG
if (jiffies != start && i2c_debug >= 3)