[v2,2/8] media: atmel-isi: use 'time_left' variable with wait_for_completion_timeout()
Commit Message
There is a confusing pattern in the kernel to use a variable named
'timeout' to store the result of wait_for_completion_timeout() causing
patterns like:
timeout = wait_for_completion_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>
---
drivers/media/platform/atmel/atmel-isi.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Comments
On 8/6/24 3:21 AM, Wolfram Sang wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> There is a confusing pattern in the kernel to use a variable named
> 'timeout' to store the result of wait_for_completion_timeout() causing
> patterns like:
>
> timeout = wait_for_completion_timeout(...)
> if (!timeout) return -ETIMEDOUT;
>
> with all kinds of permutations. Use 'time_left' as a variable to make the
> code self explaining.
>
Looks good
Reviewed-by: Hari Prasath Gujulan Elango <hari.prasathge@microchip.com>
Regards,
Hari
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> drivers/media/platform/atmel/atmel-isi.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/platform/atmel/atmel-isi.c b/drivers/media/platform/atmel/atmel-isi.c
> index c1108df72dd5..5c823d3f9cc0 100644
> --- a/drivers/media/platform/atmel/atmel-isi.c
> +++ b/drivers/media/platform/atmel/atmel-isi.c
> @@ -242,7 +242,7 @@ static irqreturn_t isi_interrupt(int irq, void *dev_id)
> #define WAIT_ISI_DISABLE 0
> static int atmel_isi_wait_status(struct atmel_isi *isi, int wait_reset)
> {
> - unsigned long timeout;
> + unsigned long time_left;
> /*
> * The reset or disable will only succeed if we have a
> * pixel clock from the camera.
> @@ -257,9 +257,9 @@ static int atmel_isi_wait_status(struct atmel_isi *isi, int wait_reset)
> isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
> }
>
> - timeout = wait_for_completion_timeout(&isi->complete,
> - msecs_to_jiffies(500));
> - if (timeout == 0)
> + time_left = wait_for_completion_timeout(&isi->complete,
> + msecs_to_jiffies(500));
> + if (time_left == 0)
> return -ETIMEDOUT;
>
> return 0;
> --
> 2.43.0
>
>
@@ -242,7 +242,7 @@ static irqreturn_t isi_interrupt(int irq, void *dev_id)
#define WAIT_ISI_DISABLE 0
static int atmel_isi_wait_status(struct atmel_isi *isi, int wait_reset)
{
- unsigned long timeout;
+ unsigned long time_left;
/*
* The reset or disable will only succeed if we have a
* pixel clock from the camera.
@@ -257,9 +257,9 @@ static int atmel_isi_wait_status(struct atmel_isi *isi, int wait_reset)
isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
}
- timeout = wait_for_completion_timeout(&isi->complete,
- msecs_to_jiffies(500));
- if (timeout == 0)
+ time_left = wait_for_completion_timeout(&isi->complete,
+ msecs_to_jiffies(500));
+ if (time_left == 0)
return -ETIMEDOUT;
return 0;