提交 0367ca1b 编写于 作者: D Devin Heitmueller 提交者: Mauro Carvalho Chehab

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: NDevin Heitmueller <devin.heitmueller@gmail.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@infradead.org>
上级 d3d9b803
...@@ -1848,32 +1848,28 @@ static DEFINE_MUTEX(em28xx_extension_devlist_lock); ...@@ -1848,32 +1848,28 @@ static DEFINE_MUTEX(em28xx_extension_devlist_lock);
int em28xx_register_extension(struct em28xx_ops *ops) int em28xx_register_extension(struct em28xx_ops *ops)
{ {
struct em28xx *h, *dev = NULL; struct em28xx *dev = NULL;
list_for_each_entry(h, &em28xx_devlist, devlist)
dev = h;
mutex_lock(&em28xx_extension_devlist_lock); mutex_lock(&em28xx_extension_devlist_lock);
list_add_tail(&ops->next, &em28xx_extension_devlist); list_add_tail(&ops->next, &em28xx_extension_devlist);
if (dev) list_for_each_entry(dev, &em28xx_devlist, devlist) {
ops->init(dev); if (dev)
ops->init(dev);
}
printk(KERN_INFO "Em28xx: Initialized (%s) extension\n", ops->name); printk(KERN_INFO "Em28xx: Initialized (%s) extension\n", ops->name);
mutex_unlock(&em28xx_extension_devlist_lock); mutex_unlock(&em28xx_extension_devlist_lock);
return 0; return 0;
} }
EXPORT_SYMBOL(em28xx_register_extension); EXPORT_SYMBOL(em28xx_register_extension);
void em28xx_unregister_extension(struct em28xx_ops *ops) void em28xx_unregister_extension(struct em28xx_ops *ops)
{ {
struct em28xx *h, *dev = NULL; struct em28xx *dev = NULL;
list_for_each_entry(h, &em28xx_devlist, devlist)
dev = h;
if (dev) list_for_each_entry(dev, &em28xx_devlist, devlist) {
ops->fini(dev); if (dev)
ops->fini(dev);
}
mutex_lock(&em28xx_extension_devlist_lock); mutex_lock(&em28xx_extension_devlist_lock);
printk(KERN_INFO "Em28xx: Removed (%s) extension\n", ops->name); printk(KERN_INFO "Em28xx: Removed (%s) extension\n", ops->name);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册