diff options
author | Oliver Neukum <oneukum@suse.de> | 2007-01-11 08:35:50 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-02-07 18:44:38 -0500 |
commit | 3ede760f0e46317c6716ead8facff88f6a924a49 (patch) | |
tree | 077a0ab25a4b4e63aa6547e6f352ea063d7b678a /drivers/usb | |
parent | 66e56ce75e39210415fb12ceacd5f3580ad72d50 (diff) |
USB: total removal of multithreaded probing in usb
The whole approach is simply wrong. Forking a thread means that
- errors are ignored
- locking is ignored
Doing this correctly would require major surgery for questionable benefit.
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/hub.c | 64 |
1 files changed, 21 insertions, 43 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 1988224b362b..590ec82d0515 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -87,9 +87,6 @@ static DECLARE_WAIT_QUEUE_HEAD(khubd_wait); | |||
87 | 87 | ||
88 | static struct task_struct *khubd_task; | 88 | static struct task_struct *khubd_task; |
89 | 89 | ||
90 | /* multithreaded probe logic */ | ||
91 | static int multithread_probe = 0; | ||
92 | |||
93 | /* cycle leds on hubs that aren't blinking for attention */ | 90 | /* cycle leds on hubs that aren't blinking for attention */ |
94 | static int blinkenlights = 0; | 91 | static int blinkenlights = 0; |
95 | module_param (blinkenlights, bool, S_IRUGO); | 92 | module_param (blinkenlights, bool, S_IRUGO); |
@@ -1256,9 +1253,28 @@ static inline void show_string(struct usb_device *udev, char *id, char *string) | |||
1256 | static int __usb_port_suspend(struct usb_device *, int port1); | 1253 | static int __usb_port_suspend(struct usb_device *, int port1); |
1257 | #endif | 1254 | #endif |
1258 | 1255 | ||
1259 | static int __usb_new_device(void *void_data) | 1256 | /** |
1257 | * usb_new_device - perform initial device setup (usbcore-internal) | ||
1258 | * @udev: newly addressed device (in ADDRESS state) | ||
1259 | * | ||
1260 | * This is called with devices which have been enumerated, but not yet | ||
1261 | * configured. The device descriptor is available, but not descriptors | ||
1262 | * for any device configuration. The caller must have locked either | ||
1263 | * the parent hub (if udev is a normal device) or else the | ||
1264 | * usb_bus_list_lock (if udev is a root hub). The parent's pointer to | ||
1265 | * udev has already been installed, but udev is not yet visible through | ||
1266 | * sysfs or other filesystem code. | ||
1267 | * | ||
1268 | * It will return if the device is configured properly or not. Zero if | ||
1269 | * the interface was registered with the driver core; else a negative | ||
1270 | * errno value. | ||
1271 | * | ||
1272 | * This call is synchronous, and may not be used in an interrupt context. | ||
1273 | * | ||
1274 | * Only the hub driver or root-hub registrar should ever call this. | ||
1275 | */ | ||
1276 | int usb_new_device(struct usb_device *udev) | ||
1260 | { | 1277 | { |
1261 | struct usb_device *udev = void_data; | ||
1262 | int err; | 1278 | int err; |
1263 | 1279 | ||
1264 | /* Lock ourself into memory in order to keep a probe sequence | 1280 | /* Lock ourself into memory in order to keep a probe sequence |
@@ -1375,44 +1391,6 @@ fail: | |||
1375 | goto exit; | 1391 | goto exit; |
1376 | } | 1392 | } |
1377 | 1393 | ||
1378 | /** | ||
1379 | * usb_new_device - perform initial device setup (usbcore-internal) | ||
1380 | * @udev: newly addressed device (in ADDRESS state) | ||
1381 | * | ||
1382 | * This is called with devices which have been enumerated, but not yet | ||
1383 | * configured. The device descriptor is available, but not descriptors | ||
1384 | * for any device configuration. The caller must have locked either | ||
1385 | * the parent hub (if udev is a normal device) or else the | ||
1386 | * usb_bus_list_lock (if udev is a root hub). The parent's pointer to | ||
1387 | * udev has already been installed, but udev is not yet visible through | ||
1388 | * sysfs or other filesystem code. | ||
1389 | * | ||
1390 | * The return value for this function depends on if the | ||
1391 | * multithread_probe variable is set or not. If it's set, it will | ||
1392 | * return a if the probe thread was successfully created or not. If the | ||
1393 | * variable is not set, it will return if the device is configured | ||
1394 | * properly or not. interfaces, in sysfs); else a negative errno value. | ||
1395 | * | ||
1396 | * This call is synchronous, and may not be used in an interrupt context. | ||
1397 | * | ||
1398 | * Only the hub driver or root-hub registrar should ever call this. | ||
1399 | */ | ||
1400 | int usb_new_device(struct usb_device *udev) | ||
1401 | { | ||
1402 | struct task_struct *probe_task; | ||
1403 | int ret = 0; | ||
1404 | |||
1405 | if (multithread_probe) { | ||
1406 | probe_task = kthread_run(__usb_new_device, udev, | ||
1407 | "usb-probe-%s", udev->devnum); | ||
1408 | if (IS_ERR(probe_task)) | ||
1409 | ret = PTR_ERR(probe_task); | ||
1410 | } else | ||
1411 | ret = __usb_new_device(udev); | ||
1412 | |||
1413 | return ret; | ||
1414 | } | ||
1415 | |||
1416 | static int hub_port_status(struct usb_hub *hub, int port1, | 1394 | static int hub_port_status(struct usb_hub *hub, int port1, |
1417 | u16 *status, u16 *change) | 1395 | u16 *status, u16 *change) |
1418 | { | 1396 | { |