aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2007-10-10 04:37:43 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-10 12:35:29 -0400
commita991f44b79fa49b281eb078eed4a76a42101012a (patch)
tree5a6b7a4ce700ef8bcdf59f816c0c04b5e64d215b
parente77e2c2f2989eefff7e1c0fff9cb72afaedf6796 (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>
-rw-r--r--drivers/media/video/bt8xx/bttv-gpio.c6
-rw-r--r--drivers/media/video/cx23885/cx23885-core.c5
-rw-r--r--drivers/media/video/dpc7146.c5
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c4
-rw-r--r--drivers/media/video/mxb.c4
-rw-r--r--drivers/media/video/tvmixer.c5
-rw-r--r--drivers/media/video/v4l2-int-device.c14
-rw-r--r--drivers/media/video/videobuf-core.c5
-rw-r--r--drivers/media/video/vivi.c27
9 files changed, 20 insertions, 55 deletions
diff --git a/drivers/media/video/bt8xx/bttv-gpio.c b/drivers/media/video/bt8xx/bttv-gpio.c
index 84154c26f9c5..dce6dae5740e 100644
--- a/drivers/media/video/bt8xx/bttv-gpio.c
+++ b/drivers/media/video/bt8xx/bttv-gpio.c
@@ -106,11 +106,9 @@ int bttv_sub_add_device(struct bttv_core *core, char *name)
106 106
107int bttv_sub_del_devices(struct bttv_core *core) 107int bttv_sub_del_devices(struct bttv_core *core)
108{ 108{
109 struct bttv_sub_device *sub; 109 struct bttv_sub_device *sub, *save;
110 struct list_head *item,*save;
111 110
112 list_for_each_safe(item,save,&core->subs) { 111 list_for_each_entry_safe(sub, save, &core->subs, list) {
113 sub = list_entry(item,struct bttv_sub_device,list);
114 list_del(&sub->list); 112 list_del(&sub->list);
115 device_unregister(&sub->dev); 113 device_unregister(&sub->dev);
116 } 114 }
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c
index 4d0614093ad6..af16505bd2e0 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -1100,7 +1100,6 @@ static int cx23885_restart_queue(struct cx23885_tsport *port,
1100{ 1100{
1101 struct cx23885_dev *dev = port->dev; 1101 struct cx23885_dev *dev = port->dev;
1102 struct cx23885_buffer *buf; 1102 struct cx23885_buffer *buf;
1103 struct list_head *item;
1104 1103
1105 dprintk(5, "%s()\n", __FUNCTION__); 1104 dprintk(5, "%s()\n", __FUNCTION__);
1106 if (list_empty(&q->active)) 1105 if (list_empty(&q->active))
@@ -1148,10 +1147,8 @@ static int cx23885_restart_queue(struct cx23885_tsport *port,
1148 dprintk(2, "restart_queue [%p/%d]: restart dma\n", 1147 dprintk(2, "restart_queue [%p/%d]: restart dma\n",
1149 buf, buf->vb.i); 1148 buf, buf->vb.i);
1150 cx23885_start_dma(port, q, buf); 1149 cx23885_start_dma(port, q, buf);
1151 list_for_each(item, &q->active) { 1150 list_for_each_entry(buf, &q->active, vb.queue)
1152 buf = list_entry(item, struct cx23885_buffer, vb.queue);
1153 buf->count = q->count++; 1151 buf->count = q->count++;
1154 }
1155 mod_timer(&q->timeout, jiffies + BUFFER_TIMEOUT); 1152 mod_timer(&q->timeout, jiffies + BUFFER_TIMEOUT);
1156 return 0; 1153 return 0;
1157} 1154}
diff --git a/drivers/media/video/dpc7146.c b/drivers/media/video/dpc7146.c
index 0fcc935828f8..255dae303708 100644
--- a/drivers/media/video/dpc7146.c
+++ b/drivers/media/video/dpc7146.c
@@ -92,7 +92,6 @@ static int dpc_probe(struct saa7146_dev* dev)
92{ 92{
93 struct dpc* dpc = NULL; 93 struct dpc* dpc = NULL;
94 struct i2c_client *client; 94 struct i2c_client *client;
95 struct list_head *item;
96 95
97 dpc = kzalloc(sizeof(struct dpc), GFP_KERNEL); 96 dpc = kzalloc(sizeof(struct dpc), GFP_KERNEL);
98 if( NULL == dpc ) { 97 if( NULL == dpc ) {
@@ -116,11 +115,9 @@ static int dpc_probe(struct saa7146_dev* dev)
116 } 115 }
117 116
118 /* loop through all i2c-devices on the bus and look who is there */ 117 /* loop through all i2c-devices on the bus and look who is there */
119 list_for_each(item,&dpc->i2c_adapter.clients) { 118 list_for_each_entry(client, &dpc->i2c_adapter.clients, list)
120 client = list_entry(item, struct i2c_client, list);
121 if( I2C_SAA7111A == client->addr ) 119 if( I2C_SAA7111A == client->addr )
122 dpc->saa7111a = client; 120 dpc->saa7111a = client;
123 }
124 121
125 /* check if all devices are present */ 122 /* check if all devices are present */
126 if( 0 == dpc->saa7111a ) { 123 if( 0 == dpc->saa7111a ) {
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index e4fba9068336..b8d5327c438d 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -252,10 +252,8 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp)
252 int minor = iminor(inode); 252 int minor = iminor(inode);
253 int errCode = 0; 253 int errCode = 0;
254 struct em28xx *h,*dev = NULL; 254 struct em28xx *h,*dev = NULL;
255 struct list_head *list;
256 255
257 list_for_each(list,&em28xx_devlist) { 256 list_for_each_entry(h, &em28xx_devlist, devlist) {
258 h = list_entry(list, struct em28xx, devlist);
259 if (h->vdev->minor == minor) { 257 if (h->vdev->minor == minor) {
260 dev = h; 258 dev = h;
261 dev->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 259 dev->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c
index 152cc6b3e152..98ad3092a079 100644
--- a/drivers/media/video/mxb.c
+++ b/drivers/media/video/mxb.c
@@ -153,7 +153,6 @@ static int mxb_probe(struct saa7146_dev* dev)
153{ 153{
154 struct mxb* mxb = NULL; 154 struct mxb* mxb = NULL;
155 struct i2c_client *client; 155 struct i2c_client *client;
156 struct list_head *item;
157 int result; 156 int result;
158 157
159 if ((result = request_module("saa7111")) < 0) { 158 if ((result = request_module("saa7111")) < 0) {
@@ -196,8 +195,7 @@ static int mxb_probe(struct saa7146_dev* dev)
196 } 195 }
197 196
198 /* loop through all i2c-devices on the bus and look who is there */ 197 /* loop through all i2c-devices on the bus and look who is there */
199 list_for_each(item,&mxb->i2c_adapter.clients) { 198 list_for_each_entry(client, &mxb->i2c_adapter.clients, list) {
200 client = list_entry(item, struct i2c_client, list);
201 if( I2C_ADDR_TEA6420_1 == client->addr ) 199 if( I2C_ADDR_TEA6420_1 == client->addr )
202 mxb->tea6420_1 = client; 200 mxb->tea6420_1 = client;
203 if( I2C_ADDR_TEA6420_2 == client->addr ) 201 if( I2C_ADDR_TEA6420_2 == client->addr )
diff --git a/drivers/media/video/tvmixer.c b/drivers/media/video/tvmixer.c
index 544a4ae7d2ed..9fa5b702e073 100644
--- a/drivers/media/video/tvmixer.c
+++ b/drivers/media/video/tvmixer.c
@@ -237,13 +237,10 @@ static const struct file_operations tvmixer_fops = {
237 237
238static int tvmixer_adapters(struct i2c_adapter *adap) 238static int tvmixer_adapters(struct i2c_adapter *adap)
239{ 239{
240 struct list_head *item;
241 struct i2c_client *client; 240 struct i2c_client *client;
242 241
243 list_for_each(item,&adap->clients) { 242 list_for_each_entry(client, &adap->clients, list)
244 client = list_entry(item, struct i2c_client, list);
245 tvmixer_clients(client); 243 tvmixer_clients(client);
246 }
247 return 0; 244 return 0;
248} 245}
249 246
diff --git a/drivers/media/video/v4l2-int-device.c b/drivers/media/video/v4l2-int-device.c
index f497c9458344..8b4ef530a3a8 100644
--- a/drivers/media/video/v4l2-int-device.c
+++ b/drivers/media/video/v4l2-int-device.c
@@ -34,21 +34,13 @@ static LIST_HEAD(int_list);
34 34
35static void v4l2_int_device_try_attach_all(void) 35static void v4l2_int_device_try_attach_all(void)
36{ 36{
37 struct list_head *head_master; 37 struct v4l2_int_device *m, *s;
38
39 list_for_each(head_master, &int_list) {
40 struct list_head *head_slave;
41 struct v4l2_int_device *m =
42 list_entry(head_master, struct v4l2_int_device, head);
43 38
39 list_for_each_entry(m, &int_list, head) {
44 if (m->type != v4l2_int_type_master) 40 if (m->type != v4l2_int_type_master)
45 continue; 41 continue;
46 42
47 list_for_each(head_slave, &int_list) { 43 list_for_each_entry(s, &int_list, head) {
48 struct v4l2_int_device *s =
49 list_entry(head_slave,
50 struct v4l2_int_device, head);
51
52 if (s->type != v4l2_int_type_slave) 44 if (s->type != v4l2_int_type_slave)
53 continue; 45 continue;
54 46
diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c
index 25a98496e3db..c606332512b6 100644
--- a/drivers/media/video/videobuf-core.c
+++ b/drivers/media/video/videobuf-core.c
@@ -517,7 +517,6 @@ int videobuf_dqbuf(struct videobuf_queue *q,
517int videobuf_streamon(struct videobuf_queue *q) 517int videobuf_streamon(struct videobuf_queue *q)
518{ 518{
519 struct videobuf_buffer *buf; 519 struct videobuf_buffer *buf;
520 struct list_head *list;
521 unsigned long flags=0; 520 unsigned long flags=0;
522 int retval; 521 int retval;
523 522
@@ -531,11 +530,9 @@ int videobuf_streamon(struct videobuf_queue *q)
531 q->streaming = 1; 530 q->streaming = 1;
532 if (q->irqlock) 531 if (q->irqlock)
533 spin_lock_irqsave(q->irqlock,flags); 532 spin_lock_irqsave(q->irqlock,flags);
534 list_for_each(list,&q->stream) { 533 list_for_each_entry(buf, &q->stream, stream)
535 buf = list_entry(list, struct videobuf_buffer, stream);
536 if (buf->state == STATE_PREPARED) 534 if (buf->state == STATE_PREPARED)
537 q->ops->buf_queue(q,buf); 535 q->ops->buf_queue(q,buf);
538 }
539 if (q->irqlock) 536 if (q->irqlock)
540 spin_unlock_irqrestore(q->irqlock,flags); 537 spin_unlock_irqrestore(q->irqlock,flags);
541 538
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);