Commit 98c81a17 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Linus Torvalds

[PATCH] USB: Eliminate wait following interface unregistration

This patch from Alan Stern <stern@rowland.harvard.edu> fixes a bug in
the current USB code that causes khubd to hang when a device is removed
from the system, thereby preventing any future USB device changes (like
adding or removing other devices) from happening.

Both Andrew and I can easily duplicate this bug against the current -bk
tree. 

It's not a perfect fix, but it works for now, and I will spend the next
week working on restructuring the code so this is handled properly.
parent 9a124ef5
...@@ -794,9 +794,6 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf) ...@@ -794,9 +794,6 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf)
static void release_interface(struct device *dev) static void release_interface(struct device *dev)
{ {
struct usb_interface *interface = to_usb_interface(dev);
complete(interface->released);
} }
/* /*
...@@ -828,16 +825,12 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) ...@@ -828,16 +825,12 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
if (dev->actconfig) { if (dev->actconfig) {
for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) {
struct usb_interface *interface; struct usb_interface *interface;
struct completion intf_completion;
/* remove this interface */ /* remove this interface */
interface = dev->actconfig->interface[i]; interface = dev->actconfig->interface[i];
dev_dbg (&dev->dev, "unregistering interface %s\n", dev_dbg (&dev->dev, "unregistering interface %s\n",
interface->dev.bus_id); interface->dev.bus_id);
init_completion (&intf_completion);
interface->released = &intf_completion;
device_unregister (&interface->dev); device_unregister (&interface->dev);
wait_for_completion (&intf_completion);
} }
dev->actconfig = 0; dev->actconfig = 0;
if (dev->state == USB_STATE_CONFIGURED) if (dev->state == USB_STATE_CONFIGURED)
......
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