aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/vivi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/vivi.c')
-rw-r--r--drivers/media/video/vivi.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index 61a6608d6e61..b532aa280a1b 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -507,7 +507,6 @@ static void vivi_stop_thread(struct vivi_dmaqueue *dma_q)
507static int restart_video_queue(struct vivi_dmaqueue *dma_q) 507static int restart_video_queue(struct vivi_dmaqueue *dma_q)
508{ 508{
509 struct vivi_buffer *buf, *prev; 509 struct vivi_buffer *buf, *prev;
510 struct list_head *item;
511 510
512 dprintk(1,"%s dma_q=0x%08lx\n",__FUNCTION__,(unsigned long)dma_q); 511 dprintk(1,"%s dma_q=0x%08lx\n",__FUNCTION__,(unsigned long)dma_q);
513 512
@@ -521,9 +520,7 @@ static int restart_video_queue(struct vivi_dmaqueue *dma_q)
521// vivi_start_thread(dma_q); 520// vivi_start_thread(dma_q);
522 521
523 /* cancel all outstanding capture / vbi requests */ 522 /* cancel all outstanding capture / vbi requests */
524 list_for_each(item,&dma_q->active) { 523 list_for_each_entry_safe(buf, prev, &dma_q->active, vb.queue) {
525 buf = list_entry(item, struct vivi_buffer, vb.queue);
526
527 list_del(&buf->vb.queue); 524 list_del(&buf->vb.queue);
528 buf->vb.state = STATE_ERROR; 525 buf->vb.state = STATE_ERROR;
529 wake_up(&buf->vb.done); 526 wake_up(&buf->vb.done);
@@ -982,31 +979,25 @@ static int vidioc_s_ctrl (struct file *file, void *priv,
982static int vivi_open(struct inode *inode, struct file *file) 979static int vivi_open(struct inode *inode, struct file *file)
983{ 980{
984 int minor = iminor(inode); 981 int minor = iminor(inode);
985 struct vivi_dev *h,*dev = NULL; 982 struct vivi_dev *dev;
986 struct vivi_fh *fh; 983 struct vivi_fh *fh;
987 struct list_head *list;
988 enum v4l2_buf_type type = 0;
989 int i; 984 int i;
990 985
991 printk(KERN_DEBUG "vivi: open called (minor=%d)\n",minor); 986 printk(KERN_DEBUG "vivi: open called (minor=%d)\n",minor);
992 987
993 list_for_each(list,&vivi_devlist) { 988 list_for_each_entry(dev, &vivi_devlist, vivi_devlist)
994 h = list_entry(list, struct vivi_dev, vivi_devlist); 989 if (dev->vfd.minor == minor)
995 if (h->vfd.minor == minor) { 990 goto found;
996 dev = h; 991 return -ENODEV;
997 type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 992found:
998 }
999 }
1000 if (NULL == dev)
1001 return -ENODEV;
1002 993
1003 994
1004 995
1005 /* If more than one user, mutex should be added */ 996 /* If more than one user, mutex should be added */
1006 dev->users++; 997 dev->users++;
1007 998
1008 dprintk(1,"open minor=%d type=%s users=%d\n", 999 dprintk(1, "open minor=%d type=%s users=%d\n", minor,
1009 minor,v4l2_type_names[type],dev->users); 1000 v4l2_type_names[V4L2_BUF_TYPE_VIDEO_CAPTURE], dev->users);
1010 1001
1011 /* allocate + initialize per filehandle data */ 1002 /* allocate + initialize per filehandle data */
1012 fh = kzalloc(sizeof(*fh),GFP_KERNEL); 1003 fh = kzalloc(sizeof(*fh),GFP_KERNEL);