aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pwc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/pwc')
-rw-r--r--drivers/media/video/pwc/pwc-if.c171
-rw-r--r--drivers/media/video/pwc/pwc-v4l.c165
-rw-r--r--drivers/media/video/pwc/pwc.h3
3 files changed, 42 insertions, 297 deletions
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c
index ec4e2ef54e65..de7c7ba99ef4 100644
--- a/drivers/media/video/pwc/pwc-if.c
+++ b/drivers/media/video/pwc/pwc-if.c
@@ -136,19 +136,13 @@ static int leds[2] = { 100, 0 };
136 136
137/***/ 137/***/
138 138
139static int pwc_video_close(struct file *file);
140static ssize_t pwc_video_read(struct file *file, char __user *buf,
141 size_t count, loff_t *ppos);
142static unsigned int pwc_video_poll(struct file *file, poll_table *wait);
143static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma);
144
145static const struct v4l2_file_operations pwc_fops = { 139static const struct v4l2_file_operations pwc_fops = {
146 .owner = THIS_MODULE, 140 .owner = THIS_MODULE,
147 .open = v4l2_fh_open, 141 .open = v4l2_fh_open,
148 .release = pwc_video_close, 142 .release = vb2_fop_release,
149 .read = pwc_video_read, 143 .read = vb2_fop_read,
150 .poll = pwc_video_poll, 144 .poll = vb2_fop_poll,
151 .mmap = pwc_video_mmap, 145 .mmap = vb2_fop_mmap,
152 .unlocked_ioctl = video_ioctl2, 146 .unlocked_ioctl = video_ioctl2,
153}; 147};
154static struct video_device pwc_template = { 148static struct video_device pwc_template = {
@@ -562,17 +556,6 @@ static const char *pwc_sensor_type_to_string(unsigned int sensor_type)
562/***************************************************************************/ 556/***************************************************************************/
563/* Video4Linux functions */ 557/* Video4Linux functions */
564 558
565int pwc_test_n_set_capt_file(struct pwc_device *pdev, struct file *file)
566{
567 if (pdev->capt_file != NULL &&
568 pdev->capt_file != file)
569 return -EBUSY;
570
571 pdev->capt_file = file;
572
573 return 0;
574}
575
576static void pwc_video_release(struct v4l2_device *v) 559static void pwc_video_release(struct v4l2_device *v)
577{ 560{
578 struct pwc_device *pdev = container_of(v, struct pwc_device, v4l2_dev); 561 struct pwc_device *pdev = container_of(v, struct pwc_device, v4l2_dev);
@@ -583,113 +566,6 @@ static void pwc_video_release(struct v4l2_device *v)
583 kfree(pdev); 566 kfree(pdev);
584} 567}
585 568
586static int pwc_video_close(struct file *file)
587{
588 struct pwc_device *pdev = video_drvdata(file);
589
590 /*
591 * If we're still streaming vb2_queue_release will call stream_stop
592 * so we must take both the v4l2_lock and the vb_queue_lock.
593 */
594 if (mutex_lock_interruptible(&pdev->v4l2_lock))
595 return -ERESTARTSYS;
596 if (mutex_lock_interruptible(&pdev->vb_queue_lock)) {
597 mutex_unlock(&pdev->v4l2_lock);
598 return -ERESTARTSYS;
599 }
600
601 if (pdev->capt_file == file) {
602 vb2_queue_release(&pdev->vb_queue);
603 pdev->capt_file = NULL;
604 }
605
606 mutex_unlock(&pdev->vb_queue_lock);
607 mutex_unlock(&pdev->v4l2_lock);
608
609 return v4l2_fh_release(file);
610}
611
612static ssize_t pwc_video_read(struct file *file, char __user *buf,
613 size_t count, loff_t *ppos)
614{
615 struct pwc_device *pdev = video_drvdata(file);
616 int lock_v4l2 = 0;
617 ssize_t ret;
618
619 if (mutex_lock_interruptible(&pdev->vb_queue_lock))
620 return -ERESTARTSYS;
621
622 ret = pwc_test_n_set_capt_file(pdev, file);
623 if (ret)
624 goto out;
625
626 /* stream_start will get called so we must take the v4l2_lock */
627 if (pdev->vb_queue.fileio == NULL)
628 lock_v4l2 = 1;
629
630 /* Use try_lock, since we're taking the locks in the *wrong* order! */
631 if (lock_v4l2 && !mutex_trylock(&pdev->v4l2_lock)) {
632 ret = -ERESTARTSYS;
633 goto out;
634 }
635 ret = vb2_read(&pdev->vb_queue, buf, count, ppos,
636 file->f_flags & O_NONBLOCK);
637 if (lock_v4l2)
638 mutex_unlock(&pdev->v4l2_lock);
639out:
640 mutex_unlock(&pdev->vb_queue_lock);
641 return ret;
642}
643
644static unsigned int pwc_video_poll(struct file *file, poll_table *wait)
645{
646 struct pwc_device *pdev = video_drvdata(file);
647 struct vb2_queue *q = &pdev->vb_queue;
648 unsigned long req_events = poll_requested_events(wait);
649 unsigned int ret = POLL_ERR;
650 int lock_v4l2 = 0;
651
652 if (mutex_lock_interruptible(&pdev->vb_queue_lock))
653 return POLL_ERR;
654
655 /* Will this start fileio and thus call start_stream? */
656 if ((req_events & (POLLIN | POLLRDNORM)) &&
657 q->num_buffers == 0 && !q->streaming && q->fileio == NULL) {
658 if (pwc_test_n_set_capt_file(pdev, file))
659 goto out;
660 lock_v4l2 = 1;
661 }
662
663 /* Use try_lock, since we're taking the locks in the *wrong* order! */
664 if (lock_v4l2 && !mutex_trylock(&pdev->v4l2_lock))
665 goto out;
666 ret = vb2_poll(&pdev->vb_queue, file, wait);
667 if (lock_v4l2)
668 mutex_unlock(&pdev->v4l2_lock);
669
670out:
671 if (!pdev->udev)
672 ret |= POLLHUP;
673 mutex_unlock(&pdev->vb_queue_lock);
674 return ret;
675}
676
677static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma)
678{
679 struct pwc_device *pdev = video_drvdata(file);
680 int ret;
681
682 if (mutex_lock_interruptible(&pdev->vb_queue_lock))
683 return -ERESTARTSYS;
684
685 ret = pwc_test_n_set_capt_file(pdev, file);
686 if (ret == 0)
687 ret = vb2_mmap(&pdev->vb_queue, vma);
688
689 mutex_unlock(&pdev->vb_queue_lock);
690 return ret;
691}
692
693/***************************************************************************/ 569/***************************************************************************/
694/* Videobuf2 operations */ 570/* Videobuf2 operations */
695 571
@@ -782,6 +658,8 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count)
782 if (!pdev->udev) 658 if (!pdev->udev)
783 return -ENODEV; 659 return -ENODEV;
784 660
661 if (mutex_lock_interruptible(&pdev->v4l2_lock))
662 return -ERESTARTSYS;
785 /* Turn on camera and set LEDS on */ 663 /* Turn on camera and set LEDS on */
786 pwc_camera_power(pdev, 1); 664 pwc_camera_power(pdev, 1);
787 pwc_set_leds(pdev, leds[0], leds[1]); 665 pwc_set_leds(pdev, leds[0], leds[1]);
@@ -794,6 +672,7 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count)
794 /* And cleanup any queued bufs!! */ 672 /* And cleanup any queued bufs!! */
795 pwc_cleanup_queued_bufs(pdev); 673 pwc_cleanup_queued_bufs(pdev);
796 } 674 }
675 mutex_unlock(&pdev->v4l2_lock);
797 676
798 return r; 677 return r;
799} 678}
@@ -802,6 +681,8 @@ static int stop_streaming(struct vb2_queue *vq)
802{ 681{
803 struct pwc_device *pdev = vb2_get_drv_priv(vq); 682 struct pwc_device *pdev = vb2_get_drv_priv(vq);
804 683
684 if (mutex_lock_interruptible(&pdev->v4l2_lock))
685 return -ERESTARTSYS;
805 if (pdev->udev) { 686 if (pdev->udev) {
806 pwc_set_leds(pdev, 0, 0); 687 pwc_set_leds(pdev, 0, 0);
807 pwc_camera_power(pdev, 0); 688 pwc_camera_power(pdev, 0);
@@ -809,22 +690,11 @@ static int stop_streaming(struct vb2_queue *vq)
809 } 690 }
810 691
811 pwc_cleanup_queued_bufs(pdev); 692 pwc_cleanup_queued_bufs(pdev);
693 mutex_unlock(&pdev->v4l2_lock);
812 694
813 return 0; 695 return 0;
814} 696}
815 697
816static void wait_prepare(struct vb2_queue *vq)
817{
818 struct pwc_device *pdev = vb2_get_drv_priv(vq);
819 mutex_unlock(&pdev->vb_queue_lock);
820}
821
822static void wait_finish(struct vb2_queue *vq)
823{
824 struct pwc_device *pdev = vb2_get_drv_priv(vq);
825 mutex_lock(&pdev->vb_queue_lock);
826}
827
828static struct vb2_ops pwc_vb_queue_ops = { 698static struct vb2_ops pwc_vb_queue_ops = {
829 .queue_setup = queue_setup, 699 .queue_setup = queue_setup,
830 .buf_init = buffer_init, 700 .buf_init = buffer_init,
@@ -834,8 +704,8 @@ static struct vb2_ops pwc_vb_queue_ops = {
834 .buf_queue = buffer_queue, 704 .buf_queue = buffer_queue,
835 .start_streaming = start_streaming, 705 .start_streaming = start_streaming,
836 .stop_streaming = stop_streaming, 706 .stop_streaming = stop_streaming,
837 .wait_prepare = wait_prepare, 707 .wait_prepare = vb2_ops_wait_prepare,
838 .wait_finish = wait_finish, 708 .wait_finish = vb2_ops_wait_finish,
839}; 709};
840 710
841/***************************************************************************/ 711/***************************************************************************/
@@ -1136,6 +1006,8 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
1136 /* Init video_device structure */ 1006 /* Init video_device structure */
1137 memcpy(&pdev->vdev, &pwc_template, sizeof(pwc_template)); 1007 memcpy(&pdev->vdev, &pwc_template, sizeof(pwc_template));
1138 strcpy(pdev->vdev.name, name); 1008 strcpy(pdev->vdev.name, name);
1009 pdev->vdev.queue = &pdev->vb_queue;
1010 pdev->vdev.queue->lock = &pdev->vb_queue_lock;
1139 set_bit(V4L2_FL_USE_FH_PRIO, &pdev->vdev.flags); 1011 set_bit(V4L2_FL_USE_FH_PRIO, &pdev->vdev.flags);
1140 video_set_drvdata(&pdev->vdev, pdev); 1012 video_set_drvdata(&pdev->vdev, pdev);
1141 1013
@@ -1190,15 +1062,6 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
1190 pdev->vdev.v4l2_dev = &pdev->v4l2_dev; 1062 pdev->vdev.v4l2_dev = &pdev->v4l2_dev;
1191 pdev->vdev.lock = &pdev->v4l2_lock; 1063 pdev->vdev.lock = &pdev->v4l2_lock;
1192 1064
1193 /*
1194 * Don't take v4l2_lock for these ioctls. This improves latency if
1195 * v4l2_lock is taken for a long time, e.g. when changing a control
1196 * value, and a new frame is ready to be dequeued.
1197 */
1198 v4l2_disable_ioctl_locking(&pdev->vdev, VIDIOC_DQBUF);
1199 v4l2_disable_ioctl_locking(&pdev->vdev, VIDIOC_QBUF);
1200 v4l2_disable_ioctl_locking(&pdev->vdev, VIDIOC_QUERYBUF);
1201
1202 rc = video_register_device(&pdev->vdev, VFL_TYPE_GRABBER, -1); 1065 rc = video_register_device(&pdev->vdev, VFL_TYPE_GRABBER, -1);
1203 if (rc < 0) { 1066 if (rc < 0) {
1204 PWC_ERROR("Failed to register as video device (%d).\n", rc); 1067 PWC_ERROR("Failed to register as video device (%d).\n", rc);
@@ -1253,20 +1116,18 @@ static void usb_pwc_disconnect(struct usb_interface *intf)
1253 struct v4l2_device *v = usb_get_intfdata(intf); 1116 struct v4l2_device *v = usb_get_intfdata(intf);
1254 struct pwc_device *pdev = container_of(v, struct pwc_device, v4l2_dev); 1117 struct pwc_device *pdev = container_of(v, struct pwc_device, v4l2_dev);
1255 1118
1256 mutex_lock(&pdev->v4l2_lock);
1257
1258 mutex_lock(&pdev->vb_queue_lock); 1119 mutex_lock(&pdev->vb_queue_lock);
1120 mutex_lock(&pdev->v4l2_lock);
1259 /* No need to keep the urbs around after disconnection */ 1121 /* No need to keep the urbs around after disconnection */
1260 if (pdev->vb_queue.streaming) 1122 if (pdev->vb_queue.streaming)
1261 pwc_isoc_cleanup(pdev); 1123 pwc_isoc_cleanup(pdev);
1262 pdev->udev = NULL; 1124 pdev->udev = NULL;
1263 pwc_cleanup_queued_bufs(pdev); 1125 pwc_cleanup_queued_bufs(pdev);
1264 mutex_unlock(&pdev->vb_queue_lock);
1265 1126
1266 v4l2_device_disconnect(&pdev->v4l2_dev); 1127 v4l2_device_disconnect(&pdev->v4l2_dev);
1267 video_unregister_device(&pdev->vdev); 1128 video_unregister_device(&pdev->vdev);
1268
1269 mutex_unlock(&pdev->v4l2_lock); 1129 mutex_unlock(&pdev->v4l2_lock);
1130 mutex_unlock(pdev->vb_queue.lock);
1270 1131
1271#ifdef CONFIG_USB_PWC_INPUT_EVDEV 1132#ifdef CONFIG_USB_PWC_INPUT_EVDEV
1272 if (pdev->button_dev) 1133 if (pdev->button_dev)
diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c
index c691e29cc36e..545e9bbdeede 100644
--- a/drivers/media/video/pwc/pwc-v4l.c
+++ b/drivers/media/video/pwc/pwc-v4l.c
@@ -405,6 +405,7 @@ static void pwc_vidioc_fill_fmt(struct v4l2_format *f,
405 f->fmt.pix.pixelformat = pixfmt; 405 f->fmt.pix.pixelformat = pixfmt;
406 f->fmt.pix.bytesperline = f->fmt.pix.width; 406 f->fmt.pix.bytesperline = f->fmt.pix.width;
407 f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.width * 3 / 2; 407 f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.width * 3 / 2;
408 f->fmt.pix.colorspace = V4L2_COLORSPACE_SRGB;
408 PWC_DEBUG_IOCTL("pwc_vidioc_fill_fmt() " 409 PWC_DEBUG_IOCTL("pwc_vidioc_fill_fmt() "
409 "width=%d, height=%d, bytesperline=%d, sizeimage=%d, pixelformat=%c%c%c%c\n", 410 "width=%d, height=%d, bytesperline=%d, sizeimage=%d, pixelformat=%c%c%c%c\n",
410 f->fmt.pix.width, 411 f->fmt.pix.width,
@@ -468,17 +469,8 @@ static int pwc_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f)
468 if (ret < 0) 469 if (ret < 0)
469 return ret; 470 return ret;
470 471
471 if (mutex_lock_interruptible(&pdev->vb_queue_lock)) 472 if (vb2_is_busy(&pdev->vb_queue))
472 return -ERESTARTSYS; 473 return -EBUSY;
473
474 ret = pwc_test_n_set_capt_file(pdev, file);
475 if (ret)
476 goto leave;
477
478 if (pdev->vb_queue.streaming) {
479 ret = -EBUSY;
480 goto leave;
481 }
482 474
483 pixelformat = f->fmt.pix.pixelformat; 475 pixelformat = f->fmt.pix.pixelformat;
484 476
@@ -496,8 +488,6 @@ static int pwc_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f)
496 PWC_DEBUG_IOCTL("pwc_set_video_mode(), return=%d\n", ret); 488 PWC_DEBUG_IOCTL("pwc_set_video_mode(), return=%d\n", ret);
497 489
498 pwc_vidioc_fill_fmt(f, pdev->width, pdev->height, pdev->pixfmt); 490 pwc_vidioc_fill_fmt(f, pdev->width, pdev->height, pdev->pixfmt);
499leave:
500 mutex_unlock(&pdev->vb_queue_lock);
501 return ret; 491 return ret;
502} 492}
503 493
@@ -508,10 +498,9 @@ static int pwc_querycap(struct file *file, void *fh, struct v4l2_capability *cap
508 strcpy(cap->driver, PWC_NAME); 498 strcpy(cap->driver, PWC_NAME);
509 strlcpy(cap->card, pdev->vdev.name, sizeof(cap->card)); 499 strlcpy(cap->card, pdev->vdev.name, sizeof(cap->card));
510 usb_make_path(pdev->udev, cap->bus_info, sizeof(cap->bus_info)); 500 usb_make_path(pdev->udev, cap->bus_info, sizeof(cap->bus_info));
511 cap->capabilities = 501 cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |
512 V4L2_CAP_VIDEO_CAPTURE | 502 V4L2_CAP_READWRITE;
513 V4L2_CAP_STREAMING | 503 cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
514 V4L2_CAP_READWRITE;
515 return 0; 504 return 0;
516} 505}
517 506
@@ -520,7 +509,8 @@ static int pwc_enum_input(struct file *file, void *fh, struct v4l2_input *i)
520 if (i->index) /* Only one INPUT is supported */ 509 if (i->index) /* Only one INPUT is supported */
521 return -EINVAL; 510 return -EINVAL;
522 511
523 strcpy(i->name, "usb"); 512 strlcpy(i->name, "Camera", sizeof(i->name));
513 i->type = V4L2_INPUT_TYPE_CAMERA;
524 return 0; 514 return 0;
525} 515}
526 516
@@ -933,104 +923,6 @@ static int pwc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *
933 return pwc_vidioc_try_fmt(pdev, f); 923 return pwc_vidioc_try_fmt(pdev, f);
934} 924}
935 925
936static int pwc_reqbufs(struct file *file, void *fh,
937 struct v4l2_requestbuffers *rb)
938{
939 struct pwc_device *pdev = video_drvdata(file);
940 int ret;
941
942 if (mutex_lock_interruptible(&pdev->vb_queue_lock))
943 return -ERESTARTSYS;
944
945 ret = pwc_test_n_set_capt_file(pdev, file);
946 if (ret == 0)
947 ret = vb2_reqbufs(&pdev->vb_queue, rb);
948
949 mutex_unlock(&pdev->vb_queue_lock);
950 return ret;
951}
952
953static int pwc_querybuf(struct file *file, void *fh, struct v4l2_buffer *buf)
954{
955 struct pwc_device *pdev = video_drvdata(file);
956 int ret;
957
958 if (mutex_lock_interruptible(&pdev->vb_queue_lock))
959 return -ERESTARTSYS;
960
961 ret = pwc_test_n_set_capt_file(pdev, file);
962 if (ret == 0)
963 ret = vb2_querybuf(&pdev->vb_queue, buf);
964
965 mutex_unlock(&pdev->vb_queue_lock);
966 return ret;
967}
968
969static int pwc_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
970{
971 struct pwc_device *pdev = video_drvdata(file);
972 int ret;
973
974 if (mutex_lock_interruptible(&pdev->vb_queue_lock))
975 return -ERESTARTSYS;
976
977 ret = pwc_test_n_set_capt_file(pdev, file);
978 if (ret == 0)
979 ret = vb2_qbuf(&pdev->vb_queue, buf);
980
981 mutex_unlock(&pdev->vb_queue_lock);
982 return ret;
983}
984
985static int pwc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
986{
987 struct pwc_device *pdev = video_drvdata(file);
988 int ret;
989
990 if (mutex_lock_interruptible(&pdev->vb_queue_lock))
991 return -ERESTARTSYS;
992
993 ret = pwc_test_n_set_capt_file(pdev, file);
994 if (ret == 0)
995 ret = vb2_dqbuf(&pdev->vb_queue, buf,
996 file->f_flags & O_NONBLOCK);
997
998 mutex_unlock(&pdev->vb_queue_lock);
999 return ret;
1000}
1001
1002static int pwc_streamon(struct file *file, void *fh, enum v4l2_buf_type i)
1003{
1004 struct pwc_device *pdev = video_drvdata(file);
1005 int ret;
1006
1007 if (mutex_lock_interruptible(&pdev->vb_queue_lock))
1008 return -ERESTARTSYS;
1009
1010 ret = pwc_test_n_set_capt_file(pdev, file);
1011 if (ret == 0)
1012 ret = vb2_streamon(&pdev->vb_queue, i);
1013
1014 mutex_unlock(&pdev->vb_queue_lock);
1015 return ret;
1016}
1017
1018static int pwc_streamoff(struct file *file, void *fh, enum v4l2_buf_type i)
1019{
1020 struct pwc_device *pdev = video_drvdata(file);
1021 int ret;
1022
1023 if (mutex_lock_interruptible(&pdev->vb_queue_lock))
1024 return -ERESTARTSYS;
1025
1026 ret = pwc_test_n_set_capt_file(pdev, file);
1027 if (ret == 0)
1028 ret = vb2_streamoff(&pdev->vb_queue, i);
1029
1030 mutex_unlock(&pdev->vb_queue_lock);
1031 return ret;
1032}
1033
1034static int pwc_enum_framesizes(struct file *file, void *fh, 926static int pwc_enum_framesizes(struct file *file, void *fh,
1035 struct v4l2_frmsizeenum *fsize) 927 struct v4l2_frmsizeenum *fsize)
1036{ 928{
@@ -1112,32 +1004,27 @@ static int pwc_s_parm(struct file *file, void *fh,
1112 int compression = 0; 1004 int compression = 0;
1113 int ret, fps; 1005 int ret, fps;
1114 1006
1115 if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || 1007 if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1116 parm->parm.capture.timeperframe.numerator == 0)
1117 return -EINVAL; 1008 return -EINVAL;
1118 1009
1119 fps = parm->parm.capture.timeperframe.denominator / 1010 /* If timeperframe == 0, then reset the framerate to the nominal value.
1120 parm->parm.capture.timeperframe.numerator; 1011 We pick a high framerate here, and let pwc_set_video_mode() figure
1121 1012 out the best match. */
1122 if (mutex_lock_interruptible(&pdev->vb_queue_lock)) 1013 if (parm->parm.capture.timeperframe.numerator == 0 ||
1123 return -ERESTARTSYS; 1014 parm->parm.capture.timeperframe.denominator == 0)
1015 fps = 30;
1016 else
1017 fps = parm->parm.capture.timeperframe.denominator /
1018 parm->parm.capture.timeperframe.numerator;
1124 1019
1125 ret = pwc_test_n_set_capt_file(pdev, file); 1020 if (vb2_is_busy(&pdev->vb_queue))
1126 if (ret) 1021 return -EBUSY;
1127 goto leave;
1128
1129 if (pdev->vb_queue.streaming) {
1130 ret = -EBUSY;
1131 goto leave;
1132 }
1133 1022
1134 ret = pwc_set_video_mode(pdev, pdev->width, pdev->height, pdev->pixfmt, 1023 ret = pwc_set_video_mode(pdev, pdev->width, pdev->height, pdev->pixfmt,
1135 fps, &compression, 0); 1024 fps, &compression, 0);
1136 1025
1137 pwc_g_parm(file, fh, parm); 1026 pwc_g_parm(file, fh, parm);
1138 1027
1139leave:
1140 mutex_unlock(&pdev->vb_queue_lock);
1141 return ret; 1028 return ret;
1142} 1029}
1143 1030
@@ -1150,12 +1037,12 @@ const struct v4l2_ioctl_ops pwc_ioctl_ops = {
1150 .vidioc_g_fmt_vid_cap = pwc_g_fmt_vid_cap, 1037 .vidioc_g_fmt_vid_cap = pwc_g_fmt_vid_cap,
1151 .vidioc_s_fmt_vid_cap = pwc_s_fmt_vid_cap, 1038 .vidioc_s_fmt_vid_cap = pwc_s_fmt_vid_cap,
1152 .vidioc_try_fmt_vid_cap = pwc_try_fmt_vid_cap, 1039 .vidioc_try_fmt_vid_cap = pwc_try_fmt_vid_cap,
1153 .vidioc_reqbufs = pwc_reqbufs, 1040 .vidioc_reqbufs = vb2_ioctl_reqbufs,
1154 .vidioc_querybuf = pwc_querybuf, 1041 .vidioc_querybuf = vb2_ioctl_querybuf,
1155 .vidioc_qbuf = pwc_qbuf, 1042 .vidioc_qbuf = vb2_ioctl_qbuf,
1156 .vidioc_dqbuf = pwc_dqbuf, 1043 .vidioc_dqbuf = vb2_ioctl_dqbuf,
1157 .vidioc_streamon = pwc_streamon, 1044 .vidioc_streamon = vb2_ioctl_streamon,
1158 .vidioc_streamoff = pwc_streamoff, 1045 .vidioc_streamoff = vb2_ioctl_streamoff,
1159 .vidioc_log_status = v4l2_ctrl_log_status, 1046 .vidioc_log_status = v4l2_ctrl_log_status,
1160 .vidioc_enum_framesizes = pwc_enum_framesizes, 1047 .vidioc_enum_framesizes = pwc_enum_framesizes,
1161 .vidioc_enum_frameintervals = pwc_enum_frameintervals, 1048 .vidioc_enum_frameintervals = pwc_enum_frameintervals,
diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h
index d6b5b216b9d6..7a6a0d39c2c6 100644
--- a/drivers/media/video/pwc/pwc.h
+++ b/drivers/media/video/pwc/pwc.h
@@ -239,7 +239,6 @@ struct pwc_device
239 int features; /* feature bits */ 239 int features; /* feature bits */
240 240
241 /*** Video data ***/ 241 /*** Video data ***/
242 struct file *capt_file; /* file doing video capture */
243 int vendpoint; /* video isoc endpoint */ 242 int vendpoint; /* video isoc endpoint */
244 int vcinterface; /* video control interface */ 243 int vcinterface; /* video control interface */
245 int valternate; /* alternate interface needed */ 244 int valternate; /* alternate interface needed */
@@ -355,8 +354,6 @@ struct pwc_device
355extern int pwc_trace; 354extern int pwc_trace;
356#endif 355#endif
357 356
358int pwc_test_n_set_capt_file(struct pwc_device *pdev, struct file *file);
359
360/** Functions in pwc-misc.c */ 357/** Functions in pwc-misc.c */
361/* sizes in pixels */ 358/* sizes in pixels */
362extern const int pwc_image_sizes[PSZ_MAX][2]; 359extern const int pwc_image_sizes[PSZ_MAX][2];