V4L/DVB (8266): sms1xxx: merge modules
authorSteven Toth <stoth@hauppauge.com>
Thu, 22 May 2008 21:01:02 +0000 (18:01 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 20 Jul 2008 10:20:18 +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.h
drivers/media/mdtv/smsdvb.c
drivers/media/mdtv/smsusb.c

index 61fed88cf1c56a9bf836c0a242d4a372e34790cd..5c1369365c75ecd32c2a8cf7ecb2ab9f3566a7c2 100644 (file)
@@ -1,6 +1,11 @@
 #ifndef __smscoreapi_h__
 #define __smscoreapi_h__
 
+#include "dmxdev.h"
+#include "dvbdev.h"
+#include "dvb_demux.h"
+#include "dvb_frontend.h"
+
 /* From sysksyms.h */
 
 #include <linux/version.h>
@@ -453,6 +458,28 @@ typedef struct SMSHOSTLIB_I2C_RES_S
 
 /* End types.h */
 
+typedef struct _smsdvb_client
+{
+       struct list_head entry;
+
+       smscore_device_t        *coredev;
+       smscore_client_t        *smsclient;
+
+       struct dvb_adapter      adapter;
+       struct dvb_demux        demux;
+       struct dmxdev           dmxdev;
+       struct dvb_frontend     frontend;
+
+       fe_status_t                     fe_status;
+       int                                     fe_ber, fe_snr, fe_signal_strength;
+
+       struct completion       tune_done, stat_done;
+
+       // todo: save freq/band instead whole struct
+       struct dvb_frontend_parameters fe_params;
+
+} smsdvb_client_t;
+
 extern void smscore_registry_setmode(char *devpath, int mode);
 extern int smscore_registry_getmode(char *devpath);
 
@@ -480,4 +507,8 @@ extern int smscore_map_common_buffer(smscore_device_t *coredev, struct vm_area_s
 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);
+
 #endif // __smscoreapi_h__
index e941a0b97f2c9999e924cd1fe4c0552151c4ac46..166f218ca5c16b1fe0e8fa5a6853c5292addb11e 100644 (file)
@@ -1,37 +1,10 @@
 #include <linux/module.h>
 #include <linux/init.h>
 
-#include "dmxdev.h"
-#include "dvbdev.h"
-#include "dvb_demux.h"
-#include "dvb_frontend.h"
-
 #include "smscoreapi.h"
 
 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 
-typedef struct _smsdvb_client
-{
-       struct list_head entry;
-
-       smscore_device_t        *coredev;
-       smscore_client_t        *smsclient;
-
-       struct dvb_adapter      adapter;
-       struct dvb_demux        demux;
-       struct dmxdev           dmxdev;
-       struct dvb_frontend     frontend;
-
-       fe_status_t                     fe_status;
-       int                                     fe_ber, fe_snr, fe_signal_strength;
-
-       struct completion       tune_done, stat_done;
-
-       // todo: save freq/band instead whole struct
-       struct dvb_frontend_parameters fe_params;
-
-} smsdvb_client_t;
-
 struct list_head g_smsdvb_clients;
 kmutex_t g_smsdvb_clientslock;
 
@@ -402,37 +375,3 @@ adapter_error:
        return rc;
 }
 
-int smsdvb_module_init(void)
-{
-       int rc;
-
-       INIT_LIST_HEAD(&g_smsdvb_clients);
-       kmutex_init(&g_smsdvb_clientslock);
-
-       rc = smscore_register_hotplug(smsdvb_hotplug);
-
-       printk(KERN_INFO "%s, rc %d\n", __FUNCTION__, rc);
-
-       return rc;
-}
-
-void smsdvb_module_exit(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);
-
-       printk(KERN_INFO "%s\n", __FUNCTION__);
-}
-
-module_init(smsdvb_module_init);
-module_exit(smsdvb_module_exit);
-
-MODULE_DESCRIPTION("smsdvb dvb-api module");
-MODULE_AUTHOR("Anatoly Greenblatt,,, (anatolyg@siano-ms.com)");
-MODULE_LICENSE("GPL");
index 1da0209fc56f45352116a59d35bc7554e4c8faff..11c471ad63269659fca0a7171444cf0722f77b62 100644 (file)
@@ -401,12 +401,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 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;
@@ -414,6 +423,17 @@ int smsusb_module_init(void)
 
 void smsusb_module_exit(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__);
 }