Skip to content

Commit 1fa9d4a

Browse files
Wolfram Sangjic23
authored andcommitted
iio: adc: intel_mrfld_adc: 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-5-wsa+renesas@sang-engineering.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 265b81b commit 1fa9d4a

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/iio/adc/intel_mrfld_adc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static int mrfld_adc_single_conv(struct iio_dev *indio_dev,
7575
struct mrfld_adc *adc = iio_priv(indio_dev);
7676
struct regmap *regmap = adc->regmap;
7777
unsigned int req;
78-
long timeout;
78+
long time_left;
7979
__be16 value;
8080
int ret;
8181

@@ -95,13 +95,13 @@ static int mrfld_adc_single_conv(struct iio_dev *indio_dev,
9595
if (ret)
9696
goto done;
9797

98-
timeout = wait_for_completion_interruptible_timeout(&adc->completion,
99-
BCOVE_ADC_TIMEOUT);
100-
if (timeout < 0) {
101-
ret = timeout;
98+
time_left = wait_for_completion_interruptible_timeout(&adc->completion,
99+
BCOVE_ADC_TIMEOUT);
100+
if (time_left < 0) {
101+
ret = time_left;
102102
goto done;
103103
}
104-
if (timeout == 0) {
104+
if (time_left == 0) {
105105
ret = -ETIMEDOUT;
106106
goto done;
107107
}

0 commit comments

Comments
 (0)