Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

misc: apds990x: use 'time_left' variable with wait_event_interruptible_timeout()

There is a confusing pattern in the kernel to use a variable named 'timeout' to
store the result of wait_event_interruptible_timeout() causing patterns like:

timeout = wait_event_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/20240604212240.4529-2-wsa+renesas@sang-engineering.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Wolfram Sang and committed by
Greg Kroah-Hartman
71f592d2 36c55ce8

+5 -5
+5 -5
drivers/misc/apds990x.c
··· 625 625 struct apds990x_chip *chip = dev_get_drvdata(dev); 626 626 ssize_t ret; 627 627 u32 result; 628 - long timeout; 628 + long time_left; 629 629 630 630 if (pm_runtime_suspended(dev)) 631 631 return -EIO; 632 632 633 - timeout = wait_event_interruptible_timeout(chip->wait, 634 - !chip->lux_wait_fresh_res, 635 - msecs_to_jiffies(APDS_TIMEOUT)); 636 - if (!timeout) 633 + time_left = wait_event_interruptible_timeout(chip->wait, 634 + !chip->lux_wait_fresh_res, 635 + msecs_to_jiffies(APDS_TIMEOUT)); 636 + if (!time_left) 637 637 return -EIO; 638 638 639 639 mutex_lock(&chip->mutex);