diff options
author | Steven Toth <stoth@hauppauge.com> | 2008-05-22 17:01:02 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 06:20:18 -0400 |
commit | 3dd243787017e40c66ae54cf590ea513a110c51d (patch) | |
tree | 7384df276d2b524e9ead1b303d49ebbc07aaf588 | |
parent | 7a19598c75660b6d4464d291f8e99a91fd7afc4a (diff) |
V4L/DVB (8266): sms1xxx: merge modules
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>
-rw-r--r-- | drivers/media/mdtv/smscoreapi.h | 31 | ||||
-rw-r--r-- | drivers/media/mdtv/smsdvb.c | 61 | ||||
-rw-r--r-- | drivers/media/mdtv/smsusb.c | 20 |
3 files changed, 51 insertions, 61 deletions
diff --git a/drivers/media/mdtv/smscoreapi.h b/drivers/media/mdtv/smscoreapi.h index 61fed88cf1c5..5c1369365c75 100644 --- a/drivers/media/mdtv/smscoreapi.h +++ b/drivers/media/mdtv/smscoreapi.h | |||
@@ -1,6 +1,11 @@ | |||
1 | #ifndef __smscoreapi_h__ | 1 | #ifndef __smscoreapi_h__ |
2 | #define __smscoreapi_h__ | 2 | #define __smscoreapi_h__ |
3 | 3 | ||
4 | #include "dmxdev.h" | ||
5 | #include "dvbdev.h" | ||
6 | #include "dvb_demux.h" | ||
7 | #include "dvb_frontend.h" | ||
8 | |||
4 | /* From sysksyms.h */ | 9 | /* From sysksyms.h */ |
5 | 10 | ||
6 | #include <linux/version.h> | 11 | #include <linux/version.h> |
@@ -453,6 +458,28 @@ typedef struct SMSHOSTLIB_I2C_RES_S | |||
453 | 458 | ||
454 | /* End types.h */ | 459 | /* End types.h */ |
455 | 460 | ||
461 | typedef struct _smsdvb_client | ||
462 | { | ||
463 | struct list_head entry; | ||
464 | |||
465 | smscore_device_t *coredev; | ||
466 | smscore_client_t *smsclient; | ||
467 | |||
468 | struct dvb_adapter adapter; | ||
469 | struct dvb_demux demux; | ||
470 | struct dmxdev dmxdev; | ||
471 | struct dvb_frontend frontend; | ||
472 | |||
473 | fe_status_t fe_status; | ||
474 | int fe_ber, fe_snr, fe_signal_strength; | ||
475 | |||
476 | struct completion tune_done, stat_done; | ||
477 | |||
478 | // todo: save freq/band instead whole struct | ||
479 | struct dvb_frontend_parameters fe_params; | ||
480 | |||
481 | } smsdvb_client_t; | ||
482 | |||
456 | extern void smscore_registry_setmode(char *devpath, int mode); | 483 | extern void smscore_registry_setmode(char *devpath, int mode); |
457 | extern int smscore_registry_getmode(char *devpath); | 484 | extern int smscore_registry_getmode(char *devpath); |
458 | 485 | ||
@@ -480,4 +507,8 @@ extern int smscore_map_common_buffer(smscore_device_t *coredev, struct vm_area_s | |||
480 | extern smscore_buffer_t *smscore_getbuffer(smscore_device_t *coredev); | 507 | extern smscore_buffer_t *smscore_getbuffer(smscore_device_t *coredev); |
481 | extern void smscore_putbuffer(smscore_device_t *coredev, smscore_buffer_t *cb); | 508 | extern void smscore_putbuffer(smscore_device_t *coredev, smscore_buffer_t *cb); |
482 | 509 | ||
510 | /* smsdvb.c */ | ||
511 | int smsdvb_hotplug(smscore_device_t *coredev, struct device* device, int arrival); | ||
512 | void smsdvb_unregister_client(smsdvb_client_t* client); | ||
513 | |||
483 | #endif // __smscoreapi_h__ | 514 | #endif // __smscoreapi_h__ |
diff --git a/drivers/media/mdtv/smsdvb.c b/drivers/media/mdtv/smsdvb.c index e941a0b97f2c..166f218ca5c1 100644 --- a/drivers/media/mdtv/smsdvb.c +++ b/drivers/media/mdtv/smsdvb.c | |||
@@ -1,37 +1,10 @@ | |||
1 | #include <linux/module.h> | 1 | #include <linux/module.h> |
2 | #include <linux/init.h> | 2 | #include <linux/init.h> |
3 | 3 | ||
4 | #include "dmxdev.h" | ||
5 | #include "dvbdev.h" | ||
6 | #include "dvb_demux.h" | ||
7 | #include "dvb_frontend.h" | ||
8 | |||
9 | #include "smscoreapi.h" | 4 | #include "smscoreapi.h" |
10 | 5 | ||
11 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | 6 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
12 | 7 | ||
13 | typedef struct _smsdvb_client | ||
14 | { | ||
15 | struct list_head entry; | ||
16 | |||
17 | smscore_device_t *coredev; | ||
18 | smscore_client_t *smsclient; | ||
19 | |||
20 | struct dvb_adapter adapter; | ||
21 | struct dvb_demux demux; | ||
22 | struct dmxdev dmxdev; | ||
23 | struct dvb_frontend frontend; | ||
24 | |||
25 | fe_status_t fe_status; | ||
26 | int fe_ber, fe_snr, fe_signal_strength; | ||
27 | |||
28 | struct completion tune_done, stat_done; | ||
29 | |||
30 | // todo: save freq/band instead whole struct | ||
31 | struct dvb_frontend_parameters fe_params; | ||
32 | |||
33 | } smsdvb_client_t; | ||
34 | |||
35 | struct list_head g_smsdvb_clients; | 8 | struct list_head g_smsdvb_clients; |
36 | kmutex_t g_smsdvb_clientslock; | 9 | kmutex_t g_smsdvb_clientslock; |
37 | 10 | ||
@@ -402,37 +375,3 @@ adapter_error: | |||
402 | return rc; | 375 | return rc; |
403 | } | 376 | } |
404 | 377 | ||
405 | int smsdvb_module_init(void) | ||
406 | { | ||
407 | int rc; | ||
408 | |||
409 | INIT_LIST_HEAD(&g_smsdvb_clients); | ||
410 | kmutex_init(&g_smsdvb_clientslock); | ||
411 | |||
412 | rc = smscore_register_hotplug(smsdvb_hotplug); | ||
413 | |||
414 | printk(KERN_INFO "%s, rc %d\n", __FUNCTION__, rc); | ||
415 | |||
416 | return rc; | ||
417 | } | ||
418 | |||
419 | void smsdvb_module_exit(void) | ||
420 | { | ||
421 | smscore_unregister_hotplug(smsdvb_hotplug); | ||
422 | |||
423 | kmutex_lock(&g_smsdvb_clientslock); | ||
424 | |||
425 | while (!list_empty(&g_smsdvb_clients)) | ||
426 | smsdvb_unregister_client((smsdvb_client_t*) g_smsdvb_clients.next); | ||
427 | |||
428 | kmutex_unlock(&g_smsdvb_clientslock); | ||
429 | |||
430 | printk(KERN_INFO "%s\n", __FUNCTION__); | ||
431 | } | ||
432 | |||
433 | module_init(smsdvb_module_init); | ||
434 | module_exit(smsdvb_module_exit); | ||
435 | |||
436 | MODULE_DESCRIPTION("smsdvb dvb-api module"); | ||
437 | MODULE_AUTHOR("Anatoly Greenblatt,,, (anatolyg@siano-ms.com)"); | ||
438 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/mdtv/smsusb.c b/drivers/media/mdtv/smsusb.c index 1da0209fc56f..11c471ad6326 100644 --- a/drivers/media/mdtv/smsusb.c +++ b/drivers/media/mdtv/smsusb.c | |||
@@ -401,12 +401,21 @@ static struct usb_driver smsusb_driver = { | |||
401 | .id_table = smsusb_id_table, | 401 | .id_table = smsusb_id_table, |
402 | }; | 402 | }; |
403 | 403 | ||
404 | extern struct list_head g_smsdvb_clients; | ||
405 | kmutex_t g_smsdvb_clientslock; | ||
406 | |||
404 | int smsusb_module_init(void) | 407 | int smsusb_module_init(void) |
405 | { | 408 | { |
406 | int rc = usb_register(&smsusb_driver); | 409 | int rc = usb_register(&smsusb_driver); |
407 | if (rc) | 410 | if (rc) |
408 | printk(KERN_INFO "usb_register failed. Error number %d\n", rc); | 411 | printk(KERN_INFO "usb_register failed. Error number %d\n", rc); |
409 | 412 | ||
413 | /* Bring up the dvb componenets */ | ||
414 | INIT_LIST_HEAD(&g_smsdvb_clients); | ||
415 | kmutex_init(&g_smsdvb_clientslock); | ||
416 | |||
417 | rc = smscore_register_hotplug(smsdvb_hotplug); | ||
418 | |||
410 | printk(KERN_INFO "%s\n", __FUNCTION__); | 419 | printk(KERN_INFO "%s\n", __FUNCTION__); |
411 | 420 | ||
412 | return rc; | 421 | return rc; |
@@ -414,6 +423,17 @@ int smsusb_module_init(void) | |||
414 | 423 | ||
415 | void smsusb_module_exit(void) | 424 | void smsusb_module_exit(void) |
416 | { | 425 | { |
426 | /* Tear down the DVB components */ | ||
427 | smscore_unregister_hotplug(smsdvb_hotplug); | ||
428 | |||
429 | kmutex_lock(&g_smsdvb_clientslock); | ||
430 | |||
431 | while (!list_empty(&g_smsdvb_clients)) | ||
432 | smsdvb_unregister_client((smsdvb_client_t*) g_smsdvb_clients.next); | ||
433 | |||
434 | kmutex_unlock(&g_smsdvb_clientslock); | ||
435 | |||
436 | /* Regular USB Cleanup */ | ||
417 | usb_deregister(&smsusb_driver); | 437 | usb_deregister(&smsusb_driver); |
418 | printk(KERN_INFO "%s\n", __FUNCTION__); | 438 | printk(KERN_INFO "%s\n", __FUNCTION__); |
419 | } | 439 | } |