Skip to content

Commit b0329b3

Browse files
Wolfram Sangjic23
authored andcommitted
iio: adc: twl6030-gpadc: use 'time_left' variable with wait_for_completion_interruptible_timeout()
There is a confusing pattern in the kernel to use a variable named 'timeout' to store the result of wait_for_completion_interruptible_timeout() causing patterns like: timeout = wait_for_completion_interruptible_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 <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20240429113313.68359-8-wsa+renesas@sang-engineering.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 2f62fd7 commit b0329b3

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/iio/adc/twl6030-gpadc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ static int twl6030_gpadc_read_raw(struct iio_dev *indio_dev,
519519
{
520520
struct twl6030_gpadc_data *gpadc = iio_priv(indio_dev);
521521
int ret;
522-
long timeout;
522+
long time_left;
523523

524524
mutex_lock(&gpadc->lock);
525525

@@ -529,12 +529,12 @@ static int twl6030_gpadc_read_raw(struct iio_dev *indio_dev,
529529
goto err;
530530
}
531531
/* wait for conversion to complete */
532-
timeout = wait_for_completion_interruptible_timeout(
532+
time_left = wait_for_completion_interruptible_timeout(
533533
&gpadc->irq_complete, msecs_to_jiffies(5000));
534-
if (timeout == 0) {
534+
if (time_left == 0) {
535535
ret = -ETIMEDOUT;
536536
goto err;
537-
} else if (timeout < 0) {
537+
} else if (time_left < 0) {
538538
ret = -EINTR;
539539
goto err;
540540
}

0 commit comments

Comments
 (0)