Skip to content

Commit b557e26

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

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/i2c/busses/i2c-hix5hd2.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ static void hix5hd2_i2c_message_start(struct hix5hd2_i2c_priv *priv, int stop)
314314
static int hix5hd2_i2c_xfer_msg(struct hix5hd2_i2c_priv *priv,
315315
struct i2c_msg *msgs, int stop)
316316
{
317-
unsigned long timeout;
317+
unsigned long time_left;
318318
int ret;
319319

320320
priv->msg = msgs;
@@ -327,9 +327,9 @@ static int hix5hd2_i2c_xfer_msg(struct hix5hd2_i2c_priv *priv,
327327
reinit_completion(&priv->msg_complete);
328328
hix5hd2_i2c_message_start(priv, stop);
329329

330-
timeout = wait_for_completion_timeout(&priv->msg_complete,
331-
priv->adap.timeout);
332-
if (timeout == 0) {
330+
time_left = wait_for_completion_timeout(&priv->msg_complete,
331+
priv->adap.timeout);
332+
if (time_left == 0) {
333333
priv->state = HIX5I2C_STAT_RW_ERR;
334334
priv->err = -ETIMEDOUT;
335335
dev_warn(priv->dev, "%s timeout=%d\n",

0 commit comments

Comments
 (0)