Commit b7ff0b09 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: vb2: skip request checks for VIDIOC_PREPARE_BUF

VIDIOC_PREPARE_BUF should ignore V4L2_BUF_FLAG_REQUEST_FD since it isn't
doing anything with requests. So inform vb2_queue_or_prepare_buf whether
it is called from vb2_prepare_buf or vb2_qbuf and just return 0 in the
first case.

This was found when adding new v4l2-compliance checks.
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 04990215
...@@ -333,10 +333,10 @@ static int vb2_fill_vb2_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b ...@@ -333,10 +333,10 @@ static int vb2_fill_vb2_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b
} }
static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct media_device *mdev, static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct media_device *mdev,
struct v4l2_buffer *b, struct v4l2_buffer *b, bool is_prepare,
const char *opname,
struct media_request **p_req) struct media_request **p_req)
{ {
const char *opname = is_prepare ? "prepare_buf" : "qbuf";
struct media_request *req; struct media_request *req;
struct vb2_v4l2_buffer *vbuf; struct vb2_v4l2_buffer *vbuf;
struct vb2_buffer *vb; struct vb2_buffer *vb;
...@@ -378,6 +378,9 @@ static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct media_device *md ...@@ -378,6 +378,9 @@ static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct media_device *md
return ret; return ret;
} }
if (is_prepare)
return 0;
if (!(b->flags & V4L2_BUF_FLAG_REQUEST_FD)) { if (!(b->flags & V4L2_BUF_FLAG_REQUEST_FD)) {
if (q->uses_requests) { if (q->uses_requests) {
dprintk(1, "%s: queue uses requests\n", opname); dprintk(1, "%s: queue uses requests\n", opname);
...@@ -657,7 +660,7 @@ int vb2_prepare_buf(struct vb2_queue *q, struct media_device *mdev, ...@@ -657,7 +660,7 @@ int vb2_prepare_buf(struct vb2_queue *q, struct media_device *mdev,
if (b->flags & V4L2_BUF_FLAG_REQUEST_FD) if (b->flags & V4L2_BUF_FLAG_REQUEST_FD)
return -EINVAL; return -EINVAL;
ret = vb2_queue_or_prepare_buf(q, mdev, b, "prepare_buf", NULL); ret = vb2_queue_or_prepare_buf(q, mdev, b, true, NULL);
return ret ? ret : vb2_core_prepare_buf(q, b->index, b); return ret ? ret : vb2_core_prepare_buf(q, b->index, b);
} }
...@@ -729,7 +732,7 @@ int vb2_qbuf(struct vb2_queue *q, struct media_device *mdev, ...@@ -729,7 +732,7 @@ int vb2_qbuf(struct vb2_queue *q, struct media_device *mdev,
return -EBUSY; return -EBUSY;
} }
ret = vb2_queue_or_prepare_buf(q, mdev, b, "qbuf", &req); ret = vb2_queue_or_prepare_buf(q, mdev, b, false, &req);
if (ret) if (ret)
return ret; return ret;
ret = vb2_core_qbuf(q, b->index, b, req); ret = vb2_core_qbuf(q, b->index, b, req);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment