summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/vivi.c
diff options
context:
space:
mode:
authorbphilips@suse.de <bphilips@suse.de>2007-09-27 20:55:17 -0300
committerbphilips@suse.de <bphilips@suse.de>2007-09-27 20:55:17 -0300
commitda0912de231d237e19473b5947af4df2463e385a (patch)
treecf284de69ac48dfe5f1106b2151221016d276ef4 /linux/drivers/media/video/vivi.c
parentc672dfca45192151e3acb5ffae1c5fd8fec3f95b (diff)
downloadmediapointer-dvb-s2-da0912de231d237e19473b5947af4df2463e385a.tar.gz
mediapointer-dvb-s2-da0912de231d237e19473b5947af4df2463e385a.tar.bz2
V4L: vivi.c remove the "resource" locking
The "resource" locking in vivi isn't needed since streamon/streamoff/read_stream do mutual exclusion using q->reading/q->streaming. Plus it is sort of broken: a) res_locked() use in vivi_read() is racey. b) res_free() calls mutex_lock twice causing streamoff to break Signed-off-by: Brandon Philips <bphilips@suse.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/vivi.c')
-rw-r--r--linux/drivers/media/video/vivi.c53
1 files changed, 4 insertions, 49 deletions
diff --git a/linux/drivers/media/video/vivi.c b/linux/drivers/media/video/vivi.c
index 1a9a2b6b6..d8779be84 100644
--- a/linux/drivers/media/video/vivi.c
+++ b/linux/drivers/media/video/vivi.c
@@ -187,7 +187,6 @@ struct vivi_dev {
int users;
/* various device info */
- unsigned int resources;
struct video_device vfd;
struct vivi_dmaqueue vidq;
@@ -819,40 +818,6 @@ static struct videobuf_queue_ops vivi_video_qops = {
};
/* ------------------------------------------------------------------
- IOCTL handling
- ------------------------------------------------------------------*/
-
-
-static int res_get(struct vivi_dev *dev, struct vivi_fh *fh)
-{
- /* is it free? */
- mutex_lock(&dev->lock);
- if (dev->resources) {
- /* no, someone else uses it */
- mutex_unlock(&dev->lock);
- return 0;
- }
- /* it's free, grab it */
- dev->resources =1;
- dprintk(1,"res: get\n");
- mutex_unlock(&dev->lock);
- return 1;
-}
-
-static int res_locked(struct vivi_dev *dev)
-{
- return (dev->resources);
-}
-
-static void res_free(struct vivi_dev *dev, struct vivi_fh *fh)
-{
- mutex_lock(&dev->lock);
- dev->resources = 0;
- dprintk(1,"res: put\n");
- mutex_lock(&dev->lock);
-}
-
-/* ------------------------------------------------------------------
IOCTL vidioc handling
------------------------------------------------------------------*/
static int vidioc_querycap (struct file *file, void *priv,
@@ -1005,9 +970,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
if (i != fh->type)
return -EINVAL;
- if (!res_get(dev,fh))
- return -EBUSY;
- return (videobuf_streamon(&fh->vb_vidq));
+ return videobuf_streamon(&fh->vb_vidq);
}
static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
@@ -1020,10 +983,7 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
if (i != fh->type)
return -EINVAL;
- videobuf_streamoff(&fh->vb_vidq);
- res_free(dev,fh);
-
- return (0);
+ return videobuf_streamoff(&fh->vb_vidq);
}
static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *i)
@@ -1194,17 +1154,12 @@ static ssize_t
vivi_read(struct file *file, char __user *data, size_t count, loff_t *ppos)
{
struct vivi_fh *fh = file->private_data;
+ struct vivi_dev *dev = fh->dev;
+ struct videobuf_queue *q = &fh->vb_vidq;
if (fh->type==V4L2_BUF_TYPE_VIDEO_CAPTURE) {
- if (res_locked(fh->dev))
- return -EBUSY;
-#if 0
- return videobuf_read_one(&fh->vb_vidq, data, count, ppos,
- file->f_flags & O_NONBLOCK);
-#else
return videobuf_read_stream(&fh->vb_vidq, data, count, ppos, 0,
file->f_flags & O_NONBLOCK);
-#endif
}
return 0;
}