Skip to content

Commit 4d68b25

Browse files
Wolfram Sangjic23
authored andcommitted
iio: adc: ad_sigma_delta: use 'time_left' variable with wait_for_completion_timeout()
There is a confusing pattern in the kernel to use a variable named 'timeout' to store the result of wait_for_completion_timeout() causing patterns like: timeout = wait_for_completion_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> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20240429113313.68359-2-wsa+renesas@sang-engineering.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent d164888 commit 4d68b25

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/iio/adc/ad_sigma_delta.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ int ad_sd_calibrate(struct ad_sigma_delta *sigma_delta,
206206
unsigned int mode, unsigned int channel)
207207
{
208208
int ret;
209-
unsigned long timeout;
209+
unsigned long time_left;
210210

211211
ret = ad_sigma_delta_set_channel(sigma_delta, channel);
212212
if (ret)
@@ -223,8 +223,8 @@ int ad_sd_calibrate(struct ad_sigma_delta *sigma_delta,
223223

224224
sigma_delta->irq_dis = false;
225225
enable_irq(sigma_delta->irq_line);
226-
timeout = wait_for_completion_timeout(&sigma_delta->completion, 2 * HZ);
227-
if (timeout == 0) {
226+
time_left = wait_for_completion_timeout(&sigma_delta->completion, 2 * HZ);
227+
if (time_left == 0) {
228228
sigma_delta->irq_dis = true;
229229
disable_irq_nosync(sigma_delta->irq_line);
230230
ret = -EIO;

0 commit comments

Comments
 (0)