From: Michael Tretter <m.tretter@pengutronix.de>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-kernel@vger.kernel.org,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org
Subject: Re: [PATCH 1/8] media: allegro: use 'time_left' variable with wait_for_completion_timeout()
Date: Thu, 13 Jun 2024 10:39:29 +0200 [thread overview]
Message-ID: <ZmqwQV6Qm1kqoM8t@pengutronix.de> (raw)
In-Reply-To: <20240603092841.9500-2-wsa+renesas@sang-engineering.com>
Hi Wolfram,
On Mon, 03 Jun 2024 11:28:32 +0200, 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.
Thanks for the patch.
There is another instance of wait_for_completion_timeout() in the
driver, which uses tmo instead of timeout. Maybe this patch should
change that, too.
Michael
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> .../media/platform/allegro-dvt/allegro-core.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/media/platform/allegro-dvt/allegro-core.c b/drivers/media/platform/allegro-dvt/allegro-core.c
> index da61f9beb6b4..4016aef5fdb9 100644
> --- a/drivers/media/platform/allegro-dvt/allegro-core.c
> +++ b/drivers/media/platform/allegro-dvt/allegro-core.c
> @@ -2481,14 +2481,14 @@ static void allegro_mcu_interrupt(struct allegro_dev *dev)
> static void allegro_destroy_channel(struct allegro_channel *channel)
> {
> struct allegro_dev *dev = channel->dev;
> - unsigned long timeout;
> + unsigned long time_left;
>
> if (channel_exists(channel)) {
> reinit_completion(&channel->completion);
> allegro_mcu_send_destroy_channel(dev, channel);
> - timeout = wait_for_completion_timeout(&channel->completion,
> - msecs_to_jiffies(5000));
> - if (timeout == 0)
> + time_left = wait_for_completion_timeout(&channel->completion,
> + msecs_to_jiffies(5000));
> + if (time_left == 0)
> v4l2_warn(&dev->v4l2_dev,
> "channel %d: timeout while destroying\n",
> channel->mcu_channel_id);
> @@ -2544,7 +2544,7 @@ static void allegro_destroy_channel(struct allegro_channel *channel)
> static int allegro_create_channel(struct allegro_channel *channel)
> {
> struct allegro_dev *dev = channel->dev;
> - unsigned long timeout;
> + unsigned long time_left;
>
> if (channel_exists(channel)) {
> v4l2_warn(&dev->v4l2_dev,
> @@ -2595,9 +2595,9 @@ static int allegro_create_channel(struct allegro_channel *channel)
>
> reinit_completion(&channel->completion);
> allegro_mcu_send_create_channel(dev, channel);
> - timeout = wait_for_completion_timeout(&channel->completion,
> - msecs_to_jiffies(5000));
> - if (timeout == 0)
> + time_left = wait_for_completion_timeout(&channel->completion,
> + msecs_to_jiffies(5000));
> + if (time_left == 0)
> channel->error = -ETIMEDOUT;
> if (channel->error)
> goto err;
> --
> 2.43.0
>
>
next prev parent reply other threads:[~2024-06-13 8:39 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 [this message]
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
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=ZmqwQV6Qm1kqoM8t@pengutronix.de \
--to=m.tretter@pengutronix.de \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--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®