aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2005-08-11 15:50:32 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-08 19:28:22 -0400
commit3b4d7f79164853e10342d707e32307e0c8054982 (patch)
tree6413fc59dacef3d757f06252f57fdb3c153d1a8f /drivers/usb
parent3ea15966ed59f2bc20928c7b0496b4585f6de206 (diff)
[PATCH] USB: Support unbinding of the usb_generic driver
This patch (as556) adds support for unbinding the usb_generic "driver". That driver only binds to USB devices, as opposed to interfaces, and it does nothing much besides marking which struct device's go with an overall USB device plus providing suspend/resume methods. Now that users can unbind drivers at will using the sysfs "unbind" attribute, we need a rational way of dealing with USB devices that are no longer under full control of the USB stack. The patch handles this by unconfiguring the device, thereby removing all the interfaces and their associated drivers and children. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/usb.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 109f7558167a..087af73a59dd 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -65,6 +65,16 @@ static int generic_probe (struct device *dev)
65} 65}
66static int generic_remove (struct device *dev) 66static int generic_remove (struct device *dev)
67{ 67{
68 struct usb_device *udev = to_usb_device(dev);
69
70 /* if this is only an unbind, not a physical disconnect, then
71 * unconfigure the device */
72 if (udev->state == USB_STATE_CONFIGURED)
73 usb_set_configuration(udev, 0);
74
75 /* in case the call failed or the device was suspended */
76 if (udev->state >= USB_STATE_CONFIGURED)
77 usb_disable_device(udev, 0);
68 return 0; 78 return 0;
69} 79}
70 80