diff options
author | Frank Schaefer <fschaefer.oss@googlemail.com> | 2014-01-12 16:24:24 (GMT) |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-01-14 16:32:04 (GMT) |
commit | 5a620c7c1cd74064e75a525738e9410b8851fa96 (patch) | |
tree | 4e67bf85f8ed7561c6a35eb083ef7b47d8d695fe /drivers/media/usb/em28xx/em28xx-cards.c | |
parent | f188da4395b85698d1a55e9fb278ea7e629fbe96 (diff) | |
download | linux-5a620c7c1cd74064e75a525738e9410b8851fa96.tar.xz |
[media] em28xx: always call em28xx_release_resources() in the usb disconnect handler
When the usb device is disconnected, the resources are no longer available,
so there is no reason to keep them registered.
This will also fix the various sysfs group removal warnings which we can see
since kernel 3.13.
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/usb/em28xx/em28xx-cards.c')
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-cards.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index fa35a30..3b332d5 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -2876,6 +2876,8 @@ void em28xx_release_resources(struct em28xx *dev) { /*FIXME: I2C IR should be disconnected */ + mutex_lock(&dev->lock); + if (dev->def_i2c_bus) em28xx_i2c_unregister(dev, 1); em28xx_i2c_unregister(dev, 0); @@ -2884,6 +2886,8 @@ void em28xx_release_resources(struct em28xx *dev) /* Mark device as unused */ clear_bit(dev->devno, &em28xx_devused); + + mutex_unlock(&dev->lock); }; EXPORT_SYMBOL_GPL(em28xx_release_resources); @@ -3386,13 +3390,7 @@ static void em28xx_usb_disconnect(struct usb_interface *interface) em28xx_close_extension(dev); - /* NOTE: must be called BEFORE the resources are released */ - - mutex_lock(&dev->lock); - if (!dev->users) - em28xx_release_resources(dev); - - mutex_unlock(&dev->lock); + em28xx_release_resources(dev); if (!dev->users) { kfree(dev->alt_max_pkt_size_isoc); |