Prev: [PATCH 03/10] bkl: Fix up compile problems in megaraid from bkl push-down
Next: [PATCH] Staging: batman-adv: fixed comments to maintain 80 char limit
From: John Kacur on 27 Apr 2010 05:30 From: Arnd Bergmann <arnd(a)arndb.de> v4l drivers may still use a locked ioctl method, but we now always export an unlocked_ioctl and lock ourselves, so that the ->ioctl file operation can get removed. Signed-off-by: Arnd Bergmann <arnd(a)arndb.de> Fixed merge conflicts that result from having applied Linus's Preparation for BKL'ed ioctl removal patch first. Signed-off-by: John Kacur <jkacur(a)redhat.com> --- drivers/media/video/v4l2-dev.c | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index c48143a..3606694 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c @@ -22,6 +22,7 @@ #include <linux/mm.h> #include <linux/string.h> #include <linux/errno.h> +#include <linux/smp_lock.h> #include <linux/init.h> #include <linux/kmod.h> #include <linux/slab.h> @@ -215,16 +216,21 @@ static unsigned int v4l2_poll(struct file *filp, struct poll_table_struct *poll) return vdev->fops->poll(filp, poll); } -static int v4l2_ioctl(struct inode *inode, struct file *filp, +static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { struct video_device *vdev = video_devdata(filp); + int ret; if (!vdev->fops->ioctl) return -ENOTTY; /* Allow ioctl to continue even if the device was unregistered. Things like dequeueing buffers might still be useful. */ - return vdev->fops->ioctl(filp, cmd, arg); + lock_kernel(); + ret = vdev->fops->ioctl(filp->f_path.dentry->d_inode, filp, cmd, arg); + unlock_kernel(); + + return ret; } static long v4l2_unlocked_ioctl(struct file *filp, @@ -323,6 +329,11 @@ static const struct file_operations v4l2_unlocked_fops = { .llseek = no_llseek, }; +/* + * Note: this should not be needed, just check + * both pointers in v4l2_ioctl, or kill + * fops->ioctl. -arnd + */ static const struct file_operations v4l2_fops = { .owner = THIS_MODULE, .read = v4l2_read, @@ -330,7 +341,7 @@ static const struct file_operations v4l2_fops = { .open = v4l2_open, .get_unmapped_area = v4l2_get_unmapped_area, .mmap = v4l2_mmap, - .bkl_ioctl = v4l2_ioctl, + .unlocked_ioctl = v4l2_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = v4l2_compat_ioctl32, #endif -- 1.6.6.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |