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

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>
This commit is contained in:
Jean Delvare 2012-03-26 21:47:19 +02:00 committed by Jean Delvare
parent 5694f8a888
commit 41101a3302
1 changed files with 1 additions and 1 deletions

View File

@ -112,7 +112,7 @@ static int sclhi(struct i2c_algo_bit_data *adap)
break; break;
return -ETIMEDOUT; return -ETIMEDOUT;
} }
cond_resched(); cpu_relax();
} }
#ifdef DEBUG #ifdef DEBUG
if (jiffies != start && i2c_debug >= 3) if (jiffies != start && i2c_debug >= 3)