Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 65938
b: refs/heads/master
c: ba32bd9
h: refs/heads/master
v: v3
  • Loading branch information
Brandon Philips authored and Mauro Carvalho Chehab committed Oct 10, 2007
1 parent 792cf62 commit b852a1d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 45 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 85c7c70bc241d506dffc1879158f77f8aac69734
refs/heads/master: ba32bd95d431525ad2ffac97cadf9ee40b63939e
48 changes: 4 additions & 44 deletions trunk/drivers/media/video/vivi.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ struct vivi_dev {
int users;

/* various device info */
unsigned int resources;
struct video_device vfd;

struct vivi_dmaqueue vidq;
Expand Down Expand Up @@ -726,40 +725,6 @@ static struct videobuf_queue_ops vivi_video_qops = {
.buf_release = buffer_release,
};

/* ------------------------------------------------------------------
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
------------------------------------------------------------------*/
Expand Down Expand Up @@ -913,9 +878,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)
Expand All @@ -928,10 +891,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)
Expand Down Expand Up @@ -1096,10 +1056,10 @@ 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;
return videobuf_read_stream(&fh->vb_vidq, data, count, ppos, 0,
file->f_flags & O_NONBLOCK);
}
Expand Down

0 comments on commit b852a1d

Please sign in to comment.