]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: fimc-is: use 'time_left' variable with wait_event_timeout()
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Mon, 5 Aug 2024 21:51:17 +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/samsung/exynos4-is/fimc-core.c

index aae74b501a42d2d1591d65b1820f02696f409223..adfc2d73d04b7fd33120b5d05e0e12109476333f 100644 (file)
@@ -822,7 +822,7 @@ err:
 static int fimc_m2m_suspend(struct fimc_dev *fimc)
 {
        unsigned long flags;
-       int timeout;
+       long time_left;
 
        spin_lock_irqsave(&fimc->slock, flags);
        if (!fimc_m2m_pending(fimc)) {
@@ -833,12 +833,12 @@ static int fimc_m2m_suspend(struct fimc_dev *fimc)
        set_bit(ST_M2M_SUSPENDING, &fimc->state);
        spin_unlock_irqrestore(&fimc->slock, flags);
 
-       timeout = wait_event_timeout(fimc->irq_queue,
-                            test_bit(ST_M2M_SUSPENDED, &fimc->state),
-                            FIMC_SHUTDOWN_TIMEOUT);
+       time_left = wait_event_timeout(fimc->irq_queue,
+                                      test_bit(ST_M2M_SUSPENDED, &fimc->state),
+                                      FIMC_SHUTDOWN_TIMEOUT);
 
        clear_bit(ST_M2M_SUSPENDING, &fimc->state);
-       return timeout == 0 ? -EAGAIN : 0;
+       return time_left == 0 ? -EAGAIN : 0;
 }
 
 static int fimc_m2m_resume(struct fimc_dev *fimc)