public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Cc: Pawel Osciak <pawel@osciak.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Mauro Carvalho Chehab <m.chehab@samsung.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vb2: Allow STREAMOFF for io emulator
Date: Tue, 08 Oct 2013 09:22:38 +0200	[thread overview]
Message-ID: <5253B2BE.5090209@samsung.com> (raw)
In-Reply-To: <1380894598-11242-1-git-send-email-ricardo.ribalda@gmail.com>

Hello,

On 2013-10-04 15:49, Ricardo Ribalda Delgado wrote:
> A video device opened and streaming in io emulator mode can only stop
> streamming if its file descriptor is closed.
>
> There are some parameters that can only be changed if the device is not
> streaming. Also, the power consumption of a device streaming could be
> different than one not streaming.
>
> With this patch a video device opened in io emulator can be stopped on
> demand.
>
> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>

Read/write-based io mode must not be mixed with ioctrl-based IO, so I 
really cannot accept this patch. Check V4L2 documentation for more details.

> ---
>   drivers/media/v4l2-core/videobuf2-core.c | 11 ++++++-----
>   1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
> index 9fc4bab..097fba8 100644
> --- a/drivers/media/v4l2-core/videobuf2-core.c
> +++ b/drivers/media/v4l2-core/videobuf2-core.c
> @@ -1686,6 +1686,7 @@ int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type)
>   }
>   EXPORT_SYMBOL_GPL(vb2_streamon);
>   
> +static int __vb2_cleanup_fileio(struct vb2_queue *q);
>   
>   /**
>    * vb2_streamoff - stop streaming
> @@ -1704,11 +1705,6 @@ EXPORT_SYMBOL_GPL(vb2_streamon);
>    */
>   int vb2_streamoff(struct vb2_queue *q, enum v4l2_buf_type type)
>   {
> -	if (q->fileio) {
> -		dprintk(1, "streamoff: file io in progress\n");
> -		return -EBUSY;
> -	}
> -
>   	if (type != q->type) {
>   		dprintk(1, "streamoff: invalid stream type\n");
>   		return -EINVAL;
> @@ -1719,6 +1715,11 @@ int vb2_streamoff(struct vb2_queue *q, enum v4l2_buf_type type)
>   		return -EINVAL;
>   	}
>   
> +	if (q->fileio) {
> +		__vb2_cleanup_fileio(q);
> +		return 0;
> +	}
> +
>   	/*
>   	 * Cancel will pause streaming and remove all buffers from the driver
>   	 * and videobuf, effectively returning control over them to userspace.

Best regards
-- 
Marek Szyprowski
Samsung R&D Institute Poland


  parent reply	other threads:[~2013-10-08  7:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-04 13:49 [PATCH] vb2: Allow STREAMOFF for io emulator Ricardo Ribalda Delgado
2013-10-04 14:09 ` Hans Verkuil
2013-10-04 14:16   ` Ricardo Ribalda Delgado
2013-10-08  7:22 ` Marek Szyprowski [this message]
2013-10-08  7:58   ` Ricardo Ribalda Delgado
2013-10-08 10:00     ` Marek Szyprowski

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=5253B2BE.5090209@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    --cc=pawel@osciak.com \
    --cc=ricardo.ribalda@gmail.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