diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2018-05-12 10:44:01 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-05-28 16:02:45 -0400 |
commit | df95e82f6b0db20615cf249aec653bcd79ea2b59 (patch) | |
tree | cd1e408c77c03f0da73458ffc72f3841c89d8d5e /drivers/media/usb/gspca/gspca.c | |
parent | 0d5615d3479fd165a4aca7f2dc3c418ffed3eb20 (diff) | |
download | linux-stable-df95e82f6b0db20615cf249aec653bcd79ea2b59.tar.gz linux-stable-df95e82f6b0db20615cf249aec653bcd79ea2b59.tar.bz2 linux-stable-df95e82f6b0db20615cf249aec653bcd79ea2b59.zip |
media: gspca: fix g/s_parm handling
Fix v4l2-compliance error: s_parm never set V4L2_CAP_TIMEPERFRAME.
Also various g/s_parm-related cleanups.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/usb/gspca/gspca.c')
-rw-r--r-- | drivers/media/usb/gspca/gspca.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c index ff229d3aae0f..a72799666417 100644 --- a/drivers/media/usb/gspca/gspca.c +++ b/drivers/media/usb/gspca/gspca.c @@ -1256,14 +1256,15 @@ static int vidioc_g_parm(struct file *filp, void *priv, { struct gspca_dev *gspca_dev = video_drvdata(filp); - parm->parm.capture.readbuffers = 2; + parm->parm.capture.readbuffers = gspca_dev->queue.min_buffers_needed; - if (gspca_dev->sd_desc->get_streamparm) { - gspca_dev->usb_err = 0; - gspca_dev->sd_desc->get_streamparm(gspca_dev, parm); - return gspca_dev->usb_err; - } - return 0; + if (!gspca_dev->sd_desc->get_streamparm) + return 0; + + parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; + gspca_dev->usb_err = 0; + gspca_dev->sd_desc->get_streamparm(gspca_dev, parm); + return gspca_dev->usb_err; } static int vidioc_s_parm(struct file *filp, void *priv, @@ -1271,15 +1272,17 @@ static int vidioc_s_parm(struct file *filp, void *priv, { struct gspca_dev *gspca_dev = video_drvdata(filp); - parm->parm.capture.readbuffers = 2; + parm->parm.capture.readbuffers = gspca_dev->queue.min_buffers_needed; - if (gspca_dev->sd_desc->set_streamparm) { - gspca_dev->usb_err = 0; - gspca_dev->sd_desc->set_streamparm(gspca_dev, parm); - return gspca_dev->usb_err; + if (!gspca_dev->sd_desc->set_streamparm) { + parm->parm.capture.capability = 0; + return 0; } - return 0; + parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; + gspca_dev->usb_err = 0; + gspca_dev->sd_desc->set_streamparm(gspca_dev, parm); + return gspca_dev->usb_err; } static int gspca_queue_setup(struct vb2_queue *vq, |