From: Arnd Bergmann <arnd@arndb.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Al Viro <viro@zeniv.linux.org.uk>, Jan Blunck <jblunck@suse.de>,
Ingo Molnar <mingo@elte.hu>, John Kacur <jkacur@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH 5/6] v4l: always use unlocked_ioctl
Date: Tue, 27 Apr 2010 00:24:04 +0200 [thread overview]
Message-ID: <1272320645-8671-6-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <201004262112.39906.arnd@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@arndb.de>
---
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 7090699..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,
- .ioctl = v4l2_ioctl,
+ .unlocked_ioctl = v4l2_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = v4l2_compat_ioctl32,
#endif
--
1.7.0.4
next prev parent reply other threads:[~2010-04-26 22:25 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-16 3:56 [GIT PULL] Preparation for BKL'ed ioctl removal Frederic Weisbecker
2010-04-22 0:48 ` [GIT PULL v2] " Frederic Weisbecker
2010-04-24 15:25 ` Frederic Weisbecker
2010-04-24 18:36 ` Linus Torvalds
2010-04-24 18:47 ` Linus Torvalds
2010-04-24 19:54 ` Arnd Bergmann
2010-04-24 20:01 ` Linus Torvalds
2010-04-24 20:40 ` Arnd Bergmann
2010-04-24 22:15 ` Linus Torvalds
2010-04-25 17:39 ` Frederic Weisbecker
2010-04-25 17:49 ` Linus Torvalds
2010-04-25 18:05 ` Frederic Weisbecker
2010-04-26 8:30 ` Arnd Bergmann
2010-04-26 18:08 ` Linus Torvalds
2010-04-26 19:12 ` Arnd Bergmann
2010-04-26 20:36 ` Linus Torvalds
2010-04-26 22:23 ` [PATCH 0/6] Push down BKL into device drivers Arnd Bergmann
2010-04-27 9:14 ` John Kacur
2010-04-26 22:24 ` [PATCH 1/6] dvb: push down BKL into ioctl functions Arnd Bergmann
2010-04-26 22:24 ` [PATCH 2/6] scsi: " Arnd Bergmann
2010-04-26 22:24 ` [PATCH 3/6] isdn: " Arnd Bergmann
2010-04-26 22:24 ` [PATCH 4/6] staging: " Arnd Bergmann
2010-04-27 18:15 ` Frederic Weisbecker
2010-04-27 18:33 ` Greg KH
2010-04-26 22:24 ` Arnd Bergmann [this message]
2010-04-26 22:24 ` [PATCH 6/6] drivers: push down BKL into various drivers Arnd Bergmann
2010-04-26 20:42 ` [GIT PULL v2] Preparation for BKL'ed ioctl removal David Miller
2010-04-26 22:09 ` Frederic Weisbecker
2010-04-26 22:32 ` Linus Torvalds
2010-04-26 23:04 ` Frederic Weisbecker
2010-04-26 7:25 ` Ingo Molnar
2010-04-26 11:29 ` Arnd Bergmann
2010-04-27 9:25 ` Ingo Molnar
2010-04-28 13:21 ` Frederic Weisbecker
2010-04-28 13:37 ` Ingo Molnar
2010-04-28 14:05 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1272320645-8671-6-git-send-email-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=fweisbec@gmail.com \
--cc=jblunck@suse.de \
--cc=jkacur@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®