Commit 5e231b6b authored by Arjan van de Ven's avatar Arjan van de Ven Committed by Greg Kroah-Hartman

[PATCH] usb: remove some sleep_on's

sleep_on must die.... and it fixes a few races too ;)
parent e82e16d3
......@@ -781,17 +781,25 @@ static int dabusb_probe (struct usb_interface *intf,
static void dabusb_disconnect (struct usb_interface *intf)
{
wait_queue_t __wait;
pdabusb_t s = usb_get_intfdata (intf);
dbg("dabusb_disconnect");
init_waitqueue_entry(&__wait, current);
usb_set_intfdata (intf, NULL);
if (s) {
usb_deregister_dev (intf, &dabusb_class);
s->remove_pending = 1;
wake_up (&s->wait);
add_wait_queue(&s->remove_ok, &__wait);
set_current_state(TASK_UNINTERRUPTIBLE);
if (s->state == _started)
sleep_on (&s->remove_ok);
schedule();
current->state = TASK_RUNNING;
remove_wait_queue(&s->remove_ok, &__wait);
s->usbdev = NULL;
s->overruns = 0;
}
......
......@@ -1927,7 +1927,6 @@ static int auerswald_probe (struct usb_interface *intf,
{
struct usb_device *usbdev = interface_to_usbdev(intf);
pauerswald_t cp = NULL;
DECLARE_WAIT_QUEUE_HEAD (wqh);
unsigned int u = 0;
char *pbuf;
int ret;
......@@ -1975,7 +1974,8 @@ static int auerswald_probe (struct usb_interface *intf,
dbg ("Version is %X", cp->version);
/* allow some time to settle the device */
sleep_on_timeout (&wqh, HZ / 3 );
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(HZ/3);
/* Try to get a suitable textual description of the device */
/* Device name:*/
......
......@@ -397,8 +397,12 @@ tiglusb_probe (struct usb_interface *intf,
static void
tiglusb_disconnect (struct usb_interface *intf)
{
wait_queue_t __wait;
ptiglusb_t s = usb_get_intfdata (intf);
init_waitqueue_entry(&__wait, current);
usb_set_intfdata (intf, NULL);
if (!s || !s->dev) {
info ("bogus disconnect");
......@@ -407,8 +411,12 @@ tiglusb_disconnect (struct usb_interface *intf)
s->remove_pending = 1;
wake_up (&s->wait);
add_wait_queue(&s->wait, &__wait);
set_current_state(TASK_UNINTERRUPTIBLE);
if (s->state == _started)
sleep_on (&s->remove_ok);
schedule();
current->state = TASK_RUNNING;
remove_wait_queue(&s->wait, &__wait);
down (&s->mutex);
s->dev = NULL;
s->opened = 0;
......
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