Skip to content

Commit

Permalink
i2c-algo-bit: Don't resched on clock stretching
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jean Delvare authored and Jean Delvare committed Mar 26, 2012
1 parent 5694f8a commit 41101a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/i2c/algos/i2c-algo-bit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 41101a3

Please sign in to comment.