Skip to content

Commit 8839a8d

Browse files
Wolfram SangAndi Shyti
authored andcommitted
i2c: stm32f4: 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]> Signed-off-by: Andi Shyti <[email protected]>
1 parent 7ae3823 commit 8839a8d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/i2c/busses/i2c-stm32f4.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ static int stm32f4_i2c_xfer_msg(struct stm32f4_i2c_dev *i2c_dev,
681681
{
682682
struct stm32f4_i2c_msg *f4_msg = &i2c_dev->msg;
683683
void __iomem *reg = i2c_dev->base + STM32F4_I2C_CR1;
684-
unsigned long timeout;
684+
unsigned long time_left;
685685
u32 mask;
686686
int ret;
687687

@@ -706,11 +706,11 @@ static int stm32f4_i2c_xfer_msg(struct stm32f4_i2c_dev *i2c_dev,
706706
stm32f4_i2c_set_bits(reg, STM32F4_I2C_CR1_START);
707707
}
708708

709-
timeout = wait_for_completion_timeout(&i2c_dev->complete,
710-
i2c_dev->adap.timeout);
709+
time_left = wait_for_completion_timeout(&i2c_dev->complete,
710+
i2c_dev->adap.timeout);
711711
ret = f4_msg->result;
712712

713-
if (!timeout)
713+
if (!time_left)
714714
ret = -ETIMEDOUT;
715715

716716
return ret;

0 commit comments

Comments
 (0)