diff options
Diffstat (limited to 'drivers/media/video/pwc/pwc-v4l.c')
-rw-r--r-- | drivers/media/video/pwc/pwc-v4l.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c index 8bd0a681990d..834055b71e04 100644 --- a/drivers/media/video/pwc/pwc-v4l.c +++ b/drivers/media/video/pwc/pwc-v4l.c | |||
@@ -284,13 +284,21 @@ static int pwc_vidioc_try_fmt(struct pwc_device *pdev, struct v4l2_format *f) | |||
284 | } | 284 | } |
285 | 285 | ||
286 | /* ioctl(VIDIOC_SET_FMT) */ | 286 | /* ioctl(VIDIOC_SET_FMT) */ |
287 | static int pwc_vidioc_set_fmt(struct pwc_device *pdev, struct v4l2_format *f) | 287 | |
288 | static int pwc_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f) | ||
288 | { | 289 | { |
290 | struct pwc_device *pdev = video_drvdata(file); | ||
289 | int ret, fps, snapshot, compression, pixelformat; | 291 | int ret, fps, snapshot, compression, pixelformat; |
290 | 292 | ||
291 | if (!pdev->udev) | 293 | if (!pdev->udev) |
292 | return -ENODEV; | 294 | return -ENODEV; |
293 | 295 | ||
296 | if (pdev->capt_file != NULL && | ||
297 | pdev->capt_file != file) | ||
298 | return -EBUSY; | ||
299 | |||
300 | pdev->capt_file = file; | ||
301 | |||
294 | ret = pwc_vidioc_try_fmt(pdev, f); | 302 | ret = pwc_vidioc_try_fmt(pdev, f); |
295 | if (ret<0) | 303 | if (ret<0) |
296 | return ret; | 304 | return ret; |
@@ -678,18 +686,17 @@ static int pwc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format * | |||
678 | return pwc_vidioc_try_fmt(pdev, f); | 686 | return pwc_vidioc_try_fmt(pdev, f); |
679 | } | 687 | } |
680 | 688 | ||
681 | static int pwc_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f) | ||
682 | { | ||
683 | struct pwc_device *pdev = video_drvdata(file); | ||
684 | |||
685 | return pwc_vidioc_set_fmt(pdev, f); | ||
686 | } | ||
687 | |||
688 | static int pwc_reqbufs(struct file *file, void *fh, | 689 | static int pwc_reqbufs(struct file *file, void *fh, |
689 | struct v4l2_requestbuffers *rb) | 690 | struct v4l2_requestbuffers *rb) |
690 | { | 691 | { |
691 | struct pwc_device *pdev = video_drvdata(file); | 692 | struct pwc_device *pdev = video_drvdata(file); |
692 | 693 | ||
694 | if (pdev->capt_file != NULL && | ||
695 | pdev->capt_file != file) | ||
696 | return -EBUSY; | ||
697 | |||
698 | pdev->capt_file = file; | ||
699 | |||
693 | return vb2_reqbufs(&pdev->vb_queue, rb); | 700 | return vb2_reqbufs(&pdev->vb_queue, rb); |
694 | } | 701 | } |
695 | 702 | ||
@@ -707,6 +714,9 @@ static int pwc_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) | |||
707 | if (!pdev->udev) | 714 | if (!pdev->udev) |
708 | return -ENODEV; | 715 | return -ENODEV; |
709 | 716 | ||
717 | if (pdev->capt_file != file) | ||
718 | return -EBUSY; | ||
719 | |||
710 | return vb2_qbuf(&pdev->vb_queue, buf); | 720 | return vb2_qbuf(&pdev->vb_queue, buf); |
711 | } | 721 | } |
712 | 722 | ||
@@ -717,6 +727,9 @@ static int pwc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf) | |||
717 | if (!pdev->udev) | 727 | if (!pdev->udev) |
718 | return -ENODEV; | 728 | return -ENODEV; |
719 | 729 | ||
730 | if (pdev->capt_file != file) | ||
731 | return -EBUSY; | ||
732 | |||
720 | return vb2_dqbuf(&pdev->vb_queue, buf, file->f_flags & O_NONBLOCK); | 733 | return vb2_dqbuf(&pdev->vb_queue, buf, file->f_flags & O_NONBLOCK); |
721 | } | 734 | } |
722 | 735 | ||
@@ -727,6 +740,9 @@ static int pwc_streamon(struct file *file, void *fh, enum v4l2_buf_type i) | |||
727 | if (!pdev->udev) | 740 | if (!pdev->udev) |
728 | return -ENODEV; | 741 | return -ENODEV; |
729 | 742 | ||
743 | if (pdev->capt_file != file) | ||
744 | return -EBUSY; | ||
745 | |||
730 | return vb2_streamon(&pdev->vb_queue, i); | 746 | return vb2_streamon(&pdev->vb_queue, i); |
731 | } | 747 | } |
732 | 748 | ||
@@ -737,6 +753,9 @@ static int pwc_streamoff(struct file *file, void *fh, enum v4l2_buf_type i) | |||
737 | if (!pdev->udev) | 753 | if (!pdev->udev) |
738 | return -ENODEV; | 754 | return -ENODEV; |
739 | 755 | ||
756 | if (pdev->capt_file != file) | ||
757 | return -EBUSY; | ||
758 | |||
740 | return vb2_streamoff(&pdev->vb_queue, i); | 759 | return vb2_streamoff(&pdev->vb_queue, i); |
741 | } | 760 | } |
742 | 761 | ||