Skip to content

Commit 265b81b

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

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

drivers/iio/adc/fsl-imx25-gcq.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static int mx25_gcq_get_raw_value(struct device *dev,
108108
struct mx25_gcq_priv *priv,
109109
int *val)
110110
{
111-
long timeout;
111+
long time_left;
112112
u32 data;
113113

114114
/* Setup the configuration we want to use */
@@ -121,12 +121,12 @@ static int mx25_gcq_get_raw_value(struct device *dev,
121121
regmap_update_bits(priv->regs, MX25_ADCQ_CR, MX25_ADCQ_CR_FQS,
122122
MX25_ADCQ_CR_FQS);
123123

124-
timeout = wait_for_completion_interruptible_timeout(
124+
time_left = wait_for_completion_interruptible_timeout(
125125
&priv->completed, MX25_GCQ_TIMEOUT);
126-
if (timeout < 0) {
126+
if (time_left < 0) {
127127
dev_err(dev, "ADC wait for measurement failed\n");
128-
return timeout;
129-
} else if (timeout == 0) {
128+
return time_left;
129+
} else if (time_left == 0) {
130130
dev_err(dev, "ADC timed out\n");
131131
return -ETIMEDOUT;
132132
}

0 commit comments

Comments
 (0)