aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDevin Heitmueller <devin.heitmueller@gmail.com>2008-06-09 14:58:04 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-06-26 15:58:42 -0300
commit0367ca1bc7346d9ea89a4b4f1b9220489bda65a3 (patch)
tree04d358f2933b62b63482f977b3b9efe196fcda55 /drivers
parentd3d9b803eead0a536d28ffc31c5fadae976991cc (diff)
V4L/DVB (8010): em28xx: Properly register extensions for already attached devices
em28xx-video.c - Properly handle loading of the module when multiple devices are already connected (such as at bootup). Before we were only calling dvb_init() against the last device in the list, so while we were handling subsequent adds properly, if there were multiple devices present on driver load, everybody except the last device would not get initialized. Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index fb163ecd921..285bc62bbe4 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1848,32 +1848,28 @@ static DEFINE_MUTEX(em28xx_extension_devlist_lock);
int em28xx_register_extension(struct em28xx_ops *ops)
{
- struct em28xx *h, *dev = NULL;
-
- list_for_each_entry(h, &em28xx_devlist, devlist)
- dev = h;
+ struct em28xx *dev = NULL;
mutex_lock(&em28xx_extension_devlist_lock);
list_add_tail(&ops->next, &em28xx_extension_devlist);
- if (dev)
- ops->init(dev);
-
+ list_for_each_entry(dev, &em28xx_devlist, devlist) {
+ if (dev)
+ ops->init(dev);
+ }
printk(KERN_INFO "Em28xx: Initialized (%s) extension\n", ops->name);
mutex_unlock(&em28xx_extension_devlist_lock);
-
return 0;
}
EXPORT_SYMBOL(em28xx_register_extension);
void em28xx_unregister_extension(struct em28xx_ops *ops)
{
- struct em28xx *h, *dev = NULL;
-
- list_for_each_entry(h, &em28xx_devlist, devlist)
- dev = h;
+ struct em28xx *dev = NULL;
- if (dev)
- ops->fini(dev);
+ list_for_each_entry(dev, &em28xx_devlist, devlist) {
+ if (dev)
+ ops->fini(dev);
+ }
mutex_lock(&em28xx_extension_devlist_lock);
printk(KERN_INFO "Em28xx: Removed (%s) extension\n", ops->name);