Skip to content

Commit f9288ff

Browse files
Wolfram SangAndi Shyti
authored andcommitted
i2c: qcom-geni: 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. Fix to the proper variable type 'unsigned long' while here. Signed-off-by: Wolfram Sang <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Reviewed-by: Bryan O'Donoghue <[email protected]> Signed-off-by: Andi Shyti <[email protected]>
1 parent 66aa72c commit f9288ff

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/i2c/busses/i2c-qcom-geni.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,8 @@ static int geni_i2c_gpi_xfer(struct geni_i2c_dev *gi2c, struct i2c_msg msgs[], i
586586
{
587587
struct dma_slave_config config = {};
588588
struct gpi_i2c_config peripheral = {};
589-
int i, ret = 0, timeout;
589+
int i, ret = 0;
590+
unsigned long time_left;
590591
dma_addr_t tx_addr, rx_addr;
591592
void *tx_buf = NULL, *rx_buf = NULL;
592593
const struct geni_i2c_clk_fld *itr = gi2c->clk_fld;
@@ -629,8 +630,8 @@ static int geni_i2c_gpi_xfer(struct geni_i2c_dev *gi2c, struct i2c_msg msgs[], i
629630

630631
dma_async_issue_pending(gi2c->tx_c);
631632

632-
timeout = wait_for_completion_timeout(&gi2c->done, XFER_TIMEOUT);
633-
if (!timeout)
633+
time_left = wait_for_completion_timeout(&gi2c->done, XFER_TIMEOUT);
634+
if (!time_left)
634635
gi2c->err = -ETIMEDOUT;
635636

636637
if (gi2c->err) {

0 commit comments

Comments
 (0)