Skip to content

Commit 9b238f0

Browse files
Wolfram SangAndi Shyti
authored andcommitted
i2c: exynos5: 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 4804a8b commit 9b238f0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/i2c/busses/i2c-exynos5.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ static bool exynos5_i2c_poll_irqs_timeout(struct exynos5_i2c *i2c,
763763
static int exynos5_i2c_xfer_msg(struct exynos5_i2c *i2c,
764764
struct i2c_msg *msgs, int stop)
765765
{
766-
unsigned long timeout;
766+
unsigned long time_left;
767767
int ret;
768768

769769
i2c->msg = msgs;
@@ -775,13 +775,13 @@ static int exynos5_i2c_xfer_msg(struct exynos5_i2c *i2c,
775775
exynos5_i2c_message_start(i2c, stop);
776776

777777
if (!i2c->atomic)
778-
timeout = wait_for_completion_timeout(&i2c->msg_complete,
779-
EXYNOS5_I2C_TIMEOUT);
780-
else
781-
timeout = exynos5_i2c_poll_irqs_timeout(i2c,
778+
time_left = wait_for_completion_timeout(&i2c->msg_complete,
782779
EXYNOS5_I2C_TIMEOUT);
780+
else
781+
time_left = exynos5_i2c_poll_irqs_timeout(i2c,
782+
EXYNOS5_I2C_TIMEOUT);
783783

784-
if (timeout == 0)
784+
if (time_left == 0)
785785
ret = -ETIMEDOUT;
786786
else
787787
ret = i2c->state;

0 commit comments

Comments
 (0)