From: Alan Stern Date: Mon, 1 Dec 2008 15:24:41 +0000 (-0500) Subject: USB: skip Set-Interface(0) if already in altsetting 0 X-Git-Tag: v2.6.28-rc9~8^2~3 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=24c0996a6b73e2554104961afcc8659534503e0d;p=linux-2.6-omap-h63xx.git USB: skip Set-Interface(0) if already in altsetting 0 When a driver unbinds from an interface, usbcore always sends a Set-Interface request to reinstall altsetting 0. Unforunately, quite a few devices have buggy firmware that crashes when it receives this request. To avoid such problems, this patch (as1180) arranges to send the Set-Interface request only when the interface is not already in altsetting 0. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 3d7793d9303..8c081308b0e 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -279,7 +279,9 @@ static int usb_unbind_interface(struct device *dev) * altsetting means creating new endpoint device entries). * When either of these happens, defer the Set-Interface. */ - if (!error && intf->dev.power.status == DPM_ON) + if (intf->cur_altsetting->desc.bAlternateSetting == 0) + ; /* Already in altsetting 0 so skip Set-Interface */ + else if (!error && intf->dev.power.status == DPM_ON) usb_set_interface(udev, intf->altsetting[0]. desc.bInterfaceNumber, 0); else