aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorFrank Schaefer <fschaefer.oss@googlemail.com>2014-01-12 11:24:22 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-01-14 11:31:56 -0500
commitf188da4395b85698d1a55e9fb278ea7e629fbe96 (patch)
treed23e73f3e5b73c7cbdc0ec62d0a0a2c8ed404997 /drivers/media
parent25dd1652331644701a90462782ece6d0d3edf7d0 (diff)
[media] em28xx-v4l: move v4l2_ctrl_handler freeing and v4l2_device unregistration to em28xx_v4l2_fini
v4l2_ctrl_handler_free() and v4l2_device_unregister() are currently only called when the last user closes the device and the device is already disconnected. But that's wrong, we need to call these functions whenever the em28xx-v4l extension is closed and we can already do this if the device is still opened by some users. 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')
-rw-r--r--drivers/media/usb/em28xx/em28xx-video.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index 32b438528fdf..d8ca37abc917 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -1929,8 +1929,11 @@ static int em28xx_v4l2_fini(struct em28xx *dev)
1929 dev->clk = NULL; 1929 dev->clk = NULL;
1930 } 1930 }
1931 1931
1932 v4l2_ctrl_handler_free(&dev->ctrl_handler);
1933 v4l2_device_unregister(&dev->v4l2_dev);
1934
1932 if (dev->users) 1935 if (dev->users)
1933 em28xx_warn("Device is open ! Deregistration and memory deallocation are deferred on close.\n"); 1936 em28xx_warn("Device is open ! Memory deallocation is deferred on last close.\n");
1934 1937
1935 return 0; 1938 return 0;
1936} 1939}
@@ -1957,8 +1960,6 @@ static int em28xx_v4l2_close(struct file *filp)
1957 1960
1958 if (dev->disconnected) { 1961 if (dev->disconnected) {
1959 em28xx_release_resources(dev); 1962 em28xx_release_resources(dev);
1960 v4l2_ctrl_handler_free(&dev->ctrl_handler);
1961 v4l2_device_unregister(&dev->v4l2_dev);
1962 kfree(dev->alt_max_pkt_size_isoc); 1963 kfree(dev->alt_max_pkt_size_isoc);
1963 goto exit; 1964 goto exit;
1964 } 1965 }