diff options
author | Devin Heitmueller <devin.heitmueller@gmail.com> | 2008-06-09 13:58:04 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-06-26 14:58:42 -0400 |
commit | 0367ca1bc7346d9ea89a4b4f1b9220489bda65a3 (patch) | |
tree | 04d358f2933b62b63482f977b3b9efe196fcda55 /drivers/media/video/em28xx | |
parent | d3d9b803eead0a536d28ffc31c5fadae976991cc (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/media/video/em28xx')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-video.c | 24 |
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 fb163ecd9216..285bc62bbe46 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); | |||
1848 | 1848 | ||
1849 | int em28xx_register_extension(struct em28xx_ops *ops) | 1849 | int em28xx_register_extension(struct em28xx_ops *ops) |
1850 | { | 1850 | { |
1851 | struct em28xx *h, *dev = NULL; | 1851 | struct em28xx *dev = NULL; |
1852 | |||
1853 | list_for_each_entry(h, &em28xx_devlist, devlist) | ||
1854 | dev = h; | ||
1855 | 1852 | ||
1856 | mutex_lock(&em28xx_extension_devlist_lock); | 1853 | mutex_lock(&em28xx_extension_devlist_lock); |
1857 | list_add_tail(&ops->next, &em28xx_extension_devlist); | 1854 | list_add_tail(&ops->next, &em28xx_extension_devlist); |
1858 | if (dev) | 1855 | list_for_each_entry(dev, &em28xx_devlist, devlist) { |
1859 | ops->init(dev); | 1856 | if (dev) |
1860 | 1857 | ops->init(dev); | |
1858 | } | ||
1861 | printk(KERN_INFO "Em28xx: Initialized (%s) extension\n", ops->name); | 1859 | printk(KERN_INFO "Em28xx: Initialized (%s) extension\n", ops->name); |
1862 | mutex_unlock(&em28xx_extension_devlist_lock); | 1860 | mutex_unlock(&em28xx_extension_devlist_lock); |
1863 | |||
1864 | return 0; | 1861 | return 0; |
1865 | } | 1862 | } |
1866 | EXPORT_SYMBOL(em28xx_register_extension); | 1863 | EXPORT_SYMBOL(em28xx_register_extension); |
1867 | 1864 | ||
1868 | void em28xx_unregister_extension(struct em28xx_ops *ops) | 1865 | void em28xx_unregister_extension(struct em28xx_ops *ops) |
1869 | { | 1866 | { |
1870 | struct em28xx *h, *dev = NULL; | 1867 | struct em28xx *dev = NULL; |
1871 | |||
1872 | list_for_each_entry(h, &em28xx_devlist, devlist) | ||
1873 | dev = h; | ||
1874 | 1868 | ||
1875 | if (dev) | 1869 | list_for_each_entry(dev, &em28xx_devlist, devlist) { |
1876 | ops->fini(dev); | 1870 | if (dev) |
1871 | ops->fini(dev); | ||
1872 | } | ||
1877 | 1873 | ||
1878 | mutex_lock(&em28xx_extension_devlist_lock); | 1874 | mutex_lock(&em28xx_extension_devlist_lock); |
1879 | printk(KERN_INFO "Em28xx: Removed (%s) extension\n", ops->name); | 1875 | printk(KERN_INFO "Em28xx: Removed (%s) extension\n", ops->name); |