V4L/DVB (7121): Renames videobuf lock to vb_lock
This helps to identify where vb_lock is being used, and find missusages of the locks. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
parent
ce3a35d3c0
commit
64f9477f95
@ -2354,8 +2354,8 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv,
|
|||||||
BUG();
|
BUG();
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_lock(&fh->cap.lock);
|
mutex_lock(&fh->cap.vb_lock);
|
||||||
kfree(fh->ov.clips);
|
kfree(fh->ov.clips);
|
||||||
fh->ov.clips = clips;
|
fh->ov.clips = clips;
|
||||||
fh->ov.nclips = n;
|
fh->ov.nclips = n;
|
||||||
|
|
||||||
@ -2376,7 +2376,7 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv,
|
|||||||
bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new);
|
bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new);
|
||||||
retval = bttv_switch_overlay(btv,fh,new);
|
retval = bttv_switch_overlay(btv,fh,new);
|
||||||
}
|
}
|
||||||
mutex_unlock(&fh->cap.lock);
|
mutex_unlock(&fh->cap.vb_lock);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2576,7 +2576,7 @@ static int bttv_s_fmt_cap(struct file *file, void *priv,
|
|||||||
fmt = format_by_fourcc(f->fmt.pix.pixelformat);
|
fmt = format_by_fourcc(f->fmt.pix.pixelformat);
|
||||||
|
|
||||||
/* update our state informations */
|
/* update our state informations */
|
||||||
mutex_lock(&fh->cap.lock);
|
mutex_lock(&fh->cap.vb_lock);
|
||||||
fh->fmt = fmt;
|
fh->fmt = fmt;
|
||||||
fh->cap.field = f->fmt.pix.field;
|
fh->cap.field = f->fmt.pix.field;
|
||||||
fh->cap.last = V4L2_FIELD_NONE;
|
fh->cap.last = V4L2_FIELD_NONE;
|
||||||
@ -2585,7 +2585,7 @@ static int bttv_s_fmt_cap(struct file *file, void *priv,
|
|||||||
btv->init.fmt = fmt;
|
btv->init.fmt = fmt;
|
||||||
btv->init.width = f->fmt.pix.width;
|
btv->init.width = f->fmt.pix.width;
|
||||||
btv->init.height = f->fmt.pix.height;
|
btv->init.height = f->fmt.pix.height;
|
||||||
mutex_unlock(&fh->cap.lock);
|
mutex_unlock(&fh->cap.vb_lock);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2611,11 +2611,11 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf)
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
struct bttv_fh *fh = priv;
|
struct bttv_fh *fh = priv;
|
||||||
|
|
||||||
mutex_lock(&fh->cap.lock);
|
mutex_lock(&fh->cap.vb_lock);
|
||||||
retval = videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize,
|
retval = videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize,
|
||||||
V4L2_MEMORY_MMAP);
|
V4L2_MEMORY_MMAP);
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
mutex_unlock(&fh->cap.lock);
|
mutex_unlock(&fh->cap.vb_lock);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2627,7 +2627,7 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf)
|
|||||||
for (i = 0; i < gbuffers; i++)
|
for (i = 0; i < gbuffers; i++)
|
||||||
mbuf->offsets[i] = i * gbufsize;
|
mbuf->offsets[i] = i * gbufsize;
|
||||||
|
|
||||||
mutex_unlock(&fh->cap.lock);
|
mutex_unlock(&fh->cap.vb_lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -2756,7 +2756,7 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on)
|
|||||||
if (!check_alloc_btres(btv, fh, RESOURCE_OVERLAY))
|
if (!check_alloc_btres(btv, fh, RESOURCE_OVERLAY))
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
||||||
mutex_lock(&fh->cap.lock);
|
mutex_lock(&fh->cap.vb_lock);
|
||||||
if (on) {
|
if (on) {
|
||||||
fh->ov.tvnorm = btv->tvnorm;
|
fh->ov.tvnorm = btv->tvnorm;
|
||||||
new = videobuf_pci_alloc(sizeof(*new));
|
new = videobuf_pci_alloc(sizeof(*new));
|
||||||
@ -2767,7 +2767,7 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on)
|
|||||||
|
|
||||||
/* switch over */
|
/* switch over */
|
||||||
retval = bttv_switch_overlay(btv, fh, new);
|
retval = bttv_switch_overlay(btv, fh, new);
|
||||||
mutex_unlock(&fh->cap.lock);
|
mutex_unlock(&fh->cap.vb_lock);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2806,7 +2806,7 @@ static int bttv_s_fbuf(struct file *file, void *f,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ok, accept it */
|
/* ok, accept it */
|
||||||
mutex_lock(&fh->cap.lock);
|
mutex_lock(&fh->cap.vb_lock);
|
||||||
btv->fbuf.base = fb->base;
|
btv->fbuf.base = fb->base;
|
||||||
btv->fbuf.fmt.width = fb->fmt.width;
|
btv->fbuf.fmt.width = fb->fmt.width;
|
||||||
btv->fbuf.fmt.height = fb->fmt.height;
|
btv->fbuf.fmt.height = fb->fmt.height;
|
||||||
@ -2838,7 +2838,7 @@ static int bttv_s_fbuf(struct file *file, void *f,
|
|||||||
retval = bttv_switch_overlay(btv, fh, new);
|
retval = bttv_switch_overlay(btv, fh, new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mutex_unlock(&fh->cap.lock);
|
mutex_unlock(&fh->cap.vb_lock);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3090,7 +3090,7 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop)
|
|||||||
|
|
||||||
fh->do_crop = 1;
|
fh->do_crop = 1;
|
||||||
|
|
||||||
mutex_lock(&fh->cap.lock);
|
mutex_lock(&fh->cap.vb_lock);
|
||||||
|
|
||||||
if (fh->width < c.min_scaled_width) {
|
if (fh->width < c.min_scaled_width) {
|
||||||
fh->width = c.min_scaled_width;
|
fh->width = c.min_scaled_width;
|
||||||
@ -3108,7 +3108,7 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop)
|
|||||||
btv->init.height = c.max_scaled_height;
|
btv->init.height = c.max_scaled_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&fh->cap.lock);
|
mutex_unlock(&fh->cap.vb_lock);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -3177,30 +3177,25 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
|
|||||||
buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream);
|
buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream);
|
||||||
} else {
|
} else {
|
||||||
/* read() capture */
|
/* read() capture */
|
||||||
mutex_lock(&fh->cap.lock);
|
mutex_lock(&fh->cap.vb_lock);
|
||||||
if (NULL == fh->cap.read_buf) {
|
if (NULL == fh->cap.read_buf) {
|
||||||
/* need to capture a new frame */
|
/* need to capture a new frame */
|
||||||
if (locked_btres(fh->btv,RESOURCE_VIDEO_STREAM)) {
|
if (locked_btres(fh->btv,RESOURCE_VIDEO_STREAM))
|
||||||
mutex_unlock(&fh->cap.lock);
|
goto err;
|
||||||
return POLLERR;
|
|
||||||
}
|
|
||||||
fh->cap.read_buf = videobuf_pci_alloc(fh->cap.msize);
|
fh->cap.read_buf = videobuf_pci_alloc(fh->cap.msize);
|
||||||
if (NULL == fh->cap.read_buf) {
|
if (NULL == fh->cap.read_buf)
|
||||||
mutex_unlock(&fh->cap.lock);
|
goto err;
|
||||||
return POLLERR;
|
|
||||||
}
|
|
||||||
fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR;
|
fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR;
|
||||||
field = videobuf_next_field(&fh->cap);
|
field = videobuf_next_field(&fh->cap);
|
||||||
if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,field)) {
|
if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,field)) {
|
||||||
kfree (fh->cap.read_buf);
|
kfree (fh->cap.read_buf);
|
||||||
fh->cap.read_buf = NULL;
|
fh->cap.read_buf = NULL;
|
||||||
mutex_unlock(&fh->cap.lock);
|
goto err;
|
||||||
return POLLERR;
|
|
||||||
}
|
}
|
||||||
fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf);
|
fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf);
|
||||||
fh->cap.read_off = 0;
|
fh->cap.read_off = 0;
|
||||||
}
|
}
|
||||||
mutex_unlock(&fh->cap.lock);
|
mutex_unlock(&fh->cap.vb_lock);
|
||||||
buf = (struct bttv_buffer*)fh->cap.read_buf;
|
buf = (struct bttv_buffer*)fh->cap.read_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3209,6 +3204,9 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
|
|||||||
buf->vb.state == VIDEOBUF_ERROR)
|
buf->vb.state == VIDEOBUF_ERROR)
|
||||||
return POLLIN|POLLRDNORM;
|
return POLLIN|POLLRDNORM;
|
||||||
return 0;
|
return 0;
|
||||||
|
err:
|
||||||
|
mutex_unlock(&fh->cap.vb_lock);
|
||||||
|
return POLLERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bttv_open(struct inode *inode, struct file *file)
|
static int bttv_open(struct inode *inode, struct file *file)
|
||||||
|
@ -352,13 +352,13 @@ int bttv_s_fmt_vbi(struct file *file, void *f, struct v4l2_format *frt)
|
|||||||
because vbi_fmt.end counts field lines times two. */
|
because vbi_fmt.end counts field lines times two. */
|
||||||
end = max(frt->fmt.vbi.start[0], start1) * 2 + 2;
|
end = max(frt->fmt.vbi.start[0], start1) * 2 + 2;
|
||||||
|
|
||||||
mutex_lock(&fh->vbi.lock);
|
mutex_lock(&fh->vbi.vb_lock);
|
||||||
|
|
||||||
fh->vbi_fmt.fmt = frt->fmt.vbi;
|
fh->vbi_fmt.fmt = frt->fmt.vbi;
|
||||||
fh->vbi_fmt.tvnorm = tvnorm;
|
fh->vbi_fmt.tvnorm = tvnorm;
|
||||||
fh->vbi_fmt.end = end;
|
fh->vbi_fmt.end = end;
|
||||||
|
|
||||||
mutex_unlock(&fh->vbi.lock);
|
mutex_unlock(&fh->vbi.vb_lock);
|
||||||
|
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ static int ts_open(struct inode *inode, struct file *file)
|
|||||||
|
|
||||||
dprintk("open minor=%d\n",minor);
|
dprintk("open minor=%d\n",minor);
|
||||||
err = -EBUSY;
|
err = -EBUSY;
|
||||||
if (!mutex_trylock(&dev->empress_tsq.lock))
|
if (!mutex_trylock(&dev->empress_tsq.vb_lock))
|
||||||
goto done;
|
goto done;
|
||||||
if (dev->empress_users)
|
if (dev->empress_users)
|
||||||
goto done_up;
|
goto done_up;
|
||||||
@ -101,7 +101,7 @@ static int ts_open(struct inode *inode, struct file *file)
|
|||||||
err = 0;
|
err = 0;
|
||||||
|
|
||||||
done_up:
|
done_up:
|
||||||
mutex_unlock(&dev->empress_tsq.lock);
|
mutex_unlock(&dev->empress_tsq.vb_lock);
|
||||||
done:
|
done:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -110,7 +110,7 @@ static int ts_release(struct inode *inode, struct file *file)
|
|||||||
{
|
{
|
||||||
struct saa7134_dev *dev = file->private_data;
|
struct saa7134_dev *dev = file->private_data;
|
||||||
|
|
||||||
mutex_lock(&dev->empress_tsq.lock);
|
mutex_lock(&dev->empress_tsq.vb_lock);
|
||||||
videobuf_stop(&dev->empress_tsq);
|
videobuf_stop(&dev->empress_tsq);
|
||||||
videobuf_mmap_free(&dev->empress_tsq);
|
videobuf_mmap_free(&dev->empress_tsq);
|
||||||
dev->empress_users--;
|
dev->empress_users--;
|
||||||
@ -122,7 +122,7 @@ static int ts_release(struct inode *inode, struct file *file)
|
|||||||
saa_writeb(SAA7134_AUDIO_MUTE_CTRL,
|
saa_writeb(SAA7134_AUDIO_MUTE_CTRL,
|
||||||
saa_readb(SAA7134_AUDIO_MUTE_CTRL) | (1 << 6));
|
saa_readb(SAA7134_AUDIO_MUTE_CTRL) | (1 << 6));
|
||||||
|
|
||||||
mutex_unlock(&dev->empress_tsq.lock);
|
mutex_unlock(&dev->empress_tsq.vb_lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1414,21 +1414,17 @@ video_poll(struct file *file, struct poll_table_struct *wait)
|
|||||||
if (!list_empty(&fh->cap.stream))
|
if (!list_empty(&fh->cap.stream))
|
||||||
buf = list_entry(fh->cap.stream.next, struct videobuf_buffer, stream);
|
buf = list_entry(fh->cap.stream.next, struct videobuf_buffer, stream);
|
||||||
} else {
|
} else {
|
||||||
mutex_lock(&fh->cap.lock);
|
mutex_lock(&fh->cap.vb_lock);
|
||||||
if (UNSET == fh->cap.read_off) {
|
if (UNSET == fh->cap.read_off) {
|
||||||
/* need to capture a new frame */
|
/* need to capture a new frame */
|
||||||
if (res_locked(fh->dev,RESOURCE_VIDEO)) {
|
if (res_locked(fh->dev,RESOURCE_VIDEO))
|
||||||
mutex_unlock(&fh->cap.lock);
|
goto err;
|
||||||
return POLLERR;
|
if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field))
|
||||||
}
|
goto err;
|
||||||
if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field)) {
|
|
||||||
mutex_unlock(&fh->cap.lock);
|
|
||||||
return POLLERR;
|
|
||||||
}
|
|
||||||
fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf);
|
fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf);
|
||||||
fh->cap.read_off = 0;
|
fh->cap.read_off = 0;
|
||||||
}
|
}
|
||||||
mutex_unlock(&fh->cap.lock);
|
mutex_unlock(&fh->cap.vb_lock);
|
||||||
buf = fh->cap.read_buf;
|
buf = fh->cap.read_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1440,6 +1436,10 @@ video_poll(struct file *file, struct poll_table_struct *wait)
|
|||||||
buf->state == VIDEOBUF_ERROR)
|
buf->state == VIDEOBUF_ERROR)
|
||||||
return POLLIN|POLLRDNORM;
|
return POLLIN|POLLRDNORM;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err:
|
||||||
|
mutex_unlock(&fh->cap.vb_lock);
|
||||||
|
return POLLERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int video_release(struct inode *inode, struct file *file)
|
static int video_release(struct inode *inode, struct file *file)
|
||||||
|
@ -147,7 +147,7 @@ void videobuf_queue_core_init(struct videobuf_queue *q,
|
|||||||
/* Having implementations for abstract methods are mandatory */
|
/* Having implementations for abstract methods are mandatory */
|
||||||
BUG_ON(!q->int_ops);
|
BUG_ON(!q->int_ops);
|
||||||
|
|
||||||
mutex_init(&q->lock);
|
mutex_init(&q->vb_lock);
|
||||||
INIT_LIST_HEAD(&q->stream);
|
INIT_LIST_HEAD(&q->stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ int videobuf_queue_is_busy(struct videobuf_queue *q)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Locking: Caller holds q->lock */
|
/* Locking: Caller holds q->vb_lock */
|
||||||
void videobuf_queue_cancel(struct videobuf_queue *q)
|
void videobuf_queue_cancel(struct videobuf_queue *q)
|
||||||
{
|
{
|
||||||
unsigned long flags = 0;
|
unsigned long flags = 0;
|
||||||
@ -220,7 +220,7 @@ void videobuf_queue_cancel(struct videobuf_queue *q)
|
|||||||
|
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* Locking: Caller holds q->lock */
|
/* Locking: Caller holds q->vb_lock */
|
||||||
enum v4l2_field videobuf_next_field(struct videobuf_queue *q)
|
enum v4l2_field videobuf_next_field(struct videobuf_queue *q)
|
||||||
{
|
{
|
||||||
enum v4l2_field field = q->field;
|
enum v4l2_field field = q->field;
|
||||||
@ -239,7 +239,7 @@ enum v4l2_field videobuf_next_field(struct videobuf_queue *q)
|
|||||||
return field;
|
return field;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Locking: Caller holds q->lock */
|
/* Locking: Caller holds q->vb_lock */
|
||||||
static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b,
|
static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b,
|
||||||
struct videobuf_buffer *vb, enum v4l2_buf_type type)
|
struct videobuf_buffer *vb, enum v4l2_buf_type type)
|
||||||
{
|
{
|
||||||
@ -295,7 +295,7 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b,
|
|||||||
b->sequence = vb->field_count >> 1;
|
b->sequence = vb->field_count >> 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Locking: Caller holds q->lock */
|
/* Locking: Caller holds q->vb_lock */
|
||||||
static int __videobuf_mmap_free(struct videobuf_queue *q)
|
static int __videobuf_mmap_free(struct videobuf_queue *q)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -328,13 +328,13 @@ static int __videobuf_mmap_free(struct videobuf_queue *q)
|
|||||||
int videobuf_mmap_free(struct videobuf_queue *q)
|
int videobuf_mmap_free(struct videobuf_queue *q)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
mutex_lock(&q->lock);
|
mutex_lock(&q->vb_lock);
|
||||||
ret = __videobuf_mmap_free(q);
|
ret = __videobuf_mmap_free(q);
|
||||||
mutex_unlock(&q->lock);
|
mutex_unlock(&q->vb_lock);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Locking: Caller holds q->lock */
|
/* Locking: Caller holds q->vb_lock */
|
||||||
static int __videobuf_mmap_setup(struct videobuf_queue *q,
|
static int __videobuf_mmap_setup(struct videobuf_queue *q,
|
||||||
unsigned int bcount, unsigned int bsize,
|
unsigned int bcount, unsigned int bsize,
|
||||||
enum v4l2_memory memory)
|
enum v4l2_memory memory)
|
||||||
@ -384,9 +384,9 @@ int videobuf_mmap_setup(struct videobuf_queue *q,
|
|||||||
enum v4l2_memory memory)
|
enum v4l2_memory memory)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
mutex_lock(&q->lock);
|
mutex_lock(&q->vb_lock);
|
||||||
ret = __videobuf_mmap_setup(q, bcount, bsize, memory);
|
ret = __videobuf_mmap_setup(q, bcount, bsize, memory);
|
||||||
mutex_unlock(&q->lock);
|
mutex_unlock(&q->vb_lock);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,7 +408,7 @@ int videobuf_reqbufs(struct videobuf_queue *q,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_lock(&q->lock);
|
mutex_lock(&q->vb_lock);
|
||||||
if (req->type != q->type) {
|
if (req->type != q->type) {
|
||||||
dprintk(1, "reqbufs: queue type invalid\n");
|
dprintk(1, "reqbufs: queue type invalid\n");
|
||||||
retval = -EINVAL;
|
retval = -EINVAL;
|
||||||
@ -444,7 +444,7 @@ int videobuf_reqbufs(struct videobuf_queue *q,
|
|||||||
req->count = retval;
|
req->count = retval;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
mutex_unlock(&q->lock);
|
mutex_unlock(&q->vb_lock);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,7 +452,7 @@ int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b)
|
|||||||
{
|
{
|
||||||
int ret = -EINVAL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
mutex_lock(&q->lock);
|
mutex_lock(&q->vb_lock);
|
||||||
if (unlikely(b->type != q->type)) {
|
if (unlikely(b->type != q->type)) {
|
||||||
dprintk(1, "querybuf: Wrong type.\n");
|
dprintk(1, "querybuf: Wrong type.\n");
|
||||||
goto done;
|
goto done;
|
||||||
@ -470,7 +470,7 @@ int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b)
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
done:
|
done:
|
||||||
mutex_unlock(&q->lock);
|
mutex_unlock(&q->vb_lock);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,7 +487,7 @@ int videobuf_qbuf(struct videobuf_queue *q,
|
|||||||
if (b->memory == V4L2_MEMORY_MMAP)
|
if (b->memory == V4L2_MEMORY_MMAP)
|
||||||
down_read(¤t->mm->mmap_sem);
|
down_read(¤t->mm->mmap_sem);
|
||||||
|
|
||||||
mutex_lock(&q->lock);
|
mutex_lock(&q->vb_lock);
|
||||||
retval = -EBUSY;
|
retval = -EBUSY;
|
||||||
if (q->reading) {
|
if (q->reading) {
|
||||||
dprintk(1, "qbuf: Reading running...\n");
|
dprintk(1, "qbuf: Reading running...\n");
|
||||||
@ -573,7 +573,7 @@ int videobuf_qbuf(struct videobuf_queue *q,
|
|||||||
retval = 0;
|
retval = 0;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
mutex_unlock(&q->lock);
|
mutex_unlock(&q->vb_lock);
|
||||||
|
|
||||||
if (b->memory == V4L2_MEMORY_MMAP)
|
if (b->memory == V4L2_MEMORY_MMAP)
|
||||||
up_read(¤t->mm->mmap_sem);
|
up_read(¤t->mm->mmap_sem);
|
||||||
@ -589,7 +589,7 @@ int videobuf_dqbuf(struct videobuf_queue *q,
|
|||||||
|
|
||||||
MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS);
|
MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS);
|
||||||
|
|
||||||
mutex_lock(&q->lock);
|
mutex_lock(&q->vb_lock);
|
||||||
retval = -EBUSY;
|
retval = -EBUSY;
|
||||||
if (q->reading) {
|
if (q->reading) {
|
||||||
dprintk(1, "dqbuf: Reading running...\n");
|
dprintk(1, "dqbuf: Reading running...\n");
|
||||||
@ -632,7 +632,7 @@ int videobuf_dqbuf(struct videobuf_queue *q,
|
|||||||
videobuf_status(q, b, buf, q->type);
|
videobuf_status(q, b, buf, q->type);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
mutex_unlock(&q->lock);
|
mutex_unlock(&q->vb_lock);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -642,7 +642,7 @@ int videobuf_streamon(struct videobuf_queue *q)
|
|||||||
unsigned long flags = 0;
|
unsigned long flags = 0;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
mutex_lock(&q->lock);
|
mutex_lock(&q->vb_lock);
|
||||||
retval = -EBUSY;
|
retval = -EBUSY;
|
||||||
if (q->reading)
|
if (q->reading)
|
||||||
goto done;
|
goto done;
|
||||||
@ -659,11 +659,11 @@ int videobuf_streamon(struct videobuf_queue *q)
|
|||||||
spin_unlock_irqrestore(q->irqlock, flags);
|
spin_unlock_irqrestore(q->irqlock, flags);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
mutex_unlock(&q->lock);
|
mutex_unlock(&q->vb_lock);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Locking: Caller holds q->lock */
|
/* Locking: Caller holds q->vb_lock */
|
||||||
static int __videobuf_streamoff(struct videobuf_queue *q)
|
static int __videobuf_streamoff(struct videobuf_queue *q)
|
||||||
{
|
{
|
||||||
if (!q->streaming)
|
if (!q->streaming)
|
||||||
@ -679,14 +679,14 @@ int videobuf_streamoff(struct videobuf_queue *q)
|
|||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
mutex_lock(&q->lock);
|
mutex_lock(&q->vb_lock);
|
||||||
retval = __videobuf_streamoff(q);
|
retval = __videobuf_streamoff(q);
|
||||||
mutex_unlock(&q->lock);
|
mutex_unlock(&q->vb_lock);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Locking: Caller holds q->lock */
|
/* Locking: Caller holds q->vb_lock */
|
||||||
static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q,
|
static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q,
|
||||||
char __user *data,
|
char __user *data,
|
||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
@ -745,7 +745,7 @@ ssize_t videobuf_read_one(struct videobuf_queue *q,
|
|||||||
|
|
||||||
MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS);
|
MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS);
|
||||||
|
|
||||||
mutex_lock(&q->lock);
|
mutex_lock(&q->vb_lock);
|
||||||
|
|
||||||
nbufs = 1; size = 0;
|
nbufs = 1; size = 0;
|
||||||
q->ops->buf_setup(q, &nbufs, &size);
|
q->ops->buf_setup(q, &nbufs, &size);
|
||||||
@ -817,11 +817,11 @@ ssize_t videobuf_read_one(struct videobuf_queue *q,
|
|||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
mutex_unlock(&q->lock);
|
mutex_unlock(&q->vb_lock);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Locking: Caller holds q->lock */
|
/* Locking: Caller holds q->vb_lock */
|
||||||
static int __videobuf_read_start(struct videobuf_queue *q)
|
static int __videobuf_read_start(struct videobuf_queue *q)
|
||||||
{
|
{
|
||||||
enum v4l2_field field;
|
enum v4l2_field field;
|
||||||
@ -882,23 +882,23 @@ int videobuf_read_start(struct videobuf_queue *q)
|
|||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
mutex_lock(&q->lock);
|
mutex_lock(&q->vb_lock);
|
||||||
rc = __videobuf_read_start(q);
|
rc = __videobuf_read_start(q);
|
||||||
mutex_unlock(&q->lock);
|
mutex_unlock(&q->vb_lock);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void videobuf_read_stop(struct videobuf_queue *q)
|
void videobuf_read_stop(struct videobuf_queue *q)
|
||||||
{
|
{
|
||||||
mutex_lock(&q->lock);
|
mutex_lock(&q->vb_lock);
|
||||||
__videobuf_read_stop(q);
|
__videobuf_read_stop(q);
|
||||||
mutex_unlock(&q->lock);
|
mutex_unlock(&q->vb_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void videobuf_stop(struct videobuf_queue *q)
|
void videobuf_stop(struct videobuf_queue *q)
|
||||||
{
|
{
|
||||||
mutex_lock(&q->lock);
|
mutex_lock(&q->vb_lock);
|
||||||
|
|
||||||
if (q->streaming)
|
if (q->streaming)
|
||||||
__videobuf_streamoff(q);
|
__videobuf_streamoff(q);
|
||||||
@ -906,7 +906,7 @@ void videobuf_stop(struct videobuf_queue *q)
|
|||||||
if (q->reading)
|
if (q->reading)
|
||||||
__videobuf_read_stop(q);
|
__videobuf_read_stop(q);
|
||||||
|
|
||||||
mutex_unlock(&q->lock);
|
mutex_unlock(&q->vb_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -920,7 +920,7 @@ ssize_t videobuf_read_stream(struct videobuf_queue *q,
|
|||||||
MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS);
|
MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS);
|
||||||
|
|
||||||
dprintk(2, "%s\n", __FUNCTION__);
|
dprintk(2, "%s\n", __FUNCTION__);
|
||||||
mutex_lock(&q->lock);
|
mutex_lock(&q->vb_lock);
|
||||||
retval = -EBUSY;
|
retval = -EBUSY;
|
||||||
if (q->streaming)
|
if (q->streaming)
|
||||||
goto done;
|
goto done;
|
||||||
@ -980,7 +980,7 @@ ssize_t videobuf_read_stream(struct videobuf_queue *q,
|
|||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
mutex_unlock(&q->lock);
|
mutex_unlock(&q->vb_lock);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -991,7 +991,7 @@ unsigned int videobuf_poll_stream(struct file *file,
|
|||||||
struct videobuf_buffer *buf = NULL;
|
struct videobuf_buffer *buf = NULL;
|
||||||
unsigned int rc = 0;
|
unsigned int rc = 0;
|
||||||
|
|
||||||
mutex_lock(&q->lock);
|
mutex_lock(&q->vb_lock);
|
||||||
if (q->streaming) {
|
if (q->streaming) {
|
||||||
if (!list_empty(&q->stream))
|
if (!list_empty(&q->stream))
|
||||||
buf = list_entry(q->stream.next,
|
buf = list_entry(q->stream.next,
|
||||||
@ -1019,7 +1019,7 @@ unsigned int videobuf_poll_stream(struct file *file,
|
|||||||
buf->state == VIDEOBUF_ERROR)
|
buf->state == VIDEOBUF_ERROR)
|
||||||
rc = POLLIN|POLLRDNORM;
|
rc = POLLIN|POLLRDNORM;
|
||||||
}
|
}
|
||||||
mutex_unlock(&q->lock);
|
mutex_unlock(&q->vb_lock);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1030,10 +1030,10 @@ int videobuf_mmap_mapper(struct videobuf_queue *q,
|
|||||||
|
|
||||||
MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS);
|
MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS);
|
||||||
|
|
||||||
mutex_lock(&q->lock);
|
mutex_lock(&q->vb_lock);
|
||||||
retval = CALL(q, mmap_mapper, q, vma);
|
retval = CALL(q, mmap_mapper, q, vma);
|
||||||
q->is_mmapped = 1;
|
q->is_mmapped = 1;
|
||||||
mutex_unlock(&q->lock);
|
mutex_unlock(&q->vb_lock);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -356,7 +356,7 @@ videobuf_vm_close(struct vm_area_struct *vma)
|
|||||||
map->count--;
|
map->count--;
|
||||||
if (0 == map->count) {
|
if (0 == map->count) {
|
||||||
dprintk(1,"munmap %p q=%p\n",map,q);
|
dprintk(1,"munmap %p q=%p\n",map,q);
|
||||||
mutex_lock(&q->lock);
|
mutex_lock(&q->vb_lock);
|
||||||
for (i = 0; i < VIDEO_MAX_FRAME; i++) {
|
for (i = 0; i < VIDEO_MAX_FRAME; i++) {
|
||||||
if (NULL == q->bufs[i])
|
if (NULL == q->bufs[i])
|
||||||
continue;
|
continue;
|
||||||
@ -373,7 +373,7 @@ videobuf_vm_close(struct vm_area_struct *vma)
|
|||||||
q->bufs[i]->baddr = 0;
|
q->bufs[i]->baddr = 0;
|
||||||
q->ops->buf_release(q,q->bufs[i]);
|
q->ops->buf_release(q,q->bufs[i]);
|
||||||
}
|
}
|
||||||
mutex_unlock(&q->lock);
|
mutex_unlock(&q->vb_lock);
|
||||||
kfree(map);
|
kfree(map);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -70,7 +70,7 @@ videobuf_vm_close(struct vm_area_struct *vma)
|
|||||||
map->count--;
|
map->count--;
|
||||||
if (0 == map->count) {
|
if (0 == map->count) {
|
||||||
dprintk(1,"munmap %p q=%p\n",map,q);
|
dprintk(1,"munmap %p q=%p\n",map,q);
|
||||||
mutex_lock(&q->lock);
|
mutex_lock(&q->vb_lock);
|
||||||
for (i = 0; i < VIDEO_MAX_FRAME; i++) {
|
for (i = 0; i < VIDEO_MAX_FRAME; i++) {
|
||||||
if (NULL == q->bufs[i])
|
if (NULL == q->bufs[i])
|
||||||
continue;
|
continue;
|
||||||
@ -83,7 +83,7 @@ videobuf_vm_close(struct vm_area_struct *vma)
|
|||||||
q->bufs[i]->map = NULL;
|
q->bufs[i]->map = NULL;
|
||||||
q->bufs[i]->baddr = 0;
|
q->bufs[i]->baddr = 0;
|
||||||
}
|
}
|
||||||
mutex_unlock(&q->lock);
|
mutex_unlock(&q->vb_lock);
|
||||||
kfree(map);
|
kfree(map);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -149,7 +149,7 @@ struct videobuf_qtype_ops {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct videobuf_queue {
|
struct videobuf_queue {
|
||||||
struct mutex lock;
|
struct mutex vb_lock;
|
||||||
spinlock_t *irqlock;
|
spinlock_t *irqlock;
|
||||||
void *dev; /* on pci, points to struct pci_dev */
|
void *dev; /* on pci, points to struct pci_dev */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user