diff mbox

media: au0828 - add vidq busy checks to s_std and s_input

Message ID 1426299523-14718-1-git-send-email-shuahkh@osg.samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shuah Khan March 14, 2015, 2:18 a.m. UTC
au0828 s_std and s_input are missing queue busy checks. Add
vb2_is_busy() calls to s_std and s_input and return -EBUSY
if found busy.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 drivers/media/usb/au0828/au0828-video.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Devin Heitmueller March 14, 2015, 2:39 a.m. UTC | #1
On Fri, Mar 13, 2015 at 10:18 PM, Shuah Khan <shuahkh@osg.samsung.com> wrote:
> au0828 s_std and s_input are missing queue busy checks. Add
> vb2_is_busy() calls to s_std and s_input and return -EBUSY
> if found busy.

These checks are only needed on devices which support more than a
single format (typically for devices which support standards for both
480 and 576 lines).  The au0828 only supports 720x480 capture, and
thus there are no conditions in which the capture window size can
change due to a standard change (since the device only supports
NTSC-M).  Hans has made clear in the past that it's permitted to
toggle inputs when we can be confident that there will be no change in
video standards (in fact, devices that are targeted at surveillance
prefer this to minimize the time toggling between multiple cameras).
A bridge that only supports one video standard and thus input frame
size falls into this category.

While a patch like this is appropriate for some bridges, it is not
needed for au0828.

Can you guys kindly please stop trying to cleanup/refactor au0828 and
xc5000?  First the xc5000 regression that caused arbitrary memory
corruption/panics and now this junk with the vbi_buffer_filled (btw,
did the submitter even *TRY* that patch to see if it actually
worked?).

I know patches like this are well intentioned, but poorly tested
patches and "cleanup" fixes which are completely untested are doing
more harm than good.

Devin
Hans Verkuil March 14, 2015, 10 a.m. UTC | #2
On 03/14/2015 03:18 AM, Shuah Khan wrote:
> au0828 s_std and s_input are missing queue busy checks. Add
> vb2_is_busy() calls to s_std and s_input and return -EBUSY
> if found busy.

I agree with Devin that for this particular driver this patch isn't necessary.

Regards,

	Hans

> 
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
>  drivers/media/usb/au0828/au0828-video.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
> index f47ee90..42c49c2 100644
> --- a/drivers/media/usb/au0828/au0828-video.c
> +++ b/drivers/media/usb/au0828/au0828-video.c
> @@ -1214,6 +1214,11 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm)
>  	if (norm == dev->std)
>  		return 0;
>  
> +	if (vb2_is_busy(&dev->vb_vidq)) {
> +		pr_info("%s queue busy\n", __func__);
> +		return -EBUSY;
> +	}
> +
>  	if (dev->streaming_users > 0)
>  		return -EBUSY;
>  
> @@ -1364,6 +1369,14 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index)
>  		return -EINVAL;
>  	if (AUVI_INPUT(index).type == 0)
>  		return -EINVAL;
> +	/*
> +	 * Changing the input implies a format change, which is not allowed
> +	 * while buffers for use with streaming have already been allocated.
> +	*/
> +	if (vb2_is_busy(&dev->vb_vidq)) {
> +		pr_info("%s queue busy\n", __func__);
> +		return -EBUSY;
> +	}
>  	dev->ctrl_input = index;
>  	au0828_s_input(dev, index);
>  	return 0;
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index f47ee90..42c49c2 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -1214,6 +1214,11 @@  static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm)
 	if (norm == dev->std)
 		return 0;
 
+	if (vb2_is_busy(&dev->vb_vidq)) {
+		pr_info("%s queue busy\n", __func__);
+		return -EBUSY;
+	}
+
 	if (dev->streaming_users > 0)
 		return -EBUSY;
 
@@ -1364,6 +1369,14 @@  static int vidioc_s_input(struct file *file, void *priv, unsigned int index)
 		return -EINVAL;
 	if (AUVI_INPUT(index).type == 0)
 		return -EINVAL;
+	/*
+	 * Changing the input implies a format change, which is not allowed
+	 * while buffers for use with streaming have already been allocated.
+	*/
+	if (vb2_is_busy(&dev->vb_vidq)) {
+		pr_info("%s queue busy\n", __func__);
+		return -EBUSY;
+	}
 	dev->ctrl_input = index;
 	au0828_s_input(dev, index);
 	return 0;