mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Greg KH <gregkh@suse.de>
Cc: linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	linux-usb@vger.kernel.org,
	Frederic Weisbecker <fweisbec@gmail.com>,
	John Kacur <jkacur@redhat.com>, Andi Kleen <andi@firstfloor.org>,
	Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 2/6] USB-BKL: Convert usb_driver ioctl to unlocked_ioctl
Date: Tue,  1 Jun 2010 23:04:41 +0200	[thread overview]
Message-ID: <1275426285-9088-3-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1275426285-9088-1-git-send-email-arnd@arndb.de>

From: Andi Kleen <ak@linux.intel.com>

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: Andi Kleen <ak@linux.intel.com>
---
 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(-)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index c2f62a3..f1aaff6 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -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;
 		}
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 83e7bbb..d0e77d4 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -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,
 };
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 16dffe9..0cfbd78 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -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,
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d5922a8..e6cbc34 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -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);
-- 
1.7.0.4


  parent reply	other threads:[~2010-06-01 21:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-01 21:04 [PATCH 0/6] USB: BKL removal Arnd Bergmann
2010-06-01 21:04 ` [PATCH 1/6] USB-BKL: Remove lock_kernel in usbfs update_sb() Arnd Bergmann
2010-06-01 21:04 ` Arnd Bergmann [this message]
2010-06-01 21:04 ` [PATCH 3/6] USB-BKL: Remove BKL use for usb serial driver probing Arnd Bergmann
2010-06-01 21:04 ` [PATCH 4/6] USB-BKL: Remove BKL use in uhci-debug Arnd Bergmann
2010-06-02 10:11   ` Sergei Shtylyov
2010-06-17 17:44     ` Greg KH
2010-06-02 13:47   ` Alan Stern
2010-06-17 17:43     ` Greg KH
2010-06-01 21:04 ` [PATCH 5/6] usb/gadget: Do not take BKL for gadget->ops->ioctl Arnd Bergmann
2010-06-18 13:59   ` Michał Nazarewicz
2010-06-18 18:22     ` Arnd Bergmann
2010-06-29 14:08     ` David Brownell
2010-06-01 21:04 ` [PATCH 6/6] usb/mon: kill BKL usage Arnd Bergmann
2010-06-17 17:46 ` [PATCH 0/6] USB: BKL removal Greg KH

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=1275426285-9088-3-git-send-email-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=fweisbec@gmail.com \
    --cc=gregkh@suse.de \
    --cc=jkacur@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.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

Powered by JetHome