Skip to content

Commit 7ae3823

Browse files
Wolfram SangAndi Shyti
authored andcommitted
i2c: st: 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]> Reviewed-by: Uwe Kleine-König <[email protected]> Signed-off-by: Andi Shyti <[email protected]>
1 parent c1f8f66 commit 7ae3823

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/i2c/busses/i2c-st.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ static int st_i2c_xfer_msg(struct st_i2c_dev *i2c_dev, struct i2c_msg *msg,
647647
{
648648
struct st_i2c_client *c = &i2c_dev->client;
649649
u32 ctl, i2c, it;
650-
unsigned long timeout;
650+
unsigned long time_left;
651651
int ret;
652652

653653
c->addr = i2c_8bit_addr_from_msg(msg);
@@ -685,11 +685,11 @@ static int st_i2c_xfer_msg(struct st_i2c_dev *i2c_dev, struct i2c_msg *msg,
685685
st_i2c_set_bits(i2c_dev->base + SSC_I2C, SSC_I2C_STRTG);
686686
}
687687

688-
timeout = wait_for_completion_timeout(&i2c_dev->complete,
689-
i2c_dev->adap.timeout);
688+
time_left = wait_for_completion_timeout(&i2c_dev->complete,
689+
i2c_dev->adap.timeout);
690690
ret = c->result;
691691

692-
if (!timeout)
692+
if (!time_left)
693693
ret = -ETIMEDOUT;
694694

695695
i2c = SSC_I2C_STOPG | SSC_I2C_REPSTRTG;

0 commit comments

Comments
 (0)