diff options
author | Arnd Bergmann <arnd@arndb.de> | 2010-10-27 08:30:32 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-11-08 19:35:57 -0500 |
commit | 0edf2e5e2bd0ae7689ce8a57ae3c87cc1f0c6548 (patch) | |
tree | 3a7cfbea0c456f44b79db2985d8e6e7085fa4152 /drivers/media/video/v4l2-dev.c | |
parent | 2c2742da1e590f426e8d85ce4e33b69142245fb8 (diff) |
[media] v4l: kill the BKL
All of the hard problems for BKL removal appear to be solved in the
v4l-dvb/master tree. This removes the BKL from the various open
functions that do not need it, or only use it to protect an
open count.
The zoran driver is nontrivial in this regard, so I introduce
a new mutex that locks both the open/release and the ioctl
functions. Someone with access to the hardware can probably
improve that by using the existing lock in all cases.
Finally, all drivers that still use the locked version of the
ioctl function now get called under a new mutex instead of
the BKL.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/v4l2-dev.c')
-rw-r--r-- | drivers/media/video/v4l2-dev.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 0ca7978654b5..03f7f4670e9b 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/kmod.h> | 26 | #include <linux/kmod.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/smp_lock.h> | ||
29 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
30 | #include <asm/system.h> | 29 | #include <asm/system.h> |
31 | 30 | ||
@@ -247,10 +246,12 @@ static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
247 | mutex_unlock(vdev->lock); | 246 | mutex_unlock(vdev->lock); |
248 | } else if (vdev->fops->ioctl) { | 247 | } else if (vdev->fops->ioctl) { |
249 | /* TODO: convert all drivers to unlocked_ioctl */ | 248 | /* TODO: convert all drivers to unlocked_ioctl */ |
250 | lock_kernel(); | 249 | static DEFINE_MUTEX(v4l2_ioctl_mutex); |
250 | |||
251 | mutex_lock(&v4l2_ioctl_mutex); | ||
251 | if (video_is_registered(vdev)) | 252 | if (video_is_registered(vdev)) |
252 | ret = vdev->fops->ioctl(filp, cmd, arg); | 253 | ret = vdev->fops->ioctl(filp, cmd, arg); |
253 | unlock_kernel(); | 254 | mutex_unlock(&v4l2_ioctl_mutex); |
254 | } else | 255 | } else |
255 | ret = -ENOTTY; | 256 | ret = -ENOTTY; |
256 | 257 | ||