aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/usbvision
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2009-03-28 21:25:36 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:46 -0400
commit975f5766be048fb65eae6dbf423db129cd641124 (patch)
tree043208d960c145e4ddd9345a0a3df446f01fa4db /drivers/media/video/usbvision
parent6174523c5948f8a36f778f0abdfc648a5d73bf46 (diff)
V4L/DVB (11271): usbvision: Remove buffer type checks from enum_fmt_vid_cap, 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)buf() and vidioc_reqbufs(). Since this driver only defines ->vidioc_try_fmt_vid_cap() the checks can be removed from vidioc_reqbufs(), vidioc_qbuf(), and 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 setting the buffer type in vidioc_enum_fmt_vid_cap() can be removed. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/usbvision')
-rw-r--r--drivers/media/video/usbvision/usbvision-video.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c
index 74a7652dee43..fa62a2fd7b22 100644
--- a/drivers/media/video/usbvision/usbvision-video.c
+++ b/drivers/media/video/usbvision/usbvision-video.c
@@ -757,8 +757,7 @@ static int vidioc_reqbufs (struct file *file,
757 757
758 /* Check input validity: 758 /* Check input validity:
759 the user must do a VIDEO CAPTURE and MMAP method. */ 759 the user must do a VIDEO CAPTURE and MMAP method. */
760 if((vr->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) || 760 if (vr->memory != V4L2_MEMORY_MMAP)
761 (vr->memory != V4L2_MEMORY_MMAP))
762 return -EINVAL; 761 return -EINVAL;
763 762
764 if(usbvision->streaming == Stream_On) { 763 if(usbvision->streaming == Stream_On) {
@@ -816,9 +815,6 @@ static int vidioc_qbuf (struct file *file, void *priv, struct v4l2_buffer *vb)
816 unsigned long lock_flags; 815 unsigned long lock_flags;
817 816
818 /* FIXME : works only on VIDEO_CAPTURE MODE, MMAP. */ 817 /* FIXME : works only on VIDEO_CAPTURE MODE, MMAP. */
819 if(vb->type != V4L2_CAP_VIDEO_CAPTURE) {
820 return -EINVAL;
821 }
822 if(vb->index>=usbvision->num_frames) { 818 if(vb->index>=usbvision->num_frames) {
823 return -EINVAL; 819 return -EINVAL;
824 } 820 }
@@ -853,9 +849,6 @@ static int vidioc_dqbuf (struct file *file, void *priv, struct v4l2_buffer *vb)
853 struct usbvision_frame *f; 849 struct usbvision_frame *f;
854 unsigned long lock_flags; 850 unsigned long lock_flags;
855 851
856 if (vb->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
857 return -EINVAL;
858
859 if (list_empty(&(usbvision->outqueue))) { 852 if (list_empty(&(usbvision->outqueue))) {
860 if (usbvision->streaming == Stream_Idle) 853 if (usbvision->streaming == Stream_Idle)
861 return -EINVAL; 854 return -EINVAL;
@@ -921,7 +914,6 @@ static int vidioc_enum_fmt_vid_cap (struct file *file, void *priv,
921 if(vfd->index>=USBVISION_SUPPORTED_PALETTES-1) { 914 if(vfd->index>=USBVISION_SUPPORTED_PALETTES-1) {
922 return -EINVAL; 915 return -EINVAL;
923 } 916 }
924 vfd->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
925 strcpy(vfd->description,usbvision_v4l2_format[vfd->index].desc); 917 strcpy(vfd->description,usbvision_v4l2_format[vfd->index].desc);
926 vfd->pixelformat = usbvision_v4l2_format[vfd->index].format; 918 vfd->pixelformat = usbvision_v4l2_format[vfd->index].format;
927 return 0; 919 return 0;