[PATCH 06/10] isdn: push down BKL into ioctl functions

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: John Kacur
Date: Tuesday, April 27, 2010 - 2:18 am

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/isdn/capi/capi.c            |   17 ++++++++++++++---
 drivers/isdn/divert/divert_procfs.c |   19 ++++++++++++++++---
 drivers/isdn/i4l/isdn_common.c      |   18 +++++++++++++++---
 drivers/isdn/mISDN/timerdev.c       |   10 ++++++----
 4 files changed, 51 insertions(+), 13 deletions(-)

diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index 6bc9766..0cabe31 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -787,8 +787,7 @@ capi_poll(struct file *file, poll_table * wait)
 }
 
 static int
-capi_ioctl(struct inode *inode, struct file *file,
-	   unsigned int cmd, unsigned long arg)
+capi_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
 	struct capidev *cdev = file->private_data;
 	capi_ioctl_struct data;
@@ -981,6 +980,18 @@ register_out:
 	}
 }
 
+static long
+capi_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	int ret;
+
+	lock_kernel();
+	ret = capi_ioctl(file, cmd, arg);
+	unlock_kernel();
+
+	return ret;
+}
+
 static int capi_open(struct inode *inode, struct file *file)
 {
 	struct capidev *cdev;
@@ -1026,7 +1037,7 @@ static const struct file_operations capi_fops =
 	.read		= capi_read,
 	.write		= capi_write,
 	.poll		= capi_poll,
-	.bkl_ioctl	= capi_ioctl,
+	.unlocked_ioctl	= capi_unlocked_ioctl,
 	.open		= capi_open,
 	.release	= capi_release,
 };
diff --git a/drivers/isdn/divert/divert_procfs.c b/drivers/isdn/divert/divert_procfs.c
index ae0244f..8084557 100644
--- a/drivers/isdn/divert/divert_procfs.c
+++ b/drivers/isdn/divert/divert_procfs.c
@@ -11,6 +11,7 @@
 
 #include <linux/module.h>
 #include <linux/poll.h>
+#include <linux/smp_lock.h>
 #include <linux/slab.h>
 #ifdef CONFIG_PROC_FS
 #include <linux/proc_fs.h>
@@ -178,8 +179,7 @@ isdn_divert_close(struct inode *ino, struct file *filep)
 /* IOCTL */
 /*********/
 static int
-isdn_divert_ioctl(struct inode *inode, struct file *file,
-		  uint cmd, ulong arg)
+isdn_divert_ioctl(struct file *file, uint cmd, ulong arg)
 {
 	divert_ioctl dioctl;
 	int i;
@@ -258,6 +258,19 @@ isdn_divert_ioctl(struct inode *inode, struct file *file,
 	return copy_to_user((void __user *)arg, &dioctl, sizeof(dioctl)) ? -EFAULT : 0;
 }				/* isdn_divert_ioctl */
 
+static long
+isdn_divert_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	int ret;
+
+	lock_kernel();
+	ret = isdn_divert_ioctl(file, cmd, arg);
+	unlock_kernel();
+
+	return ret;
+}
+
+
 static const struct file_operations isdn_fops =
 {
 	.owner          = THIS_MODULE,
@@ -265,7 +278,7 @@ static const struct file_operations isdn_fops =
 	.read           = isdn_divert_read,
 	.write          = isdn_divert_write,
 	.poll           = isdn_divert_poll,
-	.bkl_ioctl      = isdn_divert_ioctl,
+	.unlocked_ioctl = isdn_divert_unlocked_ioctl,
 	.open           = isdn_divert_open,
 	.release        = isdn_divert_close,                                      
 };
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index 08ba72d..a44cdb4 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -1272,9 +1272,9 @@ isdn_poll(struct file *file, poll_table * wait)
 
 
 static int
-isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
+isdn_ioctl(struct file *file, uint cmd, ulong arg)
 {
-	uint minor = iminor(inode);
+	uint minor = iminor(file->f_path.dentry->d_inode);
 	isdn_ctrl c;
 	int drvidx;
 	int chidx;
@@ -1722,6 +1722,18 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
 #undef cfg
 }
 
+static long
+isdn_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	int ret;
+
+	lock_kernel();
+	ret = isdn_ioctl(file, cmd, arg);
+	unlock_kernel();
+
+	return ret;
+}
+
 /*
  * Open the device code.
  */
@@ -1838,7 +1850,7 @@ static const struct file_operations isdn_fops =
 	.read		= isdn_read,
 	.write		= isdn_write,
 	.poll		= isdn_poll,
-	.bkl_ioctl	= isdn_ioctl,
+	.unlocked_ioctl	= isdn_unlocked_ioctl,
 	.open		= isdn_open,
 	.release	= isdn_close,
 };
diff --git a/drivers/isdn/mISDN/timerdev.c b/drivers/isdn/mISDN/timerdev.c
index fc7d777..c3243c9 100644
--- a/drivers/isdn/mISDN/timerdev.c
+++ b/drivers/isdn/mISDN/timerdev.c
@@ -24,6 +24,7 @@
 #include <linux/miscdevice.h>
 #include <linux/module.h>
 #include <linux/mISDNif.h>
+#include <linux/smp_lock.h>
 #include "core.h"
 
 static u_int	*debug;
@@ -215,9 +216,8 @@ unlock:
 	return ret;
 }
 
-static int
-mISDN_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
-    unsigned long arg)
+static long
+mISDN_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
 {
 	struct mISDNtimerdev	*dev = filep->private_data;
 	int			id, tout, ret = 0;
@@ -226,6 +226,7 @@ mISDN_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
 	if (*debug & DEBUG_TIMER)
 		printk(KERN_DEBUG "%s(%p, %x, %lx)\n", __func__,
 		    filep, cmd, arg);
+	lock_kernel();
 	switch (cmd) {
 	case IMADDTIMER:
 		if (get_user(tout, (int __user *)arg)) {
@@ -257,13 +258,14 @@ mISDN_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
 	default:
 		ret = -EINVAL;
 	}
+	unlock_kernel();
 	return ret;
 }
 
 static const struct file_operations mISDN_fops = {
 	.read		= mISDN_read,
 	.poll		= mISDN_poll,
-	.bkl_ioctl	= mISDN_ioctl,
+	.unlocked_ioctl	= mISDN_ioctl,
 	.open		= mISDN_open,
 	.release	= mISDN_close,
 };
-- 
1.6.6.1

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 06/10] isdn: push down BKL into ioctl functions, John Kacur, (Tue Apr 27, 2:18 am)
[PATCH 08/10] v4l: always use unlocked_ioctl, John Kacur, (Tue Apr 27, 2:18 am)
Re: [PATCH 00/10] bkl: pushdowns from Arnd, and compile fixes, Frederic Weisbecker, (Tue Apr 27, 5:40 am)
Re: [PATCH 00/10] bkl: pushdowns from Arnd, and compile fixes, Frederic Weisbecker, (Tue Apr 27, 5:41 am)
Re: [PATCH 00/10] bkl: pushdowns from Arnd, and compile fixes, Geert Uytterhoeven, (Tue Apr 27, 5:51 am)
[PATCH 0/6] BKL pushdown into ioctl, continued, Arnd Bergmann, (Tue Apr 27, 7:24 am)
[PATCH 1/7] logfs: push down BKL into ioctl function, Arnd Bergmann, (Tue Apr 27, 7:24 am)
[PATCH 2/7] hfsplus: push down BKL into ioctl function, Arnd Bergmann, (Tue Apr 27, 7:24 am)
[PATCH 3/7] cris: push down BKL into some device drivers, Arnd Bergmann, (Tue Apr 27, 7:24 am)
[PATCH 4/7] sn_hwperf: kill BKL usage, Arnd Bergmann, (Tue Apr 27, 7:24 am)
[PATCH 5/7] um/mmapper: remove BKL usage, Arnd Bergmann, (Tue Apr 27, 7:24 am)
[PATCH 6/7] coda/psdev: remove BKL from ioctl function, Arnd Bergmann, (Tue Apr 27, 7:24 am)
[PATCH 7/7] smbfs: push down BKL into ioctl function, Arnd Bergmann, (Tue Apr 27, 7:24 am)
Re: [PATCH 1/7] logfs: push down BKL into ioctl function, Arnd Bergmann, (Tue Apr 27, 7:32 am)
Re: [PATCH 1/7] logfs: push down BKL into ioctl function, Arnd Bergmann, (Tue Apr 27, 8:05 am)
Re: [PATCH 1/7] logfs: push down BKL into ioctl function, Linus Torvalds, (Tue Apr 27, 8:36 am)
Re: [PATCH 1/7] logfs: push down BKL into ioctl function, Arnd Bergmann, (Tue Apr 27, 8:38 am)
Re: [PATCH 3/7] cris: push down BKL into some device drivers, Frederic Weisbecker, (Tue Apr 27, 10:22 am)
Re: [PATCH 1/7] logfs: push down BKL into ioctl function, Frederic Weisbecker, (Tue Apr 27, 12:59 pm)
Re: [PATCH 1/7] logfs: push down BKL into ioctl function, Frederic Weisbecker, (Tue Apr 27, 1:12 pm)
[PATCH] logfs: kill BKL, Arnd Bergmann, (Tue Apr 27, 1:30 pm)
Re: [PATCH 10/10] bkl: Fix-up compile problems as a result ..., Mauro Carvalho Chehab, (Wed Apr 28, 5:24 am)
Re: [PATCH 10/10] bkl: Fix-up compile problems as a result ..., Mauro Carvalho Chehab, (Wed Apr 28, 7:46 am)
Re: [PATCH 00/10] bkl: pushdowns from Arnd, and compile fixes, Frederic Weisbecker, (Wed Apr 28, 2:18 pm)
Re: [PATCH 10/10] bkl: Fix-up compile problems as a result ..., Frederic Weisbecker, (Wed Apr 28, 2:52 pm)
[PATCH 0/5] Pushdown bkl from v4l ioctls, Frederic Weisbecker, (Wed Apr 28, 8:42 pm)
[PATCH 1/5] v4l: Pushdown bkl into video_ioctl2, Frederic Weisbecker, (Wed Apr 28, 8:42 pm)
[PATCH 2/5] v4l: Use video_ioctl2_unlocked from drivers th ..., Frederic Weisbecker, (Wed Apr 28, 8:42 pm)
[PATCH 3/5] v4l: Change users of video_ioctl2 to use unloc ..., Frederic Weisbecker, (Wed Apr 28, 8:42 pm)
[PATCH 4/5] v4l: Pushdown bkl to drivers that implement th ..., Frederic Weisbecker, (Wed Apr 28, 8:42 pm)
[PATCH 5/5] v4l: Remove struct v4l2_file_operations::ioctl, Frederic Weisbecker, (Wed Apr 28, 8:42 pm)
Re: [PATCH 0/5] Pushdown bkl from v4l ioctls, Hans Verkuil, (Wed Apr 28, 11:44 pm)
Re: [PATCH 0/5] Pushdown bkl from v4l ioctls, Laurent Pinchart, (Thu Apr 29, 12:10 am)
Re: [PATCH 0/5] Pushdown bkl from v4l ioctls, Arnd Bergmann, (Thu Apr 29, 12:38 am)
Re: [PATCH 3/7] cris: push down BKL into some device drivers, Jesper Nilsson, (Fri Apr 30, 12:53 am)
Re: [PATCH 0/5] Pushdown bkl from v4l ioctls, Hans Verkuil, (Sat May 1, 2:55 am)
Re: [PATCH 0/5] Pushdown bkl from v4l ioctls, Arnd Bergmann, (Sat May 1, 3:47 am)
Re: [PATCH 0/5] Pushdown bkl from v4l ioctls, Alan Cox, (Sat May 1, 4:11 am)
Re: [PATCH 0/5] Pushdown bkl from v4l ioctls, Frederic Weisbecker, (Sat May 1, 7:58 am)
Re: [PATCH 3/7] cris: push down BKL into some device drivers, Frederic Weisbecker, (Sun May 16, 7:51 pm)
Re: [PATCH] logfs: kill BKL, Frederic Weisbecker, (Wed May 19, 5:51 am)