Skip to content

Commit 197264d

Browse files
Wolfram SangAndi Shyti
authored andcommitted
i2c: stm32f7: 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 8839a8d commit 197264d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/i2c/busses/i2c-stm32f7.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,7 +1789,7 @@ static int stm32f7_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr,
17891789
struct stm32f7_i2c_msg *f7_msg = &i2c_dev->f7_msg;
17901790
struct stm32_i2c_dma *dma = i2c_dev->dma;
17911791
struct device *dev = i2c_dev->dev;
1792-
unsigned long timeout;
1792+
unsigned long time_left;
17931793
int i, ret;
17941794

17951795
f7_msg->addr = addr;
@@ -1809,8 +1809,8 @@ static int stm32f7_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr,
18091809
if (ret)
18101810
goto pm_free;
18111811

1812-
timeout = wait_for_completion_timeout(&i2c_dev->complete,
1813-
i2c_dev->adap.timeout);
1812+
time_left = wait_for_completion_timeout(&i2c_dev->complete,
1813+
i2c_dev->adap.timeout);
18141814
ret = f7_msg->result;
18151815
if (ret) {
18161816
if (i2c_dev->use_dma)
@@ -1826,7 +1826,7 @@ static int stm32f7_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr,
18261826
goto pm_free;
18271827
}
18281828

1829-
if (!timeout) {
1829+
if (!time_left) {
18301830
dev_dbg(dev, "Access to slave 0x%x timed out\n", f7_msg->addr);
18311831
if (i2c_dev->use_dma)
18321832
dmaengine_terminate_sync(dma->chan_using);

0 commit comments

Comments
 (0)