iio: adc: stm32-dfsdm-adc: use 'time_left' variable with wait_for_completion_interrup...
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Mon, 29 Apr 2024 11:33:09 +0000 (13:33 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 29 Apr 2024 20:06:18 +0000 (21:06 +0100)
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>
drivers/iio/adc/stm32-dfsdm-adc.c

index ca08ae3108b220ca2a53f862bc9e8085504465a3..9a47d2c87f05a3c0e40774f1cf1cf2979ba2d117 100644 (file)
@@ -1116,7 +1116,7 @@ static int stm32_dfsdm_single_conv(struct iio_dev *indio_dev,
                                   const struct iio_chan_spec *chan, int *res)
 {
        struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
-       long timeout;
+       long time_left;
        int ret;
 
        reinit_completion(&adc->completion);
@@ -1141,17 +1141,17 @@ static int stm32_dfsdm_single_conv(struct iio_dev *indio_dev,
                goto stop_dfsdm;
        }
 
-       timeout = wait_for_completion_interruptible_timeout(&adc->completion,
-                                                           DFSDM_TIMEOUT);
+       time_left = wait_for_completion_interruptible_timeout(&adc->completion,
+                                                             DFSDM_TIMEOUT);
 
        /* Mask IRQ for regular conversion achievement*/
        regmap_update_bits(adc->dfsdm->regmap, DFSDM_CR2(adc->fl_id),
                           DFSDM_CR2_REOCIE_MASK, DFSDM_CR2_REOCIE(0));
 
-       if (timeout == 0)
+       if (time_left == 0)
                ret = -ETIMEDOUT;
-       else if (timeout < 0)
-               ret = timeout;
+       else if (time_left < 0)
+               ret = time_left;
        else
                ret = IIO_VAL_INT;