diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2007-10-10 04:37:42 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-10 12:35:07 -0400 |
commit | 6d28e98906aa9405895f92348543d08da1837ea5 (patch) | |
tree | 3f92cb9777405d0576f36b86501820c191deab3d /drivers/media/video/saa7134/saa7134-video.c | |
parent | 805a43924158e4eb2bffc4cac0aedcfb42a89469 (diff) |
V4L/DVB (6314): saa7134: Replace list_for_each+list_entry with list_for_each_entry
A couple loops weren't changed because they expected the loop iterator
to be left as NULL if the list was empty. Maybe the code should just
check for that first, then loop?
Adjust some of the loop logic to be simpler.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-video.c')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-video.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 7c97ac15e665..471b92793c12 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -1285,26 +1285,24 @@ static int saa7134_resource(struct saa7134_fh *fh) | |||
1285 | static int video_open(struct inode *inode, struct file *file) | 1285 | static int video_open(struct inode *inode, struct file *file) |
1286 | { | 1286 | { |
1287 | int minor = iminor(inode); | 1287 | int minor = iminor(inode); |
1288 | struct saa7134_dev *h,*dev = NULL; | 1288 | struct saa7134_dev *dev; |
1289 | struct saa7134_fh *fh; | 1289 | struct saa7134_fh *fh; |
1290 | struct list_head *list; | ||
1291 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 1290 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1292 | int radio = 0; | 1291 | int radio = 0; |
1293 | list_for_each(list,&saa7134_devlist) { | 1292 | list_for_each_entry(dev, &saa7134_devlist, devlist) { |
1294 | h = list_entry(list, struct saa7134_dev, devlist); | 1293 | if (dev->video_dev && (dev->video_dev->minor == minor)) |
1295 | if (h->video_dev && (h->video_dev->minor == minor)) | 1294 | goto found; |
1296 | dev = h; | 1295 | if (dev->radio_dev && (dev->radio_dev->minor == minor)) { |
1297 | if (h->radio_dev && (h->radio_dev->minor == minor)) { | ||
1298 | radio = 1; | 1296 | radio = 1; |
1299 | dev = h; | 1297 | goto found; |
1300 | } | 1298 | } |
1301 | if (h->vbi_dev && (h->vbi_dev->minor == minor)) { | 1299 | if (dev->vbi_dev && (dev->vbi_dev->minor == minor)) { |
1302 | type = V4L2_BUF_TYPE_VBI_CAPTURE; | 1300 | type = V4L2_BUF_TYPE_VBI_CAPTURE; |
1303 | dev = h; | 1301 | goto found; |
1304 | } | 1302 | } |
1305 | } | 1303 | } |
1306 | if (NULL == dev) | 1304 | return -ENODEV; |
1307 | return -ENODEV; | 1305 | found: |
1308 | 1306 | ||
1309 | dprintk("open minor=%d radio=%d type=%s\n",minor,radio, | 1307 | dprintk("open minor=%d radio=%d type=%s\n",minor,radio, |
1310 | v4l2_type_names[type]); | 1308 | v4l2_type_names[type]); |