diff options
author | Markus Rechberger <mrechberger@gmail.com> | 2007-02-20 19:32:08 +0100 |
---|---|---|
committer | Markus Rechberger <mrechberger@gmail.com> | 2007-02-20 19:32:08 +0100 |
commit | 1dc1829e27ce5205f46a65e63d9bc7f2bf3dc1a9 (patch) | |
tree | c2022c4594187f3d96dada58bb9aea915d583539 | |
parent | 3f9c226d66a931318cf7bfcf861ce191007013e6 (diff) | |
download | mediapointer-dvb-s2-1dc1829e27ce5205f46a65e63d9bc7f2bf3dc1a9.tar.gz mediapointer-dvb-s2-1dc1829e27ce5205f46a65e63d9bc7f2bf3dc1a9.tar.bz2 |
added support for deferred module requesting to cx88
From: Markus Rechberger <mrechberger@gmail.com>
added support for deferred module requesting to cx88
Signed-off-by: Markus Rechberger <mrechberger@gmail.com>
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-mpeg.c | 44 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88.h | 2 |
2 files changed, 46 insertions, 0 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-mpeg.c b/linux/drivers/media/video/cx88/cx88-mpeg.c index f90a9e7fd..c7b5a2081 100644 --- a/linux/drivers/media/video/cx88/cx88-mpeg.c +++ b/linux/drivers/media/video/cx88/cx88-mpeg.c @@ -56,6 +56,47 @@ MODULE_PARM_DESC(debug,"enable debug messages [mpeg]"); #define mpeg_dbg(level,fmt, arg...) if (debug >= level) \ printk(KERN_DEBUG "%s/2-mpeg: " fmt, core->name, ## arg) +#if defined(CONFIG_MODULES) && defined(MODULE) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) +static void request_module_async(void *ptr){ + struct cx8802_dev *dev=(struct cx8802_dev*)ptr; +#else +static void request_module_async(struct work_struct *work){ + struct cx8802_dev *dev=container_of(work, struct cx8802_dev, request_module_wk); +#endif + switch (cx88_boards[dev->core->board].mpeg) { + case CX88_MPEG_BLACKBIRD: + request_module("cx88-blackbird"); + break; + case CX88_MPEG_DVB: + request_module("cx88-dvb"); + break; + case CX88_BOARD_NONE: + /* reaching this one isn't possible */ + break; + default: + printk("cx88-mpeg.c: WARNING extension [%d] is not supposed to be supported\n",cx88_boards[dev->core->board].mpeg); + } +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +#define request_modules(dev) +#else +static void request_modules(struct cx8802_dev *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 LIST_HEAD(cx8802_devlist); /* ------------------------------------------------------------------ */ @@ -823,6 +864,9 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, /* Maintain a reference so cx88-video can query the 8802 device. */ core->dvbdev = dev; + + /* now autoload cx88-dvb or cx88-blackbird */ + request_modules(dev); return 0; fail_free: diff --git a/linux/drivers/media/video/cx88/cx88.h b/linux/drivers/media/video/cx88/cx88.h index 8a8b58f99..4719046e1 100644 --- a/linux/drivers/media/video/cx88/cx88.h +++ b/linux/drivers/media/video/cx88/cx88.h @@ -514,6 +514,8 @@ struct cx8802_dev { /* List of attached drivers */ struct cx8802_driver drvlist; + struct work_struct request_module_wk; + }; /* ----------------------------------------------------------- */ |