From fbab38d13de9c75c0150ba2dc854bb6675dc22fa Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Thu, 8 May 2008 11:54:37 -0400 Subject: [PATCH] --- yaml --- r: 104550 b: refs/heads/master c: 9da82bd4649334817ef0e752a69eb99051645dad h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/usb/core/driver.c | 11 ++++++----- trunk/include/linux/usb.h | 3 +++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index e6a7052670c7..62515a32ac41 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 473bca94ba432b3c194e6fa315d81d8ac7670a4f +refs/heads/master: 9da82bd4649334817ef0e752a69eb99051645dad diff --git a/trunk/drivers/usb/core/driver.c b/trunk/drivers/usb/core/driver.c index 0a0e8cea0afc..8da1a56659be 100644 --- a/trunk/drivers/usb/core/driver.c +++ b/trunk/drivers/usb/core/driver.c @@ -257,15 +257,16 @@ static int usb_unbind_interface(struct device *dev) udev = interface_to_usbdev(intf); error = usb_autoresume_device(udev); - /* release all urbs for this interface */ - usb_disable_interface(interface_to_usbdev(intf), intf); + /* Terminate all URBs for this interface unless the driver + * supports "soft" unbinding. + */ + if (!driver->soft_unbind) + usb_disable_interface(udev, intf); driver->disconnect(intf); /* reset other interface state */ - usb_set_interface(interface_to_usbdev(intf), - intf->altsetting[0].desc.bInterfaceNumber, - 0); + usb_set_interface(udev, intf->altsetting[0].desc.bInterfaceNumber, 0); usb_set_intfdata(intf, NULL); intf->condition = USB_INTERFACE_UNBOUND; diff --git a/trunk/include/linux/usb.h b/trunk/include/linux/usb.h index cee7fbb2b605..8429d08bd2fd 100644 --- a/trunk/include/linux/usb.h +++ b/trunk/include/linux/usb.h @@ -972,6 +972,8 @@ struct usbdrv_wrap { * added to this driver by preventing the sysfs file from being created. * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend * for interfaces bound to this driver. + * @soft_unbind: if set to 1, the USB core will not kill URBs and disable + * endpoints before calling the driver's disconnect method. * * USB interface drivers must provide a name, probe() and disconnect() * methods, and an id_table. Other driver fields are optional. @@ -1012,6 +1014,7 @@ struct usb_driver { struct usbdrv_wrap drvwrap; unsigned int no_dynamic_id:1; unsigned int supports_autosuspend:1; + unsigned int soft_unbind:1; }; #define to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver)