Merge branch 'for-2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
[cascardo/linux.git] / drivers / media / video / em28xx / em28xx-cards.c
index 8af302b..099d5df 100644 (file)
@@ -2690,8 +2690,14 @@ static void request_modules(struct em28xx *dev)
        INIT_WORK(&dev->request_module_wk, request_module_async);
        schedule_work(&dev->request_module_wk);
 }
+
+static void flush_request_modules(struct em28xx *dev)
+{
+       flush_work_sync(&dev->request_module_wk);
+}
 #else
 #define request_modules(dev)
+#define flush_request_modules(dev)
 #endif /* CONFIG_MODULES */
 
 /*
@@ -3118,6 +3124,8 @@ static void em28xx_usb_disconnect(struct usb_interface *interface)
 
        em28xx_info("disconnecting %s\n", dev->vdev->name);
 
+       flush_request_modules(dev);
+
        /* wait until all current v4l2 io is finished then deallocate
           resources */
        mutex_lock(&dev->lock);