Skip to content

Commit c1f8f66

Browse files
Wolfram SangAndi Shyti
authored andcommitted
i2c: omap: 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 8dacd79 commit c1f8f66

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/i2c/busses/i2c-omap.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
660660
struct i2c_msg *msg, int stop, bool polling)
661661
{
662662
struct omap_i2c_dev *omap = i2c_get_adapdata(adap);
663-
unsigned long timeout;
663+
unsigned long time_left;
664664
u16 w;
665665
int ret;
666666

@@ -740,18 +740,18 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
740740
* into arbitration and we're currently unable to recover from it.
741741
*/
742742
if (!polling) {
743-
timeout = wait_for_completion_timeout(&omap->cmd_complete,
744-
OMAP_I2C_TIMEOUT);
743+
time_left = wait_for_completion_timeout(&omap->cmd_complete,
744+
OMAP_I2C_TIMEOUT);
745745
} else {
746746
do {
747747
omap_i2c_wait(omap);
748748
ret = omap_i2c_xfer_data(omap);
749749
} while (ret == -EAGAIN);
750750

751-
timeout = !ret;
751+
time_left = !ret;
752752
}
753753

754-
if (timeout == 0) {
754+
if (time_left == 0) {
755755
omap_i2c_reset(omap);
756756
__omap_i2c_init(omap);
757757
return -ETIMEDOUT;

0 commit comments

Comments
 (0)