mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: Arnd Bergmann <arnd@arndb.de>, lkml <linux-kernel@vger.kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jan Blunck <jblunck@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	John Kacur <jkacur@redhat.com>
Subject: [PATCH 07/10] staging: push down BKL into ioctl functions
Date: Tue, 27 Apr 2010 11:18:15 +0200	[thread overview]
Message-ID: <1272359898-32020-8-git-send-email-jkacur@redhat.com> (raw)
In-Reply-To: <1272359898-32020-1-git-send-email-jkacur@redhat.com>

From: Arnd Bergmann <arnd@arndb.de>

Signed-off-by: Arnd Bergmann <arnd@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@redhat.com>
---
 drivers/staging/crystalhd/crystalhd_lnx.c |   13 +++++++++----
 drivers/staging/dt3155/dt3155_drv.c       |   24 ++++++++++++++++++------
 drivers/staging/poch/poch.c               |   17 +++++++++++++++--
 drivers/staging/vme/devices/vme_user.c    |   18 +++++++++++++++---
 4 files changed, 57 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/crystalhd/crystalhd_lnx.c b/drivers/staging/crystalhd/crystalhd_lnx.c
index 3d6b773..3291e14 100644
--- a/drivers/staging/crystalhd/crystalhd_lnx.c
+++ b/drivers/staging/crystalhd/crystalhd_lnx.c
@@ -16,6 +16,7 @@
 ***************************************************************************/
 
 #include <linux/version.h>
+#include <linux/smp_lock.h>
 #include <linux/slab.h>
 
 #include "crystalhd_lnx.h"
@@ -261,12 +262,12 @@ static int chd_dec_api_cmd(struct crystalhd_adp *adp, unsigned long ua,
 }
 
 /* API interfaces */
-static int chd_dec_ioctl(struct inode *in, struct file *fd,
-			 unsigned int cmd, unsigned long ua)
+static long chd_dec_ioctl(struct file *fd, unsigned int cmd, unsigned long ua)
 {
 	struct crystalhd_adp *adp = chd_get_adp();
 	crystalhd_cmd_proc cproc;
 	struct crystalhd_user *uc;
+	int ret;
 
 	if (!adp || !fd) {
 		BCMLOG_ERR("Invalid adp\n");
@@ -279,13 +280,17 @@ static int chd_dec_ioctl(struct inode *in, struct file *fd,
 		return -ENODATA;
 	}
 
+	lock_kernel();
 	cproc = crystalhd_get_cmd_proc(&adp->cmds, cmd, uc);
 	if (!cproc) {
 		BCMLOG_ERR("Unhandled command: %d\n", cmd);
+		unlock_kernel();
 		return -EINVAL;
 	}
 
-	return chd_dec_api_cmd(adp, ua, uc->uid, cmd, cproc);
+	ret = chd_dec_api_cmd(adp, ua, uc->uid, cmd, cproc);
+	unlock_kernel();
+	return ret;
 }
 
 static int chd_dec_open(struct inode *in, struct file *fd)
@@ -345,7 +350,7 @@ static int chd_dec_close(struct inode *in, struct file *fd)
 
 static const struct file_operations chd_dec_fops = {
 	.owner   = THIS_MODULE,
-	.bkl_ioctl   = chd_dec_ioctl,
+	.unlocked_ioctl = chd_dec_ioctl,
 	.open    = chd_dec_open,
 	.release = chd_dec_close,
 };
diff --git a/drivers/staging/dt3155/dt3155_drv.c b/drivers/staging/dt3155/dt3155_drv.c
index 09fb197..7e6095f 100644
--- a/drivers/staging/dt3155/dt3155_drv.c
+++ b/drivers/staging/dt3155/dt3155_drv.c
@@ -63,6 +63,7 @@ extern void printques(int);
 #include <linux/types.h>
 #include <linux/poll.h>
 #include <linux/sched.h>
+#include <linux/smp_lock.h>
 
 #include <asm/io.h>
 #include <asm/uaccess.h>
@@ -835,6 +836,17 @@ static unsigned int dt3155_poll (struct file * filp, poll_table *wait)
   return 0;
 }
 
+static long
+dt3155_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	int ret;
+
+	lock_kernel();
+	ret = dt3155_ioctl(file->f_path.dentry->d_inode, file, cmd, arg);
+	unlock_kernel();
+
+	return ret;
+}
 
 /*****************************************************
  * file operations supported by DT3155 driver
@@ -842,12 +854,12 @@ static unsigned int dt3155_poll (struct file * filp, poll_table *wait)
  *  register_chrdev
  *****************************************************/
 static struct file_operations dt3155_fops = {
-  read:		dt3155_read,
-  bkl_ioctl:	dt3155_ioctl,
-  mmap:		dt3155_mmap,
-  poll:         dt3155_poll,
-  open:		dt3155_open,
-  release:	dt3155_close
+	.read		= dt3155_read,
+	.unlocked_ioctl	= dt3155_unlocked_ioctl,
+	.mmap		= dt3155_mmap,
+	.poll		= dt3155_poll,
+	.open		= dt3155_open,
+	.release	= dt3155_close
 };
 
 
diff --git a/drivers/staging/poch/poch.c b/drivers/staging/poch/poch.c
index edc8c58..bf46e29 100644
--- a/drivers/staging/poch/poch.c
+++ b/drivers/staging/poch/poch.c
@@ -16,6 +16,7 @@
 #include <linux/sysfs.h>
 #include <linux/poll.h>
 #include <linux/idr.h>
+#include <linux/smp_lock.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
 #include <linux/ioctl.h>
@@ -911,7 +912,7 @@ static unsigned int poch_poll(struct file *filp, poll_table *pt)
 	return ret;
 }
 
-static int poch_ioctl(struct inode *inode, struct file *filp,
+static int poch_ioctl(struct file *filp,
 		      unsigned int cmd, unsigned long arg)
 {
 	struct channel_info *channel = filp->private_data;
@@ -1033,11 +1034,23 @@ static int poch_ioctl(struct inode *inode, struct file *filp,
 	return 0;
 }
 
+static long
+poch_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	int ret;
+
+	lock_kernel();
+	ret = poch_ioctl(file, cmd, arg);
+	unlock_kernel();
+
+	return ret;
+}
+
 static struct file_operations poch_fops = {
 	.owner = THIS_MODULE,
 	.open = poch_open,
 	.release = poch_release,
-	.bkl_ioctl = poch_ioctl,
+	.poch_ioctl = poch_unlocked_ioctl,
 	.poll = poch_poll,
 	.mmap = poch_mmap
 };
diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c
index 7ba7149..bc16fc0 100644
--- a/drivers/staging/vme/devices/vme_user.c
+++ b/drivers/staging/vme/devices/vme_user.c
@@ -31,6 +31,7 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/syscalls.h>
+#include <linux/smp_lock.h>
 #include <linux/types.h>
 
 #include <asm/io.h>
@@ -130,8 +131,7 @@ static int vme_user_release(struct inode *, struct file *);
 static ssize_t vme_user_read(struct file *, char *, size_t, loff_t *);
 static ssize_t vme_user_write(struct file *, const char *, size_t, loff_t *);
 static loff_t vme_user_llseek(struct file *, loff_t, int);
-static int vme_user_ioctl(struct inode *, struct file *, unsigned int,
-	unsigned long);
+static long vme_user_unlocked_ioctl(struct file *, unsigned int, unsigned long);
 
 static int __init vme_user_probe(struct device *, int, int);
 static int __exit vme_user_remove(struct device *, int, int);
@@ -142,7 +142,7 @@ static struct file_operations vme_user_fops = {
         .read = vme_user_read,
         .write = vme_user_write,
         .llseek = vme_user_llseek,
-        .bkl_ioctl = vme_user_ioctl,
+        .unlocked_ioctl = vme_user_unlocked_ioctl,
 };
 
 
@@ -555,6 +555,18 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
 	return -EINVAL;
 }
 
+static long
+vme_user_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	int ret;
+
+	lock_kernel();
+	ret = vme_user_ioctl(file->f_path.dentry->d_inode, file, cmd, arg);
+	unlock_kernel();
+
+	return ret;
+}
+
 
 /*
  * Unallocate a previously allocated buffer
-- 
1.6.6.1


  parent reply	other threads:[~2010-04-27  9:19 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-27  9:18 [PATCH 00/10] bkl: pushdowns from Arnd, and compile fixes John Kacur
2010-04-27  9:18 ` [PATCH 01/10] dvb: push down BKL into ioctl functions John Kacur
2010-04-27  9:18 ` [PATCH 02/10] scsi: " John Kacur
2010-04-27  9:18 ` [PATCH 03/10] bkl: Fix up compile problems in megaraid from bkl push-down John Kacur
2010-04-27  9:18 ` [PATCH 04/10] bkl: Fix missing inode tw_chrdev_ioctl due to bkl pushdown John Kacur
2010-04-27  9:18 ` [PATCH 05/10] bkl: Fix missing inode in twl_chrdev_ioctl resulting from " John Kacur
2010-04-27  9:18 ` [PATCH 06/10] isdn: push down BKL into ioctl functions John Kacur
2010-04-27  9:18 ` John Kacur [this message]
2010-04-27  9:18 ` [PATCH 08/10] v4l: always use unlocked_ioctl John Kacur
2010-04-27  9:18 ` [PATCH 09/10] drivers: push down BKL into various drivers John Kacur
2010-04-27  9:18 ` [PATCH 10/10] bkl: Fix-up compile problems as a result of the bkl-pushdown John Kacur
2010-04-27 11:17   ` Arnd Bergmann
2010-04-27 11:54     ` John Kacur
2010-04-27 13:03       ` Arnd Bergmann
2010-04-28 12:24         ` Mauro Carvalho Chehab
2010-04-28 12:37           ` Hans Verkuil
2010-04-28 13:02             ` Laurent Pinchart
2010-04-28 14:46               ` Mauro Carvalho Chehab
2010-04-28 14:55         ` Linus Torvalds
2010-04-28 21:52           ` Frederic Weisbecker
2010-04-29  3:42           ` [PATCH 0/5] Pushdown bkl from v4l ioctls Frederic Weisbecker
2010-04-29  6:44             ` Hans Verkuil
2010-04-29  7:10               ` Laurent Pinchart
2010-04-29  7:38                 ` Arnd Bergmann
2010-05-01  9:55                 ` Hans Verkuil
2010-05-01 10:47                   ` Arnd Bergmann
2010-05-01 14:58                   ` Frederic Weisbecker
2010-05-01 11:11               ` Alan Cox
2010-04-29  3:42           ` [PATCH 1/5] v4l: Pushdown bkl into video_ioctl2 Frederic Weisbecker
2010-04-29  3:42           ` [PATCH 2/5] v4l: Use video_ioctl2_unlocked from drivers that don't want the bkl Frederic Weisbecker
2010-04-29  3:42           ` [PATCH 3/5] v4l: Change users of video_ioctl2 to use unlocked_ioctl Frederic Weisbecker
2010-04-29  3:42           ` [PATCH 4/5] v4l: Pushdown bkl to drivers that implement their own ioctl Frederic Weisbecker
2010-04-29  3:42           ` [PATCH 5/5] v4l: Remove struct v4l2_file_operations::ioctl Frederic Weisbecker
2010-04-27 11:31 ` [PATCH 00/10] bkl: pushdowns from Arnd, and compile fixes Arnd Bergmann
2010-04-27 12:19   ` John Kacur
2010-04-27 12:41     ` Frederic Weisbecker
2010-04-27 14:24     ` [PATCH 0/6] BKL pushdown into ioctl, continued Arnd Bergmann
2010-04-27 14:24     ` [PATCH 1/7] logfs: push down BKL into ioctl function Arnd Bergmann
2010-04-27 14:32       ` Arnd Bergmann
2010-04-27 14:58       ` Jörn Engel
2010-04-27 15:05         ` Arnd Bergmann
2010-04-27 15:09           ` Jörn Engel
2010-04-27 15:27             ` John Kacur
2010-04-27 15:32               ` Jörn Engel
2010-04-27 15:38                 ` Arnd Bergmann
2010-04-27 20:12                   ` Frederic Weisbecker
2010-04-27 20:30                     ` [PATCH] logfs: kill BKL Arnd Bergmann
2010-05-19 12:51                       ` Frederic Weisbecker
2010-04-27 15:36               ` [PATCH 1/7] logfs: push down BKL into ioctl function Linus Torvalds
2010-04-27 16:29                 ` John Kacur
2010-04-27 19:59       ` Frederic Weisbecker
2010-04-27 14:24     ` [PATCH 2/7] hfsplus: " Arnd Bergmann
2010-04-27 14:24     ` [PATCH 3/7] cris: push down BKL into some device drivers Arnd Bergmann
2010-04-27 17:22       ` Frederic Weisbecker
2010-04-30  7:53       ` Jesper Nilsson
2010-05-17  2:51         ` Frederic Weisbecker
2010-04-27 14:24     ` [PATCH 4/7] sn_hwperf: kill BKL usage Arnd Bergmann
2010-04-27 14:24     ` [PATCH 5/7] um/mmapper: remove " Arnd Bergmann
2010-04-27 14:24     ` [PATCH 6/7] coda/psdev: remove BKL from ioctl function Arnd Bergmann
2010-04-27 14:24     ` [PATCH 7/7] smbfs: push down BKL into " Arnd Bergmann
2010-04-27 12:40   ` [PATCH 00/10] bkl: pushdowns from Arnd, and compile fixes Frederic Weisbecker
2010-04-27 12:51   ` Geert Uytterhoeven
2010-04-28 21:18 ` Frederic Weisbecker

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=1272359898-32020-8-git-send-email-jkacur@redhat.com \
    --to=jkacur@redhat.com \
    --cc=arnd@arndb.de \
    --cc=fweisbec@gmail.com \
    --cc=jblunck@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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®