Mauro,
Pending the complete rethink about how USB devices manage their resources, I am
resubmitting my fix for the PCTV 290e deadlock that occurs with either multiple
adapters or when an adapter is replugged.
For DVB devices, the device lock must now *not* be held when adding/removing
either a device or an extension to the respective lists. (Because
em28xx_init_dvb() will want to take the lock instead).
Conversely, for Audio-Only devices, the device lock *must* be held when
adding/removing either a device or an extension to the respective lists.
Signed-off-by: Chris Rankin <rankincj@xxxxxxxxx>
Cheers,
Chris
--- linux/drivers/media/video/em28xx/em28xx-cards.c.orig 2011-09-24 21:25:01.000000000 +0100
+++ linux/drivers/media/video/em28xx/em28xx-cards.c 2011-09-24 21:37:42.000000000 +0100
@@ -3005,9 +3005,7 @@
goto fail;
}
- mutex_unlock(&dev->lock);
em28xx_init_extension(dev);
- mutex_lock(&dev->lock);
/* Save some power by putting tuner to sleep */
v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0);
@@ -3303,10 +3301,10 @@
em28xx_release_resources(dev);
}
- mutex_unlock(&dev->lock);
-
em28xx_close_extension(dev);
+ mutex_unlock(&dev->lock);
+
if (!dev->users) {
kfree(dev->alt_max_pkt_size);
kfree(dev);