mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 13:37:36 +02:00
media: v4l2-ioctl.c: readbuffers depends on V4L2_CAP_READWRITE
commitcd9d9377edupstream. If V4L2_CAP_READWRITE is not set, then readbuffers must be set to 0, otherwise v4l2-compliance will complain. A note on the Fixes tag below: this patch does not really fix that commit, but it can be applied from that commit onwards. For older code there is no guarantee that device_caps is set, so even though this patch would apply, it will not work reliably. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Fixes:049e684f2d(media: v4l2-dev: fix WARN_ON(!vdev->device_caps)) Cc: <stable@vger.kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
1da0b1cd42
commit
7cac8a5624
|
|
@ -2127,6 +2127,7 @@ static int v4l_prepare_buf(const struct v4l2_ioctl_ops *ops,
|
||||||
static int v4l_g_parm(const struct v4l2_ioctl_ops *ops,
|
static int v4l_g_parm(const struct v4l2_ioctl_ops *ops,
|
||||||
struct file *file, void *fh, void *arg)
|
struct file *file, void *fh, void *arg)
|
||||||
{
|
{
|
||||||
|
struct video_device *vfd = video_devdata(file);
|
||||||
struct v4l2_streamparm *p = arg;
|
struct v4l2_streamparm *p = arg;
|
||||||
v4l2_std_id std;
|
v4l2_std_id std;
|
||||||
int ret = check_fmt(file, p->type);
|
int ret = check_fmt(file, p->type);
|
||||||
|
|
@ -2138,7 +2139,8 @@ static int v4l_g_parm(const struct v4l2_ioctl_ops *ops,
|
||||||
if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
|
if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
|
||||||
p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
|
p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
p->parm.capture.readbuffers = 2;
|
if (vfd->device_caps & V4L2_CAP_READWRITE)
|
||||||
|
p->parm.capture.readbuffers = 2;
|
||||||
ret = ops->vidioc_g_std(file, fh, &std);
|
ret = ops->vidioc_g_std(file, fh, &std);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
v4l2_video_std_frame_period(std, &p->parm.capture.timeperframe);
|
v4l2_video_std_frame_period(std, &p->parm.capture.timeperframe);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user