Skip to content

Commit 4804a8b

Browse files
Wolfram SangAndi Shyti
authored andcommitted
i2c: digicolor: 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: Baruch Siach <[email protected]> Signed-off-by: Andi Shyti <[email protected]>
1 parent 571b90f commit 4804a8b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/i2c/busses/i2c-digicolor.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ static irqreturn_t dc_i2c_irq(int irq, void *dev_id)
213213
static int dc_i2c_xfer_msg(struct dc_i2c *i2c, struct i2c_msg *msg, int first,
214214
int last)
215215
{
216-
unsigned long timeout = msecs_to_jiffies(TIMEOUT_MS);
216+
unsigned long time_left = msecs_to_jiffies(TIMEOUT_MS);
217217
unsigned long flags;
218218

219219
spin_lock_irqsave(&i2c->lock, flags);
@@ -227,9 +227,9 @@ static int dc_i2c_xfer_msg(struct dc_i2c *i2c, struct i2c_msg *msg, int first,
227227
dc_i2c_start_msg(i2c, first);
228228
spin_unlock_irqrestore(&i2c->lock, flags);
229229

230-
timeout = wait_for_completion_timeout(&i2c->done, timeout);
230+
time_left = wait_for_completion_timeout(&i2c->done, time_left);
231231
dc_i2c_set_irq(i2c, 0);
232-
if (timeout == 0) {
232+
if (time_left == 0) {
233233
i2c->state = STATE_IDLE;
234234
return -ETIMEDOUT;
235235
}

0 commit comments

Comments
 (0)