aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Toth <stoth@hauppauge.com>2008-05-22 17:04:36 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:20:30 -0400
commiteae55660fc4a7f17f0f87458d8ada2b51b1833c1 (patch)
tree10b91e1c1cf2bb24b87d24d9cca10edf221833fa
parent159ed4bbc394bb3e547eb64fdd3a59141ced131a (diff)
V4L/DVB (8268): sms1xxx: usb cleanup
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.c13
-rw-r--r--drivers/media/mdtv/smscoreapi.h8
-rw-r--r--drivers/media/mdtv/smsdvb.c27
-rw-r--r--drivers/media/mdtv/smsusb.c30
4 files changed, 48 insertions, 30 deletions
diff --git a/drivers/media/mdtv/smscoreapi.c b/drivers/media/mdtv/smscoreapi.c
index 715dde034e8a..6d21ff391227 100644
--- a/drivers/media/mdtv/smscoreapi.c
+++ b/drivers/media/mdtv/smscoreapi.c
@@ -1104,6 +1104,12 @@ int smscore_module_init(void)
1104 INIT_LIST_HEAD(&g_smscore_registry); 1104 INIT_LIST_HEAD(&g_smscore_registry);
1105 kmutex_init(&g_smscore_registrylock); 1105 kmutex_init(&g_smscore_registrylock);
1106 1106
1107 /* USB Register */
1108 rc = smsusb_register();
1109
1110 /* DVB Register */
1111 rc = smsdvb_register();
1112
1107 printk(KERN_INFO "%s, rc %d\n", __FUNCTION__, rc); 1113 printk(KERN_INFO "%s, rc %d\n", __FUNCTION__, rc);
1108 1114
1109 return rc; 1115 return rc;
@@ -1111,6 +1117,7 @@ int smscore_module_init(void)
1111 1117
1112void smscore_module_exit(void) 1118void smscore_module_exit(void)
1113{ 1119{
1120
1114 kmutex_lock(&g_smscore_deviceslock); 1121 kmutex_lock(&g_smscore_deviceslock);
1115 while (!list_empty(&g_smscore_notifyees)) 1122 while (!list_empty(&g_smscore_notifyees))
1116 { 1123 {
@@ -1131,6 +1138,12 @@ void smscore_module_exit(void)
1131 } 1138 }
1132 kmutex_unlock(&g_smscore_registrylock); 1139 kmutex_unlock(&g_smscore_registrylock);
1133 1140
1141 /* DVB UnRegister */
1142 smsdvb_unregister();
1143
1144 /* Unregister USB */
1145 smsusb_unregister();
1146
1134 printk(KERN_INFO "%s\n", __FUNCTION__); 1147 printk(KERN_INFO "%s\n", __FUNCTION__);
1135} 1148}
1136 1149
diff --git a/drivers/media/mdtv/smscoreapi.h b/drivers/media/mdtv/smscoreapi.h
index 5c1369365c75..9f367f2cdf3c 100644
--- a/drivers/media/mdtv/smscoreapi.h
+++ b/drivers/media/mdtv/smscoreapi.h
@@ -508,7 +508,11 @@ extern smscore_buffer_t *smscore_getbuffer(smscore_device_t *coredev);
508extern void smscore_putbuffer(smscore_device_t *coredev, smscore_buffer_t *cb); 508extern void smscore_putbuffer(smscore_device_t *coredev, smscore_buffer_t *cb);
509 509
510/* smsdvb.c */ 510/* smsdvb.c */
511int smsdvb_hotplug(smscore_device_t *coredev, struct device* device, int arrival); 511int smsdvb_register(void);
512void smsdvb_unregister_client(smsdvb_client_t* client); 512void smsdvb_unregister(void);
513
514/* smsusb.c */
515int smsusb_register(void);
516void smsusb_unregister(void);
513 517
514#endif // __smscoreapi_h__ 518#endif // __smscoreapi_h__
diff --git a/drivers/media/mdtv/smsdvb.c b/drivers/media/mdtv/smsdvb.c
index 166f218ca5c1..7a1e6c33b12c 100644
--- a/drivers/media/mdtv/smsdvb.c
+++ b/drivers/media/mdtv/smsdvb.c
@@ -375,3 +375,30 @@ adapter_error:
375 return rc; 375 return rc;
376} 376}
377 377
378int smsdvb_register(void)
379{
380 int rc;
381
382 INIT_LIST_HEAD(&g_smsdvb_clients);
383 kmutex_init(&g_smsdvb_clientslock);
384
385 rc = smscore_register_hotplug(smsdvb_hotplug);
386
387 printk(KERN_INFO "%s\n", __FUNCTION__);
388
389 return rc;
390}
391
392void smsdvb_unregister(void)
393{
394 smscore_unregister_hotplug(smsdvb_hotplug);
395
396 kmutex_lock(&g_smsdvb_clientslock);
397
398 while (!list_empty(&g_smsdvb_clients))
399 smsdvb_unregister_client((smsdvb_client_t*) g_smsdvb_clients.next);
400
401 kmutex_unlock(&g_smsdvb_clientslock);
402
403}
404
diff --git a/drivers/media/mdtv/smsusb.c b/drivers/media/mdtv/smsusb.c
index 11c471ad6326..277faf142ade 100644
--- a/drivers/media/mdtv/smsusb.c
+++ b/drivers/media/mdtv/smsusb.c
@@ -1,6 +1,5 @@
1#include <linux/kernel.h> 1#include <linux/kernel.h>
2#include <linux/init.h> 2#include <linux/init.h>
3#include <linux/module.h>
4#include <linux/usb.h> 3#include <linux/usb.h>
5#include <linux/firmware.h> 4#include <linux/firmware.h>
6 5
@@ -401,46 +400,21 @@ static struct usb_driver smsusb_driver = {
401 .id_table = smsusb_id_table, 400 .id_table = smsusb_id_table,
402}; 401};
403 402
404extern struct list_head g_smsdvb_clients; 403int smsusb_register(void)
405kmutex_t g_smsdvb_clientslock;
406
407int smsusb_module_init(void)
408{ 404{
409 int rc = usb_register(&smsusb_driver); 405 int rc = usb_register(&smsusb_driver);
410 if (rc) 406 if (rc)
411 printk(KERN_INFO "usb_register failed. Error number %d\n", rc); 407 printk(KERN_INFO "usb_register failed. Error number %d\n", rc);
412 408
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
419 printk(KERN_INFO "%s\n", __FUNCTION__); 409 printk(KERN_INFO "%s\n", __FUNCTION__);
420 410
421 return rc; 411 return rc;
422} 412}
423 413
424void smsusb_module_exit(void) 414void smsusb_unregister(void)
425{ 415{
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 */ 416 /* Regular USB Cleanup */
437 usb_deregister(&smsusb_driver); 417 usb_deregister(&smsusb_driver);
438 printk(KERN_INFO "%s\n", __FUNCTION__); 418 printk(KERN_INFO "%s\n", __FUNCTION__);
439} 419}
440 420
441module_init(smsusb_module_init);
442module_exit(smsusb_module_exit);
443
444MODULE_DESCRIPTION("smsusb");
445MODULE_AUTHOR("Anatoly Greenblatt,,, (anatolyg@siano-ms.com)");
446MODULE_LICENSE("GPL");