Skip to content

Commit 2f62fd7

Browse files
Wolfram Sangjic23
authored andcommitted
iio: adc: stm32-dfsdm-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-7-wsa+renesas@sang-engineering.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 3cd191f commit 2f62fd7

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/iio/adc/stm32-dfsdm-adc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@ static int stm32_dfsdm_single_conv(struct iio_dev *indio_dev,
11161116
const struct iio_chan_spec *chan, int *res)
11171117
{
11181118
struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
1119-
long timeout;
1119+
long time_left;
11201120
int ret;
11211121

11221122
reinit_completion(&adc->completion);
@@ -1141,17 +1141,17 @@ static int stm32_dfsdm_single_conv(struct iio_dev *indio_dev,
11411141
goto stop_dfsdm;
11421142
}
11431143

1144-
timeout = wait_for_completion_interruptible_timeout(&adc->completion,
1145-
DFSDM_TIMEOUT);
1144+
time_left = wait_for_completion_interruptible_timeout(&adc->completion,
1145+
DFSDM_TIMEOUT);
11461146

11471147
/* Mask IRQ for regular conversion achievement*/
11481148
regmap_update_bits(adc->dfsdm->regmap, DFSDM_CR2(adc->fl_id),
11491149
DFSDM_CR2_REOCIE_MASK, DFSDM_CR2_REOCIE(0));
11501150

1151-
if (timeout == 0)
1151+
if (time_left == 0)
11521152
ret = -ETIMEDOUT;
1153-
else if (timeout < 0)
1154-
ret = timeout;
1153+
else if (time_left < 0)
1154+
ret = time_left;
11551155
else
11561156
ret = IIO_VAL_INT;
11571157

0 commit comments

Comments
 (0)