mirror of
https://github.com/torvalds/linux.git
synced 2026-05-26 08:02:27 +02:00
i2c: synquacer: use 'time_left' variable with wait_for_completion_timeout()
There is a confusing pattern in the kernel to use a variable named 'timeout' to store the result of wait_for_completion_timeout() causing patterns like: timeout = wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the code self explaining. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
This commit is contained in:
parent
197264d377
commit
4259964b4a
|
|
@ -311,7 +311,7 @@ static int synquacer_i2c_doxfer(struct synquacer_i2c *i2c,
|
|||
struct i2c_msg *msgs, int num)
|
||||
{
|
||||
unsigned char bsr;
|
||||
unsigned long timeout;
|
||||
unsigned long time_left;
|
||||
int ret;
|
||||
|
||||
synquacer_i2c_hw_init(i2c);
|
||||
|
|
@ -335,9 +335,9 @@ static int synquacer_i2c_doxfer(struct synquacer_i2c *i2c,
|
|||
return ret;
|
||||
}
|
||||
|
||||
timeout = wait_for_completion_timeout(&i2c->completion,
|
||||
msecs_to_jiffies(i2c->timeout_ms));
|
||||
if (timeout == 0) {
|
||||
time_left = wait_for_completion_timeout(&i2c->completion,
|
||||
msecs_to_jiffies(i2c->timeout_ms));
|
||||
if (time_left == 0) {
|
||||
dev_dbg(i2c->dev, "timeout\n");
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user