All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Ben Hutchings <ben.hutchings@codethink.co.uk>,
	linux-media@vger.kernel.org
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	linux-kernel@codethink.co.uk,
	William Towle <william.towle@codethink.co.uk>,
	Hans Verkuil <hverkuil@xs4all.nl>
Subject: Re: [RFC PATCH 5/5] media: rcar_vin: move buffer management to .stop_streaming handler
Date: Thu, 18 Dec 2014 20:33:36 +0300	[thread overview]
Message-ID: <54930FF0.4010409@cogentembedded.com> (raw)
In-Reply-To: <1418914215.22813.18.camel@xylophone.i.decadent.org.uk>

Hello.

On 12/18/2014 05:50 PM, Ben Hutchings wrote:

> From: William Towle <william.towle@codethink.co.uk>

> Move the buffer state test in the .buf_cleanup handler into
> .stop_streaming so that a) the vb2_queue API is not subverted, and
> b) tracking of active-state buffers via priv->queue_buf[] is handled
> as early as is possible

> Signed-off-by: William Towle <william.towle@codethink.co.uk>
> ---
>   drivers/media/platform/soc_camera/rcar_vin.c |   36 ++++++++++----------------
>   1 file changed, 14 insertions(+), 22 deletions(-)

> diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
> index 20dbedf..bf60074 100644
> --- a/drivers/media/platform/soc_camera/rcar_vin.c
> +++ b/drivers/media/platform/soc_camera/rcar_vin.c
[...]
> @@ -533,8 +513,20 @@ static void rcar_vin_stop_streaming(struct vb2_queue *vq)
>   	rcar_vin_wait_stop_streaming(priv);
>
>   	for (i = 0; i < vq->num_buffers; ++i)
> -		if (vq->bufs[i]->state == VB2_BUF_STATE_ACTIVE)
> +		if (vq->bufs[i]->state == VB2_BUF_STATE_ACTIVE) {
> +			int j;
> +
> +			/*  Is this a buffer we have told the
> +			 *  hardware about? Update the associated
> +			 *  list, if so
> +			 */
> +			for (j = 0; j < MAX_BUFFER_NUM; j++) {
> +				if (priv->queue_buf[j] == vq->bufs[i]) {
> +					priv->queue_buf[j] = NULL;
> +				}

    Don't need {} here.

> +			}
>   			vb2_buffer_done(vq->bufs[i], VB2_BUF_STATE_ERROR);
> +		}

WBR, Sergei


  reply	other threads:[~2014-12-18 17:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-18 14:47 [RFC PATCH 0/5] media: rcar_vin: Fixes for buffer management Ben Hutchings
2014-12-18 14:49 ` [RFC PATCH 1/5] media: rcar_vin: Dont aggressively retire buffers Ben Hutchings
2015-01-18 20:16   ` Guennadi Liakhovetski
2014-12-18 14:49 ` [RFC PATCH 2/5] media: rcar_vin: Ensure all in-flight buffers are returned to error state before stopping Ben Hutchings
2014-12-30 13:14   ` Sakari Ailus
2014-12-18 14:49 ` [RFC PATCH 3/5] media: rcar_vin: Fix race condition terminating stream Ben Hutchings
2014-12-18 17:40   ` Sergei Shtylyov
2015-01-18 20:34     ` Guennadi Liakhovetski
2014-12-18 14:49 ` [RFC PATCH 4/5] media: rcar_vin: Clean up rcar_vin_irq Ben Hutchings
2014-12-18 14:50 ` [RFC PATCH 5/5] media: rcar_vin: move buffer management to .stop_streaming handler Ben Hutchings
2014-12-18 17:33   ` Sergei Shtylyov [this message]
2015-01-18 21:23   ` Guennadi Liakhovetski
2015-01-19 10:50     ` Ben Hutchings
2015-01-19 11:11       ` Guennadi Liakhovetski
2015-01-19 14:11         ` William Towle
2015-01-19 14:25           ` Guennadi Liakhovetski
2015-01-20 12:27             ` William Towle
2015-01-19 14:52           ` Hans Verkuil
2014-12-18 17:36 ` [RFC PATCH 0/5] media: rcar_vin: Fixes for buffer management Sergei Shtylyov

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=54930FF0.4010409@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=ben.hutchings@codethink.co.uk \
    --cc=g.liakhovetski@gmx.de \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-kernel@codethink.co.uk \
    --cc=linux-media@vger.kernel.org \
    --cc=william.towle@codethink.co.uk \
    /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.