Skip to content

Commit 4259964

Browse files
Wolfram SangAndi Shyti
authored andcommitted
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 <[email protected]> Acked-by: Ard Biesheuvel <[email protected]> Signed-off-by: Andi Shyti <[email protected]>
1 parent 197264d commit 4259964

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/i2c/busses/i2c-synquacer.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static int synquacer_i2c_doxfer(struct synquacer_i2c *i2c,
311311
struct i2c_msg *msgs, int num)
312312
{
313313
unsigned char bsr;
314-
unsigned long timeout;
314+
unsigned long time_left;
315315
int ret;
316316

317317
synquacer_i2c_hw_init(i2c);
@@ -335,9 +335,9 @@ static int synquacer_i2c_doxfer(struct synquacer_i2c *i2c,
335335
return ret;
336336
}
337337

338-
timeout = wait_for_completion_timeout(&i2c->completion,
339-
msecs_to_jiffies(i2c->timeout_ms));
340-
if (timeout == 0) {
338+
time_left = wait_for_completion_timeout(&i2c->completion,
339+
msecs_to_jiffies(i2c->timeout_ms));
340+
if (time_left == 0) {
341341
dev_dbg(i2c->dev, "timeout\n");
342342
return -EAGAIN;
343343
}

0 commit comments

Comments
 (0)