Skip to content

Commit 8d0c937

Browse files
Wolfram Sangjic23
authored andcommitted
iio: pressure: zpa2326: 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-9-wsa+renesas@sang-engineering.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent b0329b3 commit 8d0c937

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

drivers/iio/pressure/zpa2326.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -861,13 +861,13 @@ static int zpa2326_wait_oneshot_completion(const struct iio_dev *indio_dev,
861861
struct zpa2326_private *private)
862862
{
863863
unsigned int val;
864-
long timeout;
864+
long time_left;
865865

866866
zpa2326_dbg(indio_dev, "waiting for one shot completion interrupt");
867867

868-
timeout = wait_for_completion_interruptible_timeout(
868+
time_left = wait_for_completion_interruptible_timeout(
869869
&private->data_ready, ZPA2326_CONVERSION_JIFFIES);
870-
if (timeout > 0)
870+
if (time_left > 0)
871871
/*
872872
* Interrupt handler completed before timeout: return operation
873873
* status.
@@ -877,10 +877,10 @@ static int zpa2326_wait_oneshot_completion(const struct iio_dev *indio_dev,
877877
/* Clear all interrupts just to be sure. */
878878
regmap_read(private->regmap, ZPA2326_INT_SOURCE_REG, &val);
879879

880-
if (!timeout) {
880+
if (!time_left) {
881881
/* Timed out. */
882882
zpa2326_warn(indio_dev, "no one shot interrupt occurred (%ld)",
883-
timeout);
883+
time_left);
884884
return -ETIME;
885885
}
886886

0 commit comments

Comments
 (0)