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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
---
 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;
-- 
2.1.0

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




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux