]> err.no Git - linux-2.6/commitdiff
V4L/DVB (5482): Bttv: automatically load dvb-bt8xx for bttv cards with dvb
authorJarod Wilson <jwilson@redhat.com>
Sat, 24 Mar 2007 18:23:50 +0000 (15:23 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 27 Apr 2007 18:45:14 +0000 (15:45 -0300)
This patch causes the bttv driver to automatically load the dvb-bt8xx module
for bttv/dvb hybrid cards. Successfully tested with a pcHDTV HD-2000 card.
This patch is based on the recent patches to enable autoloading of cx88-dvb,
cx88-blackbird and saa7134-dvb.

Signed-off-by: Jarod Wilson <jwilson@redhat.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/bt8xx/bttv-driver.c
drivers/media/video/bt8xx/bttvp.h

index 5720b77ac9a78deed24e01a422b8b649cfa26187..1c38723d31690577bfed6398a05bb4a112d79255 100644 (file)
@@ -163,6 +163,24 @@ static ssize_t show_card(struct class_device *cd, char *buf)
 }
 static CLASS_DEVICE_ATTR(card, S_IRUGO, show_card, NULL);
 
+/* ----------------------------------------------------------------------- */
+/* dvb auto-load setup                                                     */
+#if defined(CONFIG_MODULES) && defined(MODULE)
+static void request_module_async(struct work_struct *work)
+{
+       request_module("dvb-bt8xx");
+}
+
+static void request_modules(struct bttv *dev)
+{
+       INIT_WORK(&dev->request_module_wk, request_module_async);
+       schedule_work(&dev->request_module_wk);
+}
+#else
+#define request_modules(dev)
+#endif /* CONFIG_MODULES */
+
+
 /* ----------------------------------------------------------------------- */
 /* static data                                                             */
 
@@ -4769,9 +4787,11 @@ static int __devinit bttv_probe(struct pci_dev *dev,
                disclaim_video_lines(btv);
        }
 
-       /* add subdevices */
-       if (bttv_tvcards[btv->c.type].has_dvb)
+       /* add subdevices and autoload dvb-bt8xx if needed */
+       if (bttv_tvcards[btv->c.type].has_dvb) {
                bttv_sub_add_device(&btv->c, "dvb");
+               request_modules(btv);
+       }
 
        bttv_input_init(btv);
 
index ad79b8d534308febeaaee6770825061c28ab692e..8f44f02029beb2592a32d407991f629590d0904b 100644 (file)
@@ -434,6 +434,9 @@ struct bttv {
        unsigned int users;
        struct bttv_fh init;
 
+       /* used to make dvb-bt8xx autoloadable */
+       struct work_struct request_module_wk;
+
        /* Default (0) and current (1) video capturing and overlay
           cropping parameters in bttv_tvnorm.cropcap units. Protected
           by bttv.lock. */