mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] media: rcar-vin: Fold interrupt helpers into only callers
Date: Sun, 15 Jun 2025 00:23:14 +0300	[thread overview]
Message-ID: <20250614212314.GL10542@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20250614141545.2860860-2-niklas.soderlund+renesas@ragnatech.se>

Hi Niklas,

Thank you for the patch.

On Sat, Jun 14, 2025 at 04:15:43PM +0200, Niklas Söderlund wrote:
> The call sites using the interrupt helper functions have all been
> reworked to only one for each. Fold echo of them into the only call
> sites left.
> 
> While at it rename the variable holding the current interrupt status to
> make the code easier to read.
> 
> There is no functional change.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
>  .../platform/renesas/rcar-vin/rcar-dma.c      | 27 +++++--------------
>  1 file changed, 6 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
> index 5c08ee2c9807..585b8b3dcfd8 100644
> --- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
> +++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
> @@ -912,21 +912,6 @@ static int rvin_setup(struct rvin_dev *vin)
>  	return 0;
>  }
>  
> -static void rvin_disable_interrupts(struct rvin_dev *vin)
> -{
> -	rvin_write(vin, 0, VNIE_REG);
> -}
> -
> -static u32 rvin_get_interrupt_status(struct rvin_dev *vin)
> -{
> -	return rvin_read(vin, VNINTS_REG);
> -}
> -
> -static void rvin_ack_interrupt(struct rvin_dev *vin)
> -{
> -	rvin_write(vin, rvin_read(vin, VNINTS_REG), VNINTS_REG);
> -}
> -
>  static bool rvin_capture_active(struct rvin_dev *vin)
>  {
>  	return rvin_read(vin, VNMS_REG) & VNMS_CA;
> @@ -1049,22 +1034,22 @@ static void rvin_capture_stop(struct rvin_dev *vin)
>  static irqreturn_t rvin_irq(int irq, void *data)
>  {
>  	struct rvin_dev *vin = data;
> -	u32 int_status, vnms;
> +	u32 status, vnms;
>  	int slot;
>  	unsigned int handled = 0;
>  	unsigned long flags;
>  
>  	spin_lock_irqsave(&vin->qlock, flags);
>  
> -	int_status = rvin_get_interrupt_status(vin);
> -	if (!int_status)
> +	status = rvin_read(vin, VNINTS_REG);
> +	if (!status)
>  		goto done;
>  
> -	rvin_ack_interrupt(vin);
> +	rvin_write(vin, status, VNINTS_REG);

Actually there is a functional change here. Before this change, if an
interrupt occured between reading VNINTS_REG in
rvin_get_interrupt_status() and reading it again in
rvin_ack_interrupt(), it would get lost. This patch fixes a possible
bug.

With an updated commit message,

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

>  	handled = 1;
>  
>  	/* Nothing to do if nothing was captured. */
> -	if (!(int_status & VNINTS_FIS))
> +	if (!(status & VNINTS_FIS))
>  		goto done;
>  
>  	/* Nothing to do if not running. */
> @@ -1417,7 +1402,7 @@ void rvin_stop_streaming(struct rvin_dev *vin)
>  	rvin_set_stream(vin, 0);
>  
>  	/* disable interrupts */
> -	rvin_disable_interrupts(vin);
> +	rvin_write(vin, 0, VNIE_REG);
>  
>  	/* Return unprocessed buffers from hardware. */
>  	for (unsigned int i = 0; i < HW_BUFFER_NUM; i++) {

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2025-06-14 21:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-14 14:15 [PATCH 0/3] media: rcar-vin: Generate FRAME_SYNC events Niklas Söderlund
2025-06-14 14:15 ` [PATCH 1/3] media: rcar-vin: Fold interrupt helpers into only callers Niklas Söderlund
2025-06-14 21:23   ` Laurent Pinchart [this message]
2025-06-15 12:48     ` Niklas Söderlund
2025-06-16 18:28       ` Laurent Pinchart
2025-06-16  7:02   ` Geert Uytterhoeven
2025-06-14 14:15 ` [PATCH 2/3] media: rcar-vin: Check for correct capture interrupt event Niklas Söderlund
2025-06-14 21:32   ` Laurent Pinchart
2025-06-15 12:47     ` Niklas Söderlund
2025-06-16 18:25       ` Laurent Pinchart
2025-06-14 14:15 ` [PATCH 3/3] media: rcar-vin: Generate FRAME_SYNC events Niklas Söderlund
2025-06-14 21:36   ` Laurent Pinchart

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=20250614212314.GL10542@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=sakari.ailus@linux.intel.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®