From: Vitaly Kuzmichev Date: Fri, 11 Feb 2011 15:18:31 +0000 (+0300) Subject: USB-CDC: handle interrupt after dropped pullup X-Git-Tag: v2011.03-rc2~50 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b3649f3bbfdb2686eceb40a629cef8d4d257f5fa;p=oweals%2Fu-boot.git USB-CDC: handle interrupt after dropped pullup Disconnecting USB gadget with pending interrupt may cause its wrong handling in the next time when interface will be started again (especially actual for RNDIS). This interrupt may force the gadget to queue unexpected response before setup stage. Despite the fact that such interrupt handled after dropped pullup also may add pending response, this will not bring to any issues due to usb_ep_disable (which clears the queue) called on gadget unregistering. Signed-off-by: Vitaly Kuzmichev --- diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 638486998d..0e7549d6b1 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -1928,6 +1928,13 @@ void usb_eth_halt(struct eth_device *netdev) return; usb_gadget_disconnect(dev->gadget); + + /* Clear pending interrupt */ + if (dev->network_started) { + usb_gadget_handle_interrupts(); + dev->network_started = 0; + } + usb_gadget_unregister_driver(ð_driver); }