]> err.no Git - linux-2.6/commitdiff
V4L/DVB (8268): sms1xxx: usb cleanup
authorSteven Toth <stoth@hauppauge.com>
Thu, 22 May 2008 21:04:36 +0000 (18:04 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 20 Jul 2008 10:20:30 +0000 (07:20 -0300)
Signed-off-by: Steven Toth <stoth@hauppauge.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/mdtv/smscoreapi.c
drivers/media/mdtv/smscoreapi.h
drivers/media/mdtv/smsdvb.c
drivers/media/mdtv/smsusb.c

index 715dde034e8ab3232c2bd64cfe6cca3da087fda0..6d21ff39122713e8edcd1a456e80c502d899d104 100644 (file)
@@ -1104,6 +1104,12 @@ int smscore_module_init(void)
        INIT_LIST_HEAD(&g_smscore_registry);
        kmutex_init(&g_smscore_registrylock);
 
+       /* USB Register */
+       rc = smsusb_register();
+
+       /* DVB Register */
+       rc = smsdvb_register();
+
        printk(KERN_INFO "%s, rc %d\n", __FUNCTION__, rc);
 
        return rc;
@@ -1111,6 +1117,7 @@ int smscore_module_init(void)
 
 void smscore_module_exit(void)
 {
+
        kmutex_lock(&g_smscore_deviceslock);
        while (!list_empty(&g_smscore_notifyees))
        {
@@ -1131,6 +1138,12 @@ void smscore_module_exit(void)
        }
        kmutex_unlock(&g_smscore_registrylock);
 
+       /* DVB UnRegister */
+       smsdvb_unregister();
+
+       /* Unregister USB */
+       smsusb_unregister();
+
        printk(KERN_INFO "%s\n", __FUNCTION__);
 }
 
index 5c1369365c75ecd32c2a8cf7ecb2ab9f3566a7c2..9f367f2cdf3cb031943c5ff0f91a9531f249c8a7 100644 (file)
@@ -508,7 +508,11 @@ extern smscore_buffer_t *smscore_getbuffer(smscore_device_t *coredev);
 extern void smscore_putbuffer(smscore_device_t *coredev, smscore_buffer_t *cb);
 
 /* smsdvb.c */
-int smsdvb_hotplug(smscore_device_t *coredev, struct device* device, int arrival);
-void smsdvb_unregister_client(smsdvb_client_t* client);
+int smsdvb_register(void);
+void smsdvb_unregister(void);
+
+/* smsusb.c */
+int smsusb_register(void);
+void smsusb_unregister(void);
 
 #endif // __smscoreapi_h__
index 166f218ca5c16b1fe0e8fa5a6853c5292addb11e..7a1e6c33b12c788092322c1b87223213cba9f1ad 100644 (file)
@@ -375,3 +375,30 @@ adapter_error:
        return rc;
 }
 
+int smsdvb_register(void)
+{
+       int rc;
+
+       INIT_LIST_HEAD(&g_smsdvb_clients);
+       kmutex_init(&g_smsdvb_clientslock);
+
+       rc = smscore_register_hotplug(smsdvb_hotplug);
+
+       printk(KERN_INFO "%s\n", __FUNCTION__);
+
+       return rc;
+}
+
+void smsdvb_unregister(void)
+{
+       smscore_unregister_hotplug(smsdvb_hotplug);
+
+       kmutex_lock(&g_smsdvb_clientslock);
+
+       while (!list_empty(&g_smsdvb_clients))
+               smsdvb_unregister_client((smsdvb_client_t*) g_smsdvb_clients.next);
+
+       kmutex_unlock(&g_smsdvb_clientslock);
+
+}
+
index 11c471ad63269659fca0a7171444cf0722f77b62..277faf142adeb43cb1e876672cd558287c715ac5 100644 (file)
@@ -1,6 +1,5 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/module.h>
 #include <linux/usb.h>
 #include <linux/firmware.h>
 
@@ -401,46 +400,21 @@ static struct usb_driver smsusb_driver = {
        .id_table               = smsusb_id_table,
 };
 
-extern struct list_head g_smsdvb_clients;
-kmutex_t g_smsdvb_clientslock;
-
-int smsusb_module_init(void)
+int smsusb_register(void)
 {
        int rc = usb_register(&smsusb_driver);
        if (rc)
                printk(KERN_INFO "usb_register failed. Error number %d\n", rc);
 
-       /* Bring up the dvb componenets */
-       INIT_LIST_HEAD(&g_smsdvb_clients);
-       kmutex_init(&g_smsdvb_clientslock);
-
-       rc = smscore_register_hotplug(smsdvb_hotplug);
-
        printk(KERN_INFO "%s\n", __FUNCTION__);
 
        return rc;
 }
 
-void smsusb_module_exit(void)
+void smsusb_unregister(void)
 {
-       /* Tear down the DVB components */
-       smscore_unregister_hotplug(smsdvb_hotplug);
-
-       kmutex_lock(&g_smsdvb_clientslock);
-
-       while (!list_empty(&g_smsdvb_clients))
-               smsdvb_unregister_client((smsdvb_client_t*) g_smsdvb_clients.next);
-
-       kmutex_unlock(&g_smsdvb_clientslock);
-
        /* Regular USB Cleanup */
        usb_deregister(&smsusb_driver);
        printk(KERN_INFO "%s\n", __FUNCTION__);
 }
 
-module_init(smsusb_module_init);
-module_exit(smsusb_module_exit);
-
-MODULE_DESCRIPTION("smsusb");
-MODULE_AUTHOR("Anatoly Greenblatt,,, (anatolyg@siano-ms.com)");
-MODULE_LICENSE("GPL");