From 9aa6c43d4def3e381b869d7a7b6ce15f21e430b9 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 24 Mar 2007 14:23:50 -0400 Subject: bttv: automatically load dvb-bt8xx for bttv cards with dvb support From: Jarod Wilson 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 Signed-off-by: Michael Krufky --- linux/drivers/media/video/bt8xx/bttv-driver.c | 36 +++++++++++++++++++++++++-- linux/drivers/media/video/bt8xx/bttvp.h | 3 +++ 2 files changed, 37 insertions(+), 2 deletions(-) (limited to 'linux/drivers/media/video') diff --git a/linux/drivers/media/video/bt8xx/bttv-driver.c b/linux/drivers/media/video/bt8xx/bttv-driver.c index 25a61e379..2aad57b5a 100644 --- a/linux/drivers/media/video/bt8xx/bttv-driver.c +++ b/linux/drivers/media/video/bt8xx/bttv-driver.c @@ -176,6 +176,36 @@ static ssize_t show_card(struct class_device *cd, char *buf) static CLASS_DEVICE_ATTR(card, S_IRUGO, show_card, NULL); #endif +/* ----------------------------------------------------------------------- */ +/* dvb auto-load setup */ +#if defined(CONFIG_MODULES) && defined(MODULE) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) +static void request_module_async(void *ptr) +#else +static void request_module_async(struct work_struct *work) +#endif +{ + request_module("dvb-bt8xx"); +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +#define request_modules(dev) +#else +static void request_modules(struct bttv *dev) +{ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) + INIT_WORK(&dev->request_module_wk, request_module_async, (void*)dev); +#else + INIT_WORK(&dev->request_module_wk, request_module_async); +#endif + schedule_work(&dev->request_module_wk); +} +#endif +#else +#define request_modules(dev) +#endif /* CONFIG_MODULES */ + + /* ----------------------------------------------------------------------- */ /* static data */ @@ -4811,9 +4841,11 @@ static int __devinit bttv_probe(struct pci_dev *dev, } #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - /* 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); + } #endif bttv_input_init(btv); diff --git a/linux/drivers/media/video/bt8xx/bttvp.h b/linux/drivers/media/video/bt8xx/bttvp.h index a273c424b..eee6f5ae3 100644 --- a/linux/drivers/media/video/bt8xx/bttvp.h +++ b/linux/drivers/media/video/bt8xx/bttvp.h @@ -452,6 +452,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. */ -- cgit v1.2.3