mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ismael Luceno <ismael@iodev.co.uk>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-kernel@vger.kernel.org,
	Bluecherry Maintainers <maintainers@bluecherrydvr.com>,
	Anton Sviridenko <anton@corp.bluecherry.net>,
	Andrey Utkin <andrey_utkin@fastmail.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH 6/8] media: solo6x10: use 'time_left' variable with wait_for_completion_timeout()
Date: Mon, 3 Jun 2024 18:25:50 +0200	[thread overview]
Message-ID: <Zl3ujm4KEBviJIWP@pirotess> (raw)
In-Reply-To: <20240603092841.9500-7-wsa+renesas@sang-engineering.com>

On 03/Jun/2024 11:28, Wolfram Sang wrote:
> 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.
> 
> Fix to the proper variable type 'unsigned long' while here.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  drivers/media/pci/solo6x10/solo6x10-p2m.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/pci/solo6x10/solo6x10-p2m.c b/drivers/media/pci/solo6x10/solo6x10-p2m.c
> index ca70a864a3ef..5f100e5e03d9 100644
> --- a/drivers/media/pci/solo6x10/solo6x10-p2m.c
> +++ b/drivers/media/pci/solo6x10/solo6x10-p2m.c
> @@ -57,7 +57,7 @@ int solo_p2m_dma_desc(struct solo_dev *solo_dev,
>  		      int desc_cnt)
>  {
>  	struct solo_p2m_dev *p2m_dev;
> -	unsigned int timeout;
> +	unsigned long time_left;
>  	unsigned int config = 0;
>  	int ret = 0;
>  	unsigned int p2m_id = 0;
> @@ -99,12 +99,12 @@ int solo_p2m_dma_desc(struct solo_dev *solo_dev,
>  			       desc[1].ctrl);
>  	}
>  
> -	timeout = wait_for_completion_timeout(&p2m_dev->completion,
> -					      solo_dev->p2m_jiffies);
> +	time_left = wait_for_completion_timeout(&p2m_dev->completion,
> +						solo_dev->p2m_jiffies);
>  
>  	if (WARN_ON_ONCE(p2m_dev->error))
>  		ret = -EIO;
> -	else if (timeout == 0) {
> +	else if (time_left == 0) {
>  		solo_dev->p2m_timeouts++;
>  		ret = -EAGAIN;
>  	}

Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>

  reply	other threads:[~2024-06-03 16:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-03  9:28 [PATCH 0/8] media: use 'time_left' instead of 'timeout' with wait_*() functions Wolfram Sang
2024-06-03  9:28 ` [PATCH 1/8] media: allegro: use 'time_left' variable with wait_for_completion_timeout() Wolfram Sang
2024-06-13  8:39   ` Michael Tretter
2024-06-20 19:52     ` Wolfram Sang
2024-06-03  9:28 ` [PATCH 2/8] media: atmel-isi: " Wolfram Sang
2024-06-03  9:28 ` [PATCH 3/8] media: bdisp: use 'time_left' variable with wait_event_timeout() Wolfram Sang
2024-06-03  9:28 ` [PATCH 4/8] media: fimc-is: " Wolfram Sang
2024-06-03  9:28 ` [PATCH 5/8] media: platform: exynos-gsc: " Wolfram Sang
2024-06-03  9:28 ` [PATCH 6/8] media: solo6x10: use 'time_left' variable with wait_for_completion_timeout() Wolfram Sang
2024-06-03 16:25   ` Ismael Luceno [this message]
2024-06-03 16:28     ` Ismael Luceno
2024-06-03  9:28 ` [PATCH 7/8] media: tegra-vde: use 'time_left' variable with wait_for_completion_interruptible_timeout() Wolfram Sang
2024-06-28 15:16   ` Thierry Reding
2024-06-03  9:28 ` [PATCH 8/8] media: ti: cal: use 'time_left' variable with wait_event_timeout() Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zl3ujm4KEBviJIWP@pirotess \
    --to=ismael@iodev.co.uk \
    --cc=andrey_utkin@fastmail.com \
    --cc=anton@corp.bluecherry.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=maintainers@bluecherrydvr.com \
    --cc=mchehab@kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®