i2c-algo-bit: Don't resched on clock stretching
authorJean Delvare <khali@linux-fr.org>
Mon, 26 Mar 2012 19:47:19 +0000 (21:47 +0200)
committerJean Delvare <khali@endymion.delvare>
Mon, 26 Mar 2012 19:47:19 +0000 (21:47 +0200)
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 <khali@linux-fr.org>
Cc: Ben Skeggs <bskeggs@redhat.com>
drivers/i2c/algos/i2c-algo-bit.c

index 69902c8e3b1e0da311246348499d91a4e13c3a93..7f0b83219744e52aa7cd68a7ac5ea6edc49537d1 100644 (file)
@@ -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)