All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
	linux-media@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH 1/4] media: rcar-vin: Free buffers with error if hardware stop fails
Date: Mon, 15 Nov 2021 15:36:39 +0100	[thread overview]
Message-ID: <f6a00224-82b1-c506-2c1b-4ebb75657268@xs4all.nl> (raw)
In-Reply-To: <20211108160220.767586-2-niklas.soderlund+renesas@ragnatech.se>

On 08/11/2021 17:02, Niklas Söderlund wrote:
> The driver already have logic to detect if it fails to stop properly and
> report this error to the user. The driver however did not report the
> unused buffers or buffers given to the hardware (if any) with an error,
> the buffers where instead returned to user-space in the active state.
> 
> Build on the existing detection of the error condition and correctly
> return the buffers with an error if it triggers.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
>  drivers/media/platform/rcar-vin/rcar-dma.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c
> index 25ead9333d0046e7..79bb9081853f8781 100644
> --- a/drivers/media/platform/rcar-vin/rcar-dma.c
> +++ b/drivers/media/platform/rcar-vin/rcar-dma.c
> @@ -1371,6 +1371,16 @@ void rvin_stop_streaming(struct rvin_dev *vin)
>  
>  	spin_unlock_irqrestore(&vin->qlock, flags);
>  
> +	/* If something went wrong, free buffers with an error. */
> +	if (!buffersFreed) {
> +		return_unused_buffers(vin, VB2_BUF_STATE_ERROR);
> +		for (i = 0; i < HW_BUFFER_NUM; i++) {
> +			if (vin->buf_hw[i].buffer)
> +				vb2_buffer_done(&vin->buf_hw[i].buffer->vb2_buf,
> +						VB2_BUF_STATE_ERROR);
> +		}
> +	}
> +
>  	rvin_set_stream(vin, 0);
>  
>  	/* disable interrupts */
> 

I'll take this patch, but mark the other three as 'Changes Requested'.

Regards,

	Hans

  reply	other threads:[~2021-11-15 14:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-08 16:02 [PATCH 0/4] media: videobuf2: Add a transfer error event Niklas Söderlund
2021-11-08 16:02 ` [PATCH 1/4] media: rcar-vin: Free buffers with error if hardware stop fails Niklas Söderlund
2021-11-15 14:36   ` Hans Verkuil [this message]
2021-11-08 16:02 ` [PATCH 2/4] media: videobuf2: Add a transfer error event Niklas Söderlund
2022-03-02 15:40   ` Michael Rodin
2021-11-08 16:02 ` [PATCH 3/4] rcar-vin: Stop stream when subdevice signal transfer error Niklas Söderlund
2021-11-08 17:36   ` Hans Verkuil
2021-11-08 18:42     ` Niklas Söderlund
2021-11-15 14:26       ` Hans Verkuil
2022-03-02 16:48         ` Michael Rodin
2022-03-02 20:17           ` Niklas Söderlund
2022-03-06 20:01             ` Michael Rodin
2022-03-07 15:26               ` Niklas Söderlund
2022-03-09 19:27                 ` Michael Rodin
2022-05-19 18:09                   ` Michael Rodin
2021-11-08 16:02 ` [PATCH 4/4] rcar-csi2: Do not try to recover after " Niklas Söderlund

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=f6a00224-82b1-c506-2c1b-4ebb75657268@xs4all.nl \
    --to=hverkuil-cisco@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.