From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Cc: tomm.merciai@gmail.com, linux-renesas-soc@vger.kernel.org,
biju.das.jz@bp.renesas.com,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hverkuil+cisco@kernel.org>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
Daniel Scally <dan.scally+renesas@ideasonboard.com>,
Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Khai Nguyen <khai.nguyen.wx@renesas.com>,
Hao Bui <hao.bui.yg@renesas.com>
Subject: Re: [PATCH] media: rzg2l-cru: Replace usleep_range with udelay
Date: Wed, 3 Dec 2025 11:35:52 +0900 [thread overview]
Message-ID: <20251203023552.GM8219@pendragon.ideasonboard.com> (raw)
In-Reply-To: <8d9896e0482a1e04ae8934a1bdaaa7de73f919f1.1764691610.git.tommaso.merciai.xr@bp.renesas.com>
Hi Tommaso,
Thank you for the patch.
On Tue, Dec 02, 2025 at 05:08:41PM +0100, Tommaso Merciai wrote:
> `usleep_range()` should not be used in atomic contexts like between
> spin_lock_irqsave()/spin_lock_irqrestore() pair inside function
> rzg2l_cru_stop_image_processing(). That may cause scheduling while
> atomic bug.
>
> Signed-off-by: Khai Nguyen <khai.nguyen.wx@renesas.com>
> Signed-off-by: Hao Bui <hao.bui.yg@renesas.com>
> Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> ---
> drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> index 162e2ace6931..1355bfd186d4 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> @@ -369,7 +369,7 @@ void rzg2l_cru_stop_image_processing(struct rzg2l_cru_dev *cru)
> if (cru->info->fifo_empty(cru))
> break;
>
> - usleep_range(10, 20);
> + udelay(10);
There's an instance of msleep() earlier in this function, surrounded by
spin_unlock_irqrestore() and spin_lock_irqsave(). I wondered if we
should do the same here, but that lead to a second question: why does
the driver need to cover the whole stop procedure with a spinlock in the
first place ?
> }
>
> /* Notify that FIFO is not empty here */
> @@ -385,7 +385,7 @@ void rzg2l_cru_stop_image_processing(struct rzg2l_cru_dev *cru)
> AMnAXISTPACK_AXI_STOP_ACK)
> break;
>
> - usleep_range(10, 20);
> + udelay(10);
> }
>
> /* Notify that AXI bus can not stop here */
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2025-12-03 2:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-02 16:08 Tommaso Merciai
2025-12-03 2:35 ` Laurent Pinchart [this message]
2025-12-03 8:45 ` Tommaso Merciai
2025-12-03 10:55 ` David Laight
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=20251203023552.GM8219@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=dan.scally+renesas@ideasonboard.com \
--cc=hao.bui.yg@renesas.com \
--cc=hverkuil+cisco@kernel.org \
--cc=jacopo.mondi@ideasonboard.com \
--cc=khai.nguyen.wx@renesas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=tomm.merciai@gmail.com \
--cc=tommaso.merciai.xr@bp.renesas.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®