media: bdisp: use 'time_left' variable with wait_event_timeout()
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Mon, 5 Aug 2024 21:51:16 +0000 (23:51 +0200)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Fri, 9 Aug 2024 05:56:39 +0000 (07:56 +0200)
There is a confusing pattern in the kernel to use a variable named
'timeout' to store the result of wait_event_timeout() causing
patterns like:

        timeout = wait_event_timeout(...)
        if (!timeout) return -ETIMEDOUT;

with all kinds of permutations. Use 'time_left' as a variable to make the
code self explaining.

Fix to the proper variable type 'long' while here.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c

index 1328b4e..c7ee6e1 100644 (file)
@@ -1160,7 +1160,7 @@ static void bdisp_irq_timeout(struct work_struct *ptr)
 static int bdisp_m2m_suspend(struct bdisp_dev *bdisp)
 {
        unsigned long flags;
-       int timeout;
+       long time_left;
 
        spin_lock_irqsave(&bdisp->slock, flags);
        if (!test_bit(ST_M2M_RUNNING, &bdisp->state)) {
@@ -1171,13 +1171,13 @@ static int bdisp_m2m_suspend(struct bdisp_dev *bdisp)
        set_bit(ST_M2M_SUSPENDING, &bdisp->state);
        spin_unlock_irqrestore(&bdisp->slock, flags);
 
-       timeout = wait_event_timeout(bdisp->irq_queue,
-                                    test_bit(ST_M2M_SUSPENDED, &bdisp->state),
-                                    BDISP_WORK_TIMEOUT);
+       time_left = wait_event_timeout(bdisp->irq_queue,
+                                      test_bit(ST_M2M_SUSPENDED, &bdisp->state),
+                                      BDISP_WORK_TIMEOUT);
 
        clear_bit(ST_M2M_SUSPENDING, &bdisp->state);
 
-       if (!timeout) {
+       if (!time_left) {
                dev_err(bdisp->dev, "%s IRQ timeout\n", __func__);
                return -EAGAIN;
        }