aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-driver.c
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@kernellabs.com>2009-11-19 23:15:54 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 13:10:43 -0500
commitd68b687b1e322e7325b1458d799e8234997e4ccd (patch)
tree57b63b7f8ec2505582a944df31e6139f60c9265a /drivers/media/video/cx18/cx18-driver.c
parent4a8cfe6a5c158133f57c2e8476f259366d4bdc4d (diff)
V4L/DVB: cx18: rework cx18-alsa module loading to support automatic loading
Restructure the way the module gets loaded so that it gets loaded automatically when cx18 is loaded, and make it work properly if there are multiple cards present (since the old code would only take one opportunity to connect to cx18 instances when the module first loaded). This work was sponsored by ONELAN Limited. Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18/cx18-driver.c')
-rw-r--r--drivers/media/video/cx18/cx18-driver.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index 458f5f072374..870c43e6e2f9 100644
--- a/drivers/media/video/cx18/cx18-driver.c
+++ b/drivers/media/video/cx18/cx18-driver.c
@@ -47,6 +47,10 @@
47 setting this to 1 you ensure that radio0 is now also radio1. */ 47 setting this to 1 you ensure that radio0 is now also radio1. */
48int cx18_first_minor; 48int cx18_first_minor;
49 49
50/* Callback for registering extensions */
51int (*cx18_ext_init)(struct cx18 *);
52EXPORT_SYMBOL(cx18_ext_init);
53
50/* add your revision and whatnot here */ 54/* add your revision and whatnot here */
51static struct pci_device_id cx18_pci_tbl[] __devinitdata = { 55static struct pci_device_id cx18_pci_tbl[] __devinitdata = {
52 {PCI_VENDOR_ID_CX, PCI_DEVICE_ID_CX23418, 56 {PCI_VENDOR_ID_CX, PCI_DEVICE_ID_CX23418,
@@ -243,6 +247,9 @@ MODULE_LICENSE("GPL");
243 247
244MODULE_VERSION(CX18_VERSION); 248MODULE_VERSION(CX18_VERSION);
245 249
250/* Forward Declaration */
251static void request_modules(struct cx18 *dev);
252
246/* Generic utility functions */ 253/* Generic utility functions */
247int cx18_msleep_timeout(unsigned int msecs, int intr) 254int cx18_msleep_timeout(unsigned int msecs, int intr)
248{ 255{
@@ -1049,6 +1056,10 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev,
1049 } 1056 }
1050 1057
1051 CX18_INFO("Initialized card: %s\n", cx->card_name); 1058 CX18_INFO("Initialized card: %s\n", cx->card_name);
1059
1060 /* Load cx18 submodules (cx18-alsa) */
1061 request_modules(cx);
1062
1052 return 0; 1063 return 0;
1053 1064
1054free_streams: 1065free_streams:
@@ -1237,6 +1248,29 @@ static void cx18_remove(struct pci_dev *pci_dev)
1237 kfree(cx); 1248 kfree(cx);
1238} 1249}
1239 1250
1251
1252#if defined(CONFIG_MODULES) && defined(MODULE)
1253static void request_module_async(struct work_struct *work)
1254{
1255 struct cx18 *dev=container_of(work, struct cx18, request_module_wk);
1256
1257 /* Make sure cx18-alsa module is loaded */
1258 request_module("cx18-alsa");
1259
1260 /* Initialize cx18-alsa for this instance of the cx18 device */
1261 if (cx18_ext_init != NULL)
1262 cx18_ext_init(dev);
1263}
1264
1265static void request_modules(struct cx18 *dev)
1266{
1267 INIT_WORK(&dev->request_module_wk, request_module_async);
1268 schedule_work(&dev->request_module_wk);
1269}
1270#else
1271#define request_modules(dev)
1272#endif /* CONFIG_MODULES */
1273
1240/* define a pci_driver for card detection */ 1274/* define a pci_driver for card detection */
1241static struct pci_driver cx18_pci_driver = { 1275static struct pci_driver cx18_pci_driver = {
1242 .name = "cx18", 1276 .name = "cx18",