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: bh1770glc: 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-3-wsa+renesas@sang-engineering.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Wolfram Sang and committed by
Greg Kroah-Hartman
531a185d 71f592d2

+5 -5
+5 -5
drivers/misc/bh1770glc.c
··· 680 680 { 681 681 struct bh1770_chip *chip = dev_get_drvdata(dev); 682 682 ssize_t ret; 683 - long timeout; 683 + long time_left; 684 684 685 685 if (pm_runtime_suspended(dev)) 686 686 return -EIO; /* Chip is not enabled at all */ 687 687 688 - timeout = wait_event_interruptible_timeout(chip->wait, 689 - !chip->lux_wait_result, 690 - msecs_to_jiffies(BH1770_TIMEOUT)); 691 - if (!timeout) 688 + time_left = wait_event_interruptible_timeout(chip->wait, 689 + !chip->lux_wait_result, 690 + msecs_to_jiffies(BH1770_TIMEOUT)); 691 + if (!time_left) 692 692 return -EIO; 693 693 694 694 mutex_lock(&chip->mutex);