Jiri Slaby wrote:
# HG changeset patch # User Jiri Slaby jirislaby@gmail.com # Date 1191677598 -7200 # Node ID a4e8124c6f90a766a49b2e042a757b31faeed8ee # Parent f89a5dbbfcf7706106d46d0702659e84db9f33df v4l2_extension: use list_for_each_entry istead of list_for_each
Signed-off-by: Jiri Slaby jirislaby@gmail.com
diff --git a/linux/drivers/media/video/v4l2_extension/v4l2_extension-video.c b/linux/drivers/media/video/v4l2_extension/v4l2_extension-video.c --- a/linux/drivers/media/video/v4l2_extension/v4l2_extension-video.c +++ b/linux/drivers/media/video/v4l2_extension/v4l2_extension-video.c @@ -60,18 +60,16 @@ static int video_open(struct inode *inod static int video_open(struct inode *inode, struct file *file) { int minor = iminor(inode);
- struct v4l2ext *h;
- struct v4l2ext *dev = NULL;
- struct list_head *list;
struct v4l2ext *h, *dev = NULL; struct video_device *base_dev;
/* Find the right private data corresponding to this inode */
- list_for_each(list,&v4l2ext_devlist) {
h = list_entry(list, struct v4l2ext, devlist);
- list_for_each_entry(h, &v4l2ext_devlist, devlist) if (h->vdev->minor == minor) { dev = h;
}break;
- }
- if (dev == NULL) return -ENODEV;
@@ -545,16 +543,14 @@ static void v4l2ext_fini(void) static void v4l2ext_fini(void) { struct v4l2ext *h;
struct list_head *list;
/* remove the v4l2 helper daemon interface */ v4l2ext_hlp_fini();
/* remove any registered base v4l structure */
list_for_each(list, &v4l2ext_devlist) {
h = list_entry(list, struct v4l2ext, devlist);
- list_for_each_entry(h, &v4l2ext_devlist, devlist) v4l2ext_unregister(h->base_vdev);
- }
- printk(KERN_INFO "v4l2 extension module removed\n");
}
@@ -671,19 +667,17 @@ out: /* and the corresponding 'clone' device entry point */ void v4l2ext_unregister(struct video_device *base_vdev) {
- struct v4l2ext *h;
- struct v4l2ext *dev = NULL;
- struct list_head *list;
struct v4l2ext *h, *dev = NULL;
mutex_lock(&v4l2ext_lock);
/* find the corresponding entry in device list */
- list_for_each(list,&v4l2ext_devlist) {
h = list_entry(list, struct v4l2ext, devlist);
- list_for_each_entry(h, &v4l2ext_devlist, devlist) { /* FIXME: The way to match the corresponding entry is not optimized and uncertain */ if (h->base_vdev->fops == base_vdev->fops) {
dev = h;
dev = h;
} } if (dev != NULL) {break;
Patch committed at http://linuxtv.org/hg/~tmerle/v4l2_extension/
Thierry