Skip to content

Commit 3cd191f

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

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

drivers/iio/adc/stm32-adc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,7 @@ static int stm32_adc_single_conv(struct iio_dev *indio_dev,
14081408
struct stm32_adc *adc = iio_priv(indio_dev);
14091409
struct device *dev = indio_dev->dev.parent;
14101410
const struct stm32_adc_regspec *regs = adc->cfg->regs;
1411-
long timeout;
1411+
long time_left;
14121412
u32 val;
14131413
int ret;
14141414

@@ -1440,12 +1440,12 @@ static int stm32_adc_single_conv(struct iio_dev *indio_dev,
14401440

14411441
adc->cfg->start_conv(indio_dev, false);
14421442

1443-
timeout = wait_for_completion_interruptible_timeout(
1443+
time_left = wait_for_completion_interruptible_timeout(
14441444
&adc->completion, STM32_ADC_TIMEOUT);
1445-
if (timeout == 0) {
1445+
if (time_left == 0) {
14461446
ret = -ETIMEDOUT;
1447-
} else if (timeout < 0) {
1448-
ret = timeout;
1447+
} else if (time_left < 0) {
1448+
ret = time_left;
14491449
} else {
14501450
*res = adc->buffer[0];
14511451
ret = IIO_VAL_INT;

0 commit comments

Comments
 (0)