Skip to content

Commit 1ce1ad6

Browse files
Wolfram SangAndi Shyti
authored andcommitted
i2c: pxa: use 'time_left' variable with wait_event_timeout()
There is a confusing pattern in the kernel to use a variable named 'timeout' to store the result of wait_event_timeout() causing patterns like: timeout = wait_event_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 bc0ff80 commit 1ce1ad6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/i2c/busses/i2c-pxa.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c)
826826
static int i2c_pxa_send_mastercode(struct pxa_i2c *i2c)
827827
{
828828
u32 icr;
829-
long timeout;
829+
long time_left;
830830

831831
spin_lock_irq(&i2c->lock);
832832
i2c->highmode_enter = true;
@@ -837,12 +837,12 @@ static int i2c_pxa_send_mastercode(struct pxa_i2c *i2c)
837837
writel(icr, _ICR(i2c));
838838

839839
spin_unlock_irq(&i2c->lock);
840-
timeout = wait_event_timeout(i2c->wait,
841-
i2c->highmode_enter == false, HZ * 1);
840+
time_left = wait_event_timeout(i2c->wait,
841+
i2c->highmode_enter == false, HZ * 1);
842842

843843
i2c->highmode_enter = false;
844844

845-
return (timeout == 0) ? I2C_RETRY : 0;
845+
return (time_left == 0) ? I2C_RETRY : 0;
846846
}
847847

848848
/*
@@ -1050,7 +1050,7 @@ static irqreturn_t i2c_pxa_handler(int this_irq, void *dev_id)
10501050
*/
10511051
static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num)
10521052
{
1053-
long timeout;
1053+
long time_left;
10541054
int ret;
10551055

10561056
/*
@@ -1095,15 +1095,15 @@ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num)
10951095
/*
10961096
* The rest of the processing occurs in the interrupt handler.
10971097
*/
1098-
timeout = wait_event_timeout(i2c->wait, i2c->msg_num == 0, HZ * 5);
1098+
time_left = wait_event_timeout(i2c->wait, i2c->msg_num == 0, HZ * 5);
10991099
i2c_pxa_stop_message(i2c);
11001100

11011101
/*
11021102
* We place the return code in i2c->msg_idx.
11031103
*/
11041104
ret = i2c->msg_idx;
11051105

1106-
if (!timeout && i2c->msg_num) {
1106+
if (!time_left && i2c->msg_num) {
11071107
i2c_pxa_scream_blue_murder(i2c, "timeout with active message");
11081108
i2c_recover_bus(&i2c->adap);
11091109
ret = I2C_RETRY;

0 commit comments

Comments
 (0)