diff options
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/vivi.c | 48 |
1 files changed, 4 insertions, 44 deletions
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index cdef622f6b32..82755091648b 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c | |||
@@ -170,7 +170,6 @@ struct vivi_dev { | |||
170 | int users; | 170 | int users; |
171 | 171 | ||
172 | /* various device info */ | 172 | /* various device info */ |
173 | unsigned int resources; | ||
174 | struct video_device vfd; | 173 | struct video_device vfd; |
175 | 174 | ||
176 | struct vivi_dmaqueue vidq; | 175 | struct vivi_dmaqueue vidq; |
@@ -727,40 +726,6 @@ static struct videobuf_queue_ops vivi_video_qops = { | |||
727 | }; | 726 | }; |
728 | 727 | ||
729 | /* ------------------------------------------------------------------ | 728 | /* ------------------------------------------------------------------ |
730 | IOCTL handling | ||
731 | ------------------------------------------------------------------*/ | ||
732 | |||
733 | |||
734 | static int res_get(struct vivi_dev *dev, struct vivi_fh *fh) | ||
735 | { | ||
736 | /* is it free? */ | ||
737 | mutex_lock(&dev->lock); | ||
738 | if (dev->resources) { | ||
739 | /* no, someone else uses it */ | ||
740 | mutex_unlock(&dev->lock); | ||
741 | return 0; | ||
742 | } | ||
743 | /* it's free, grab it */ | ||
744 | dev->resources =1; | ||
745 | dprintk(1,"res: get\n"); | ||
746 | mutex_unlock(&dev->lock); | ||
747 | return 1; | ||
748 | } | ||
749 | |||
750 | static int res_locked(struct vivi_dev *dev) | ||
751 | { | ||
752 | return (dev->resources); | ||
753 | } | ||
754 | |||
755 | static void res_free(struct vivi_dev *dev, struct vivi_fh *fh) | ||
756 | { | ||
757 | mutex_lock(&dev->lock); | ||
758 | dev->resources = 0; | ||
759 | dprintk(1,"res: put\n"); | ||
760 | mutex_lock(&dev->lock); | ||
761 | } | ||
762 | |||
763 | /* ------------------------------------------------------------------ | ||
764 | IOCTL vidioc handling | 729 | IOCTL vidioc handling |
765 | ------------------------------------------------------------------*/ | 730 | ------------------------------------------------------------------*/ |
766 | static int vidioc_querycap (struct file *file, void *priv, | 731 | static int vidioc_querycap (struct file *file, void *priv, |
@@ -913,9 +878,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) | |||
913 | if (i != fh->type) | 878 | if (i != fh->type) |
914 | return -EINVAL; | 879 | return -EINVAL; |
915 | 880 | ||
916 | if (!res_get(dev,fh)) | 881 | return videobuf_streamon(&fh->vb_vidq); |
917 | return -EBUSY; | ||
918 | return (videobuf_streamon(&fh->vb_vidq)); | ||
919 | } | 882 | } |
920 | 883 | ||
921 | static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) | 884 | static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) |
@@ -928,10 +891,7 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) | |||
928 | if (i != fh->type) | 891 | if (i != fh->type) |
929 | return -EINVAL; | 892 | return -EINVAL; |
930 | 893 | ||
931 | videobuf_streamoff(&fh->vb_vidq); | 894 | return videobuf_streamoff(&fh->vb_vidq); |
932 | res_free(dev,fh); | ||
933 | |||
934 | return (0); | ||
935 | } | 895 | } |
936 | 896 | ||
937 | static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *i) | 897 | static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *i) |
@@ -1096,10 +1056,10 @@ static ssize_t | |||
1096 | vivi_read(struct file *file, char __user *data, size_t count, loff_t *ppos) | 1056 | vivi_read(struct file *file, char __user *data, size_t count, loff_t *ppos) |
1097 | { | 1057 | { |
1098 | struct vivi_fh *fh = file->private_data; | 1058 | struct vivi_fh *fh = file->private_data; |
1059 | struct vivi_dev *dev = fh->dev; | ||
1060 | struct videobuf_queue *q = &fh->vb_vidq; | ||
1099 | 1061 | ||
1100 | if (fh->type==V4L2_BUF_TYPE_VIDEO_CAPTURE) { | 1062 | if (fh->type==V4L2_BUF_TYPE_VIDEO_CAPTURE) { |
1101 | if (res_locked(fh->dev)) | ||
1102 | return -EBUSY; | ||
1103 | return videobuf_read_stream(&fh->vb_vidq, data, count, ppos, 0, | 1063 | return videobuf_read_stream(&fh->vb_vidq, data, count, ppos, 0, |
1104 | file->f_flags & O_NONBLOCK); | 1064 | file->f_flags & O_NONBLOCK); |
1105 | } | 1065 | } |