From de535741860d2568b66be4bdf94a1c09c3eb4a95 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Thu, 11 Aug 2005 15:50:32 -0400 Subject: [PATCH] --- yaml --- r: 7970 b: refs/heads/master c: 3b4d7f79164853e10342d707e32307e0c8054982 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/usb/core/usb.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 414ed9f3a1af..0d90c91a863b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3ea15966ed59f2bc20928c7b0496b4585f6de206 +refs/heads/master: 3b4d7f79164853e10342d707e32307e0c8054982 diff --git a/trunk/drivers/usb/core/usb.c b/trunk/drivers/usb/core/usb.c index 109f7558167a..087af73a59dd 100644 --- a/trunk/drivers/usb/core/usb.c +++ b/trunk/drivers/usb/core/usb.c @@ -65,6 +65,16 @@ static int generic_probe (struct device *dev) } static int generic_remove (struct device *dev) { + struct usb_device *udev = to_usb_device(dev); + + /* if this is only an unbind, not a physical disconnect, then + * unconfigure the device */ + if (udev->state == USB_STATE_CONFIGURED) + usb_set_configuration(udev, 0); + + /* in case the call failed or the device was suspended */ + if (udev->state >= USB_STATE_CONFIGURED) + usb_disable_device(udev, 0); return 0; }