Commit c532b29a authored by Andi Kleen's avatar Andi Kleen Committed by Greg Kroah-Hartman

USB-BKL: Convert usb_driver ioctl to unlocked_ioctl

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
Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
From: Andi Kleen <ak@linux.intel.com>
parent 6e12ea46
...@@ -1668,13 +1668,10 @@ static int proc_ioctl(struct dev_state *ps, struct usbdevfs_ioctl *ctl) ...@@ -1668,13 +1668,10 @@ static int proc_ioctl(struct dev_state *ps, struct usbdevfs_ioctl *ctl)
default: default:
if (intf->dev.driver) if (intf->dev.driver)
driver = to_usb_driver(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; retval = -ENOTTY;
} else { } else {
/* keep API that guarantees BKL */ retval = driver->unlocked_ioctl(intf, ctl->ioctl_code, buf);
lock_kernel();
retval = driver->ioctl(intf, ctl->ioctl_code, buf);
unlock_kernel();
if (retval == -ENOIOCTLCMD) if (retval == -ENOIOCTLCMD)
retval = -ENOTTY; retval = -ENOTTY;
} }
......
...@@ -1294,6 +1294,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) ...@@ -1294,6 +1294,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
return -ENODEV; return -ENODEV;
} }
/* No BKL needed */
static int static int
hub_ioctl(struct usb_interface *intf, unsigned int code, void *user_data) hub_ioctl(struct usb_interface *intf, unsigned int code, void *user_data)
{ {
...@@ -3465,7 +3466,7 @@ static struct usb_driver hub_driver = { ...@@ -3465,7 +3466,7 @@ static struct usb_driver hub_driver = {
.reset_resume = hub_reset_resume, .reset_resume = hub_reset_resume,
.pre_reset = hub_pre_reset, .pre_reset = hub_pre_reset,
.post_reset = hub_post_reset, .post_reset = hub_post_reset,
.ioctl = hub_ioctl, .unlocked_ioctl = hub_ioctl,
.id_table = hub_id_table, .id_table = hub_id_table,
.supports_autosuspend = 1, .supports_autosuspend = 1,
}; };
......
...@@ -1548,6 +1548,7 @@ test_iso_queue (struct usbtest_dev *dev, struct usbtest_param *param, ...@@ -1548,6 +1548,7 @@ test_iso_queue (struct usbtest_dev *dev, struct usbtest_param *param,
* off just killing the userspace task and waiting for it to exit. * off just killing the userspace task and waiting for it to exit.
*/ */
/* No BKL needed */
static int static int
usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf) usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
{ {
...@@ -2170,7 +2171,7 @@ static struct usb_driver usbtest_driver = { ...@@ -2170,7 +2171,7 @@ static struct usb_driver usbtest_driver = {
.name = "usbtest", .name = "usbtest",
.id_table = id_table, .id_table = id_table,
.probe = usbtest_probe, .probe = usbtest_probe,
.ioctl = usbtest_ioctl, .unlocked_ioctl = usbtest_ioctl,
.disconnect = usbtest_disconnect, .disconnect = usbtest_disconnect,
.suspend = usbtest_suspend, .suspend = usbtest_suspend,
.resume = usbtest_resume, .resume = usbtest_resume,
......
...@@ -843,7 +843,7 @@ struct usb_driver { ...@@ -843,7 +843,7 @@ struct usb_driver {
void (*disconnect) (struct usb_interface *intf); 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); void *buf);
int (*suspend) (struct usb_interface *intf, pm_message_t message); int (*suspend) (struct usb_interface *intf, pm_message_t message);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment