Merge branch 'for-2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
[cascardo/linux.git] / drivers / media / video / bt8xx / bttv-driver.c
index 849cd17..91399c9 100644 (file)
@@ -189,8 +189,14 @@ static void request_modules(struct bttv *dev)
        INIT_WORK(&dev->request_module_wk, request_module_async);
        schedule_work(&dev->request_module_wk);
 }
+
+static void flush_request_modules(struct bttv *dev)
+{
+       flush_work_sync(&dev->request_module_wk);
+}
 #else
 #define request_modules(dev)
+#define flush_request_modules(dev)
 #endif /* CONFIG_MODULES */
 
 
@@ -4429,6 +4435,9 @@ static void __devexit bttv_remove(struct pci_dev *pci_dev)
        if (bttv_verbose)
                printk("bttv%d: unloading\n",btv->c.nr);
 
+       if (bttv_tvcards[btv->c.type].has_dvb)
+               flush_request_modules(btv);
+
        /* shutdown everything (DMA+IRQs) */
        btand(~15, BT848_GPIO_DMA_CTL);
        btwrite(0, BT848_INT_MASK);