aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/usb
diff options
context:
space:
mode:
authorEzequiel Garcia <elezegarcia@gmail.com>2012-08-19 20:23:45 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-09-25 09:53:34 -0400
commitc6b69c6c58288587c33efb43ca6e19f1c80b2757 (patch)
treeac4e7f87268f31f1261749bcaf07afbe6ba2fa14 /drivers/media/usb
parent065741840b1a58e94d2304b283286b355cbbc616 (diff)
[media] stk1160: Fix s_fmt and try_fmt implementation
The driver was expecting to get a valid pixelformat on s_fmt and try_fmt. This is wrong, since the user may pass a bitmask and expect the driver to change it, returning a valid (fourcc) pixelformat. This problem was spotted by v4l2-compliance. Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r--drivers/media/usb/stk1160/stk1160-v4l.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/media/usb/stk1160/stk1160-v4l.c b/drivers/media/usb/stk1160/stk1160-v4l.c
index c414bc3570c5..879800dd162f 100644
--- a/drivers/media/usb/stk1160/stk1160-v4l.c
+++ b/drivers/media/usb/stk1160/stk1160-v4l.c
@@ -318,12 +318,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
318{ 318{
319 struct stk1160 *dev = video_drvdata(file); 319 struct stk1160 *dev = video_drvdata(file);
320 320
321 if (f->fmt.pix.pixelformat != format[0].fourcc) {
322 stk1160_err("fourcc format 0x%08x invalid\n",
323 f->fmt.pix.pixelformat);
324 return -EINVAL;
325 }
326
327 /* 321 /*
328 * User can't choose size at his own will, 322 * User can't choose size at his own will,
329 * so we just return him the current size chosen 323 * so we just return him the current size chosen
@@ -331,6 +325,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
331 * TODO: Implement frame scaling? 325 * TODO: Implement frame scaling?
332 */ 326 */
333 327
328 f->fmt.pix.pixelformat = dev->fmt->fourcc;
334 f->fmt.pix.width = dev->width; 329 f->fmt.pix.width = dev->width;
335 f->fmt.pix.height = dev->height; 330 f->fmt.pix.height = dev->height;
336 f->fmt.pix.field = V4L2_FIELD_INTERLACED; 331 f->fmt.pix.field = V4L2_FIELD_INTERLACED;
@@ -346,14 +341,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
346{ 341{
347 struct stk1160 *dev = video_drvdata(file); 342 struct stk1160 *dev = video_drvdata(file);
348 struct vb2_queue *q = &dev->vb_vidq; 343 struct vb2_queue *q = &dev->vb_vidq;
349 int rc;
350 344
351 if (vb2_is_busy(q)) 345 if (vb2_is_busy(q))
352 return -EBUSY; 346 return -EBUSY;
353 347
354 rc = vidioc_try_fmt_vid_cap(file, priv, f); 348 vidioc_try_fmt_vid_cap(file, priv, f);
355 if (rc < 0)
356 return rc;
357 349
358 /* We don't support any format changes */ 350 /* We don't support any format changes */
359 351