Skip to contentSkip to conversation

USB: BKL removal

PATCH In review Arnd Bergmann 6 participants 15 messages Jun 1, 2010 – Jun 29, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover USB: BKL removal

Hi Greg,

Here goes another series of BKL removal patches, mostly from Andi. There are some minor drivers left in the USB subsystem that someone should take care of, but this series at least gets to the point where USB works with the BKL disabled.

Please apply to your USB next tree.

Arnd

Andi Kleen (4):
USB-BKL: Remove lock_kernel in usbfs update_sb()
USB-BKL: Convert usb_driver ioctl to unlocked_ioctl
USB-BKL: Remove BKL use for usb serial driver probing
USB-BKL: Remove BKL use in uhci-debug

Arnd Bergmann (2):
usb/gadget: Do not take BKL for gadget->ops->ioctl usb/mon: kill BKL usage

 drivers/usb/core/devio.c        |    7 ++-----
 drivers/usb/core/hub.c          |    3 ++-
 drivers/usb/core/inode.c        |    4 ----
 drivers/usb/gadget/f_fs.c       |    2 --
 drivers/usb/gadget/inode.c      |    6 ++----
 drivers/usb/host/uhci-debug.c   |   17 ++++++-----------
 drivers/usb/misc/usbtest.c      |    3 ++-
 drivers/usb/mon/mon_bin.c       |   22 ++--------------------
 drivers/usb/serial/usb-serial.c |   30 ++++++++++++++----------------
 include/linux/usb.h             |    2 +-
 10 files changed, 31 insertions(+), 65 deletions(-)
#1 lore raw

PATCH 1/6 USB-BKL: Remove lock_kernel in usbfs update_sb()

From: Andi Kleen <[email protected]>

The code this is attempting to lock against does not use the BKL, so it's not needed.

Most likely this code is still broken/racy (Al Viro also thinks so), but removing the BKL should not make it worse than before.

---
 drivers/usb/core/inode.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/usb/core/inode.c +0 -4
index 1a27618..095fa53 100644
@@ -265,13 +265,9 @@ static int remount(struct super_block *sb, int *flags, char *data)
 		return -EINVAL;
 	}
 
-	lock_kernel();
-
 	if (usbfs_mount && usbfs_mount->mnt_sb)
 		update_sb(usbfs_mount->mnt_sb);
 
-	unlock_kernel();
-
 	return 0;
 }
 
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 2/6 USB-BKL: Convert usb_driver ioctl to unlocked_ioctl

In reply to Arnd Bergmann

From: Andi Kleen <[email protected]>

And audit all the users. None needed the BKL. That was easy because there was only very few around.

Tested with allmodconfig build on x86-64

---
 drivers/usb/core/devio.c   |    7 ++-----
 drivers/usb/core/hub.c     |    3 ++-
 drivers/usb/misc/usbtest.c |    3 ++-
 include/linux/usb.h        |    2 +-
 4 files changed, 7 insertions(+), 8 deletions(-)
drivers/usb/core/devio.c +2 -5
index c2f62a3..f1aaff6 100644
@@ -1668,13 +1668,10 @@ static int proc_ioctl(struct dev_state *ps, struct usbdevfs_ioctl *ctl)
 	default:
 		if (intf->dev.driver)
 			driver = to_usb_driver(intf->dev.driver);
-		if (driver == NULL || driver->ioctl == NULL) {
+		if (driver == NULL || driver->unlocked_ioctl == NULL) {
 			retval = -ENOTTY;
 		} else {
-			/* keep API that guarantees BKL */
-			lock_kernel();
-			retval = driver->ioctl(intf, ctl->ioctl_code, buf);
-			unlock_kernel();
+			retval = driver->unlocked_ioctl(intf, ctl->ioctl_code, buf);
 			if (retval == -ENOIOCTLCMD)
 				retval = -ENOTTY;
 		}
drivers/usb/core/hub.c +2 -1
index 83e7bbb..d0e77d4 100644
@@ -1294,6 +1294,7 @@ descriptor_error:
 	return -ENODEV;
 }
 
+/* No BKL needed */
 static int
 hub_ioctl(struct usb_interface *intf, unsigned int code, void *user_data)
 {
@@ -3461,7 +3462,7 @@ static struct usb_driver hub_driver = {
 	.reset_resume =	hub_reset_resume,
 	.pre_reset =	hub_pre_reset,
 	.post_reset =	hub_post_reset,
-	.ioctl =	hub_ioctl,
+	.unlocked_ioctl = hub_ioctl,
 	.id_table =	hub_id_table,
 	.supports_autosuspend =	1,
 };
drivers/usb/misc/usbtest.c +2 -1
index 16dffe9..0cfbd78 100644
@@ -1548,6 +1548,7 @@ fail:
  * off just killing the userspace task and waiting for it to exit.
  */
 
+/* No BKL needed */
 static int
 usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
 {
@@ -2170,7 +2171,7 @@ static struct usb_driver usbtest_driver = {
 	.name =		"usbtest",
 	.id_table =	id_table,
 	.probe =	usbtest_probe,
-	.ioctl =	usbtest_ioctl,
+	.unlocked_ioctl = usbtest_ioctl,
 	.disconnect =	usbtest_disconnect,
 	.suspend =	usbtest_suspend,
 	.resume =	usbtest_resume,
include/linux/usb.h +1 -1
index d5922a8..e6cbc34 100644
@@ -843,7 +843,7 @@ struct usb_driver {
 
 	void (*disconnect) (struct usb_interface *intf);
 
-	int (*ioctl) (struct usb_interface *intf, unsigned int code,
+	int (*unlocked_ioctl) (struct usb_interface *intf, unsigned int code,
 			void *buf);
 
 	int (*suspend) (struct usb_interface *intf, pm_message_t message);
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH 3/6 USB-BKL: Remove BKL use for usb serial driver probing

In reply to Arnd Bergmann

From: Andi Kleen <[email protected]>

The usb serial driver initialization tried to use the BKL to stop driver modules from unloading, but that didn't work anyways.

There was already some code to do proper try_module_get, but it was conditional on having a new probe interface. I checked all the low level drivers and they all have proper .owner = THIS_MODULE, so it's ok to always use.

The other problem was the usb_serial_driver_list needing protection by a lock. This was broken anyways because unregister did not necessarily have the BKL.

I extended the extending table_lock mutex to protect this case too.

With these changes the BKL can be removed here.

---
 drivers/usb/serial/usb-serial.c |   30 ++++++++++++++----------------
 1 files changed, 14 insertions(+), 16 deletions(-)
drivers/usb/serial/usb-serial.c +14 -16
index 941c2d4..443468e 100644
@@ -653,6 +653,7 @@ exit:
 	return id;
 }
 
+/* Caller must hold table_lock */
 static struct usb_serial_driver *search_serial_device(
 					struct usb_interface *iface)
 {
@@ -718,17 +719,23 @@ int usb_serial_probe(struct usb_interface *interface,
 	int num_ports = 0;
 	int max_endpoints;
 
-	lock_kernel(); /* guard against unloading a serial driver module */
+	mutex_lock(&table_lock);
 	type = search_serial_device(interface);
 	if (!type) {
-		unlock_kernel();
+		mutex_unlock(&table_lock);
 		dbg("none matched");
 		return -ENODEV;
 	}
 
+	if (!try_module_get(type->driver.owner)) {
+		mutex_unlock(&table_lock);
+		dev_err(&interface->dev, "module get failed, exiting\n");
+		return -EIO;
+	}
+	mutex_unlock(&table_lock);
+
 	serial = create_serial(dev, interface, type);
 	if (!serial) {
-		unlock_kernel();
 		dev_err(&interface->dev, "%s - out of memory\n", __func__);
 		return -ENOMEM;
 	}
@@ -737,20 +744,11 @@ int usb_serial_probe(struct usb_interface *interface,
 	if (type->probe) {
 		const struct usb_device_id *id;
 
-		if (!try_module_get(type->driver.owner)) {
-			unlock_kernel();
-			dev_err(&interface->dev,
-				"module get failed, exiting\n");
-			kfree(serial);
-			return -EIO;
-		}
-
 		id = get_iface_id(type, interface);
 		retval = type->probe(serial, id);
 		module_put(type->driver.owner);
 
 		if (retval) {
-			unlock_kernel();
 			dbg("sub driver rejected device");
 			kfree(serial);
 			return retval;
@@ -822,7 +820,6 @@ int usb_serial_probe(struct usb_interface *interface,
 		 * properly during a later invocation of usb_serial_probe
 		 */
 		if (num_bulk_in == 0 || num_bulk_out == 0) {
-			unlock_kernel();
 			dev_info(&interface->dev, "PL-2303 hack: descriptors matched but endpoints did not\n");
 			kfree(serial);
 			return -ENODEV;
@@ -835,7 +832,6 @@ int usb_serial_probe(struct usb_interface *interface,
 	if (type == &usb_serial_generic_device) {
 		num_ports = num_bulk_out;
 		if (num_ports == 0) {
-			unlock_kernel();
 			dev_err(&interface->dev,
 			    "Generic device with no bulk out, not allowed.\n");
 			kfree(serial);
@@ -847,7 +843,6 @@ int usb_serial_probe(struct usb_interface *interface,
 		/* if this device type has a calc_num_ports function, call it */
 		if (type->calc_num_ports) {
 			if (!try_module_get(type->driver.owner)) {
-				unlock_kernel();
 				dev_err(&interface->dev,
 					"module get failed, exiting\n");
 				kfree(serial);
@@ -878,7 +873,6 @@ int usb_serial_probe(struct usb_interface *interface,
 	max_endpoints = max(max_endpoints, num_interrupt_out);
 	max_endpoints = max(max_endpoints, (int)serial->num_ports);
 	serial->num_port_pointers = max_endpoints;
-	unlock_kernel();
 
 	dbg("%s - setting up %d port structures for this device",
 						__func__, max_endpoints);
@@ -1349,6 +1343,7 @@ int usb_serial_register(struct usb_serial_driver *driver)
 		driver->description = driver->driver.name;
 
 	/* Add this device to our list of devices */
+	mutex_lock(&table_lock);
 	list_add(&driver->driver_list, &usb_serial_driver_list);
 
 	retval = usb_serial_bus_register(driver);
@@ -1360,6 +1355,7 @@ int usb_serial_register(struct usb_serial_driver *driver)
 		printk(KERN_INFO "USB Serial support registered for %s\n",
 						driver->description);
 
+	mutex_unlock(&table_lock);
 	return retval;
 }
 EXPORT_SYMBOL_GPL(usb_serial_register);
@@ -1370,8 +1366,10 @@ void usb_serial_deregister(struct usb_serial_driver *device)
 	/* must be called with BKL held */
 	printk(KERN_INFO "USB Serial deregistering driver %s\n",
 	       device->description);
+	mutex_lock(&table_lock);
 	list_del(&device->driver_list);
 	usb_serial_bus_deregister(device);
+	mutex_unlock(&table_lock);
 }
 EXPORT_SYMBOL_GPL(usb_serial_deregister);
 
Signature · 1 line
1.7.0.4
#4 lore raw

PATCH 4/6 USB-BKL: Remove BKL use in uhci-debug

In reply to Arnd Bergmann

From: Andi Kleen <[email protected]>

BKL was not really needed, just came from earlier push downs.

The only part that's a bit dodgy is the lseek function. Would need another lock or atomic access to fpos on 32bit? Better to have a libfs lseek

---
 drivers/usb/host/uhci-debug.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)
drivers/usb/host/uhci-debug.c +6 -11
index 98cf0b2..b0cf4f8 100644
@@ -495,18 +495,16 @@ static int uhci_debug_open(struct inode *inode, struct file *file)
 {
 	struct uhci_hcd *uhci = inode->i_private;
 	struct uhci_debug *up;
-	int ret = -ENOMEM;
 	unsigned long flags;
 
-	lock_kernel();
 	up = kmalloc(sizeof(*up), GFP_KERNEL);
 	if (!up)
-		goto out;
+		return -ENOMEM;
 
 	up->data = kmalloc(MAX_OUTPUT, GFP_KERNEL);
 	if (!up->data) {
 		kfree(up);
-		goto out;
+		return -ENOMEM;
 	}
 
 	up->size = 0;
@@ -517,10 +515,7 @@ static int uhci_debug_open(struct inode *inode, struct file *file)
 
 	file->private_data = up;
 
-	ret = 0;
-out:
-	unlock_kernel();
-	return ret;
+	return 0;
 }
 
 static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence)
@@ -528,9 +523,9 @@ static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence)
 	struct uhci_debug *up;
 	loff_t new = -1;
 
-	lock_kernel();
 	up = file->private_data;
 
+	/* XXX: atomic 64bit seek access, but that needs to be fixed in the VFS */
 	switch (whence) {
 	case 0:
 		new = off;
@@ -539,11 +534,11 @@ static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence)
 		new = file->f_pos + off;
 		break;
 	}
+
+	/* XXX: Can size shrink? */
 	if (new < 0 || new > up->size) {
-		unlock_kernel();
 		return -EINVAL;
 	}
-	unlock_kernel();
 	return (file->f_pos = new);
 }
 
Signature · 1 line
1.7.0.4
#5 lore raw

Re: [PATCH 4/6] USB-BKL: Remove BKL use in uhci-debug

Hello.

Quoted 9 lines · Arnd Bergmann

From: Andi Kleen <[email protected]>

BKL was not really needed, just came from earlier push downs.

The only part that's a bit dodgy is the lseek function. Would need another lock or atomic access to fpos on 32bit? Better to have a libfs lseek

[...]

Quoted 4 lines
drivers/usb/host/uhci-debug.c +0 -0
index 98cf0b2..b0cf4f8 100644

[...]

drivers/usb/host/uhci-debug.c static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence) · line 541

Quoted 10 lines
drivers/usb/host/uhci-debug.c +2 -1
@@ -539,11 +534,11 @@ static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence)
 		new = file->f_pos + off;
 		break;
 	}
+
+	/* XXX: Can size shrink? */
 	if (new < 0 || new > up->size) {
-		unlock_kernel();
 		return -EINVAL;
 	}

Should have dropped {}...

drivers/usb/host/uhci-debug.c static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence) · line 543

Quoted 3 lines
drivers/usb/host/uhci-debug.c +0 -1
-	unlock_kernel();
 	return (file->f_pos = new);
 }

WBR, Sergei

#6 lore raw

Re: [PATCH 4/6] USB-BKL: Remove BKL use in uhci-debug

Quoted 23 lines · Sergei Shtylyov

Hello.

Quoted 9 lines · Arnd Bergmann

From: Andi Kleen <[email protected]>

BKL was not really needed, just came from earlier push downs.

The only part that's a bit dodgy is the lseek function. Would need another lock or atomic access to fpos on 32bit? Better to have a libfs lseek

[...]

Quoted 4 lines
drivers/usb/host/uhci-debug.c +0 -0
index 98cf0b2..b0cf4f8 100644

[...]

Quoted 12 lines

drivers/usb/host/uhci-debug.c static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence) · line 541

Quoted 10 lines
drivers/usb/host/uhci-debug.c +2 -1
@@ -539,11 +534,11 @@ static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence)
 		new = file->f_pos + off;
 		break;
 	}
+
+	/* XXX: Can size shrink? */
 	if (new < 0 || new > up->size) {
-		unlock_kernel();
 		return -EINVAL;
 	}

Should have dropped {}...

I've fixed that up in the version that got applied.

thanks,

greg k-h

maintainer
#7 lore raw

Re: [PATCH 4/6] USB-BKL: Remove BKL use in uhci-debug

In reply to Arnd Bergmann
Quoted 3 lines · Arnd Bergmann

From: Andi Kleen <[email protected]>

BKL was not really needed, just came from earlier push downs.

Yes.

Quoted 3 lines

The only part that's a bit dodgy is the lseek function. Would need another lock or atomic access to fpos on 32bit? Better to have a libfs lseek

It doesn't matter. Anyone who tries to do lseeks on this file from two different threads, simultaneously, deserves what they get.

drivers/usb/host/uhci-debug.c static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence) · line 543

Quoted 13 lines
drivers/usb/host/uhci-debug.c +2 -2
@@ -539,11 +534,11 @@ static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence)
 		new = file->f_pos + off;
 		break;
 	}
+
+	/* XXX: Can size shrink? */
 	if (new < 0 || new > up->size) {
-		unlock_kernel();
 		return -EINVAL;
 	}
-	unlock_kernel();
 	return (file->f_pos = new);
 }

This comment isn't needed; the size cannot change after the file has been opened.

Alan Stern

#8 lore raw

Re: [PATCH 4/6] USB-BKL: Remove BKL use in uhci-debug

Quoted 15 lines · Alan Stern
Quoted 3 lines · Arnd Bergmann

From: Andi Kleen <[email protected]>

BKL was not really needed, just came from earlier push downs.

Yes.

Quoted 3 lines

The only part that's a bit dodgy is the lseek function. Would need another lock or atomic access to fpos on 32bit? Better to have a libfs lseek

It doesn't matter. Anyone who tries to do lseeks on this file from two different threads, simultaneously, deserves what they get.

Quoted 16 lines

drivers/usb/host/uhci-debug.c static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence) · line 543

Quoted 13 lines
drivers/usb/host/uhci-debug.c +2 -2
@@ -539,11 +534,11 @@ static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence)
 		new = file->f_pos + off;
 		break;
 	}
+
+	/* XXX: Can size shrink? */
 	if (new < 0 || new > up->size) {
-		unlock_kernel();
 		return -EINVAL;
 	}
-	unlock_kernel();
 	return (file->f_pos = new);
 }

This comment isn't needed; the size cannot change after the file has been opened.

I've removed the comment in the version I just committed.

thanks,

greg k-h

#9 lore raw

PATCH 5/6 usb/gadget: Do not take BKL for gadget->ops->ioctl

In reply to Arnd Bergmann

There is no gadget driver in the tree that actually implements the ioctl operation, so obviously it is not necessary to hold the BKL around the call.

---
 drivers/usb/gadget/f_fs.c  |    2 --
 drivers/usb/gadget/inode.c |    6 ++----
 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/usb/gadget/f_fs.c +0 -2
index d69eccf..715da23 100644
@@ -714,9 +714,7 @@ static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value)
 		struct ffs_function *func = ffs->func;
 		ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV;
 	} else if (gadget->ops->ioctl) {
-		lock_kernel();
 		ret = gadget->ops->ioctl(gadget, code, value);
-		unlock_kernel();
 	} else {
 		ret = -ENOTTY;
 	}
drivers/usb/gadget/inode.c +2 -4
index de8a838..5308392 100644
@@ -1299,11 +1299,9 @@ static long dev_ioctl (struct file *fd, unsigned code, unsigned long value)
 	struct usb_gadget	*gadget = dev->gadget;
 	long ret = -ENOTTY;
 
-	if (gadget->ops->ioctl) {
-		lock_kernel();
+	if (gadget->ops->ioctl)
 		ret = gadget->ops->ioctl (gadget, code, value);
-		unlock_kernel();
-	}
+
 	return ret;
 }
 
Signature · 1 line
1.7.0.4
#10 lore raw

Re: [PATCH 5/6] usb/gadget: Do not take BKL for gadget->ops->ioctl

Quoted 4 lines · Arnd Bergmann

There is no gadget driver in the tree that actually implements the ioctl operation, so obviously it is not necessary to hold the BKL around the call.

Should the callback in ops be renamed to unlocked_ioctl then as to not create confusion? Just a thought.

Quoted 27 lines
drivers/usb/gadget/f_fs.c +0 -2
@@ -714,9 +714,7 @@ static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value)
 		struct ffs_function *func = ffs->func;
 		ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV;
 	} else if (gadget->ops->ioctl) {
-		lock_kernel();
 		ret = gadget->ops->ioctl(gadget, code, value);
-		unlock_kernel();
 	} else {
 		ret = -ENOTTY;
 	}
drivers/usb/gadget/inode.c +2 -4
@@ -1299,11 +1299,9 @@ static long dev_ioctl (struct file *fd, unsigned code, unsigned long value)
 	struct usb_gadget	*gadget = dev->gadget;
 	long ret = -ENOTTY;
-	if (gadget->ops->ioctl) {
-		lock_kernel();
+	if (gadget->ops->ioctl)
 		ret = gadget->ops->ioctl (gadget, code, value);
-		unlock_kernel();
-	}
+
 	return ret;
 }
Signature · 4 lines
Best regards,                                        _     _
| Humble Liege of Serenely Enlightened Majesty of  o' \,=./ `o
| Computer Science,  Michał "mina86" Nazarewicz       (o o)
+----[mina86*mina86.com]---[mina86*jabber.org]----ooO--(_)--Ooo--
#11 lore raw

Re: [PATCH 5/6] usb/gadget: Do not take BKL for gadget->ops->ioctl

Quoted 8 lines · Michał Nazarewicz
Quoted 4 lines · Arnd Bergmann

There is no gadget driver in the tree that actually implements the ioctl operation, so obviously it is not necessary to hold the BKL around the call.

Should the callback in ops be renamed to unlocked_ioctl then as to not create confusion? Just a thought.

No, we decided that the .unlocked_ioctl naming was a bad idea in the other places after all and they should eventually get renamed back to .ioctl once all the locked versions are gone.

Arnd

#12 lore raw

Re: [PATCH 5/6] usb/gadget: Do not take BKL for gadget->ops->ioctl

In reply to Michał Nazarewicz
Quoted 9 lines

Date: Friday, June 18, 2010, 6:59 AM

Quoted 4 lines · Arnd Bergmann

There is no gadget driver in the tree that actually implements the ioctl operation, so obviously it is not necessary to hold the BKL around the call.

The original gadgetfs code used it as a passthrough to controller-specific ops, as I recall. Not much used, right.

And yes, I suspect someone just threw some BKL stuff here without actually analysing whether it was necessary.

#13 lore raw

PATCH 6/6 usb/mon: kill BKL usage

In reply to Arnd Bergmann

compat_ioctl does not use the BKL, so I assume that the native function does not need it either.

The open function is already protected by the
driver's mutex, the BKL is probably not needed
here either.

---
 drivers/usb/mon/mon_bin.c |   22 ++--------------------
 1 files changed, 2 insertions(+), 20 deletions(-)
drivers/usb/mon/mon_bin.c +2 -20
index 61c76b1..1be0b9f 100644
@@ -646,17 +646,14 @@ static int mon_bin_open(struct inode *inode, struct file *file)
 	size_t size;
 	int rc;
 
-	lock_kernel();
 	mutex_lock(&mon_lock);
 	if ((mbus = mon_bus_lookup(iminor(inode))) == NULL) {
 		mutex_unlock(&mon_lock);
-		unlock_kernel();
 		return -ENODEV;
 	}
 	if (mbus != &mon_bus0 && mbus->u_bus == NULL) {
 		printk(KERN_ERR TAG ": consistency error on open\n");
 		mutex_unlock(&mon_lock);
-		unlock_kernel();
 		return -ENODEV;
 	}
 
@@ -689,7 +686,6 @@ static int mon_bin_open(struct inode *inode, struct file *file)
 
 	file->private_data = rp;
 	mutex_unlock(&mon_lock);
-	unlock_kernel();
 	return 0;
 
 err_allocbuff:
@@ -698,7 +694,6 @@ err_allocvec:
 	kfree(rp);
 err_alloc:
 	mutex_unlock(&mon_lock);
-	unlock_kernel();
 	return rc;
 }
 
@@ -954,7 +949,7 @@ static int mon_bin_queued(struct mon_reader_bin *rp)
 
 /*
  */
-static int mon_bin_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+static long mon_bin_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
 	struct mon_reader_bin *rp = file->private_data;
 	// struct mon_bus* mbus = rp->r.m_bus;
@@ -1094,19 +1089,6 @@ static int mon_bin_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	return ret;
 }
 
-static long mon_bin_unlocked_ioctl(struct file *file, unsigned int cmd,
-				   unsigned long arg)
-{
-	int ret;
-
-	lock_kernel();
-	ret = mon_bin_ioctl(file, cmd, arg);
-	unlock_kernel();
-
-	return ret;
-}
-
-
 #ifdef CONFIG_COMPAT
 static long mon_bin_compat_ioctl(struct file *file,
     unsigned int cmd, unsigned long arg)
@@ -1250,7 +1232,7 @@ static const struct file_operations mon_fops_binary = {
 	.read =		mon_bin_read,
 	/* .write =	mon_text_write, */
 	.poll =		mon_bin_poll,
-	.unlocked_ioctl = mon_bin_unlocked_ioctl,
+	.unlocked_ioctl = mon_bin_ioctl,
 #ifdef CONFIG_COMPAT
 	.compat_ioctl =	mon_bin_compat_ioctl,
 #endif
Signature · 1 line
1.7.0.4
#14 lore raw
In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

Hi Greg,

Here goes another series of BKL removal patches, mostly from Andi. There are some minor drivers left in the USB subsystem that someone should take care of, but this series at least gets to the point where USB works with the BKL disabled.

Please apply to your USB next tree.

All applied now, thanks so much for this work.

greg k-h