The patch number 11267 was added via Trent Piepho <[email protected]>
to http://linuxtv.org/hg/v4l-dvb master development tree.
Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel
If anyone has any objections, please let us know by sending a message to:
Linux Media Mailing List <[email protected]>
------
From: Trent Piepho <[email protected]>
cafe_ccic: Remove buffer type check from XXXbuf
The v4l2-ioctl core only allows buffer types for which the corresponding
->vidioc_try_fmt_xxx() methods are defined to be used with
vidioc_(q|dq|query)bufs() and vidioc_reqbufs().
This driver only defines ->vidioc_try_fmt_vid_cap() so only VIDEO_CAPTURE
buffers are allowed to be used with cafe_vidioc_reqbufs(),
cafe_vidioc_querybuf(), cafe_vidioc_qbuf(), and cafe_vidioc_dqbuf().
The ->vidioc_(s|g|try|enum)_fmt_vid_cap() methods are only called on
VIDEO_CAPTURE buffers. Thus, there is no need to check or set the buffer's
'type' field since it must already be set to VIDEO_CAPTURE. So the
check in cafe_vidioc_enum_fmt_vid_cap() can be removed.
The 'index' field of v4l2_buffer is unsigned so the checks for it being
less than zero can be removed too.
Priority: normal
Signed-off-by: Trent Piepho <[email protected]>
---
linux/drivers/media/video/cafe_ccic.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff -r 900a6e99e7b0 -r e698f5e2e1db linux/drivers/media/video/cafe_ccic.c
--- a/linux/drivers/media/video/cafe_ccic.c Sat Mar 28 18:25:36 2009 -0700
+++ b/linux/drivers/media/video/cafe_ccic.c Sat Mar 28 18:25:36 2009 -0700
@@ -1152,8 +1152,6 @@ static int cafe_vidioc_reqbufs(struct fi
* Make sure it's something we can do. User pointers could be
* implemented without great pain, but that's not been done yet.
*/
- if (req->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
- return -EINVAL;
if (req->memory != V4L2_MEMORY_MMAP)
return -EINVAL;
/*
@@ -1217,9 +1215,7 @@ static int cafe_vidioc_querybuf(struct f
int ret = -EINVAL;
mutex_lock(&cam->s_mutex);
- if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
- goto out;
- if (buf->index < 0 || buf->index >= cam->n_sbufs)
+ if (buf->index >= cam->n_sbufs)
goto out;
*buf = cam->sb_bufs[buf->index].v4lbuf;
ret = 0;
@@ -1237,9 +1233,7 @@ static int cafe_vidioc_qbuf(struct file
unsigned long flags;
mutex_lock(&cam->s_mutex);
- if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
- goto out;
- if (buf->index < 0 || buf->index >= cam->n_sbufs)
+ if (buf->index >= cam->n_sbufs)
goto out;
sbuf = cam->sb_bufs + buf->index;
if (sbuf->v4lbuf.flags & V4L2_BUF_FLAG_QUEUED) {
@@ -1270,8 +1264,6 @@ static int cafe_vidioc_dqbuf(struct file
unsigned long flags;
mutex_lock(&cam->s_mutex);
- if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
- goto out_unlock;
if (cam->state != S_STREAMING)
goto out_unlock;
if (list_empty(&cam->sb_full) && filp->f_flags & O_NONBLOCK) {
@@ -1504,8 +1496,6 @@ static int cafe_vidioc_enum_fmt_vid_cap(
struct cafe_camera *cam = priv;
int ret;
- if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
- return -EINVAL;
mutex_lock(&cam->s_mutex);
ret = sensor_call(cam, video, enum_fmt, fmt);
mutex_unlock(&cam->s_mutex);
---
Patch is available at:
http://linuxtv.org/hg/v4l-dvb/rev/e698f5e2e1dbea45df210ec59314e6c05c16d375
_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits