diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2007-10-10 04:37:43 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-10 12:35:29 -0400 |
commit | a991f44b79fa49b281eb078eed4a76a42101012a (patch) | |
tree | 5a6b7a4ce700ef8bcdf59f816c0c04b5e64d215b /drivers/media/video/vivi.c | |
parent | e77e2c2f2989eefff7e1c0fff9cb72afaedf6796 (diff) |
V4L/DVB (6316): Change list_for_each+list_entry to list_for_each_entry
The rest of V4L files.
There is one list_for_each+list_entry in cpia_pp.c that
wasn't changed because it expects the loop iterator to remain NULL if
the list is empty.
A bug in vivi is fixed; the 'safe' version needs to be used because the loop
deletes the list entries.
Simplify a second loop in vivi and get rid if an un-used variable in that loop.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/vivi.c')
-rw-r--r-- | drivers/media/video/vivi.c | 27 |
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) | |||
507 | static int restart_video_queue(struct vivi_dmaqueue *dma_q) | 507 | static 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, | |||
982 | static int vivi_open(struct inode *inode, struct file *file) | 979 | static 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; | 992 | found: |
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); |