From patchwork Fri Feb 11 15:18:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Kuzmichev X-Patchwork-Id: 82769 X-Patchwork-Delegate: linux@bohmer.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 8D3BBB7162 for ; Sat, 12 Feb 2011 02:24:51 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5B7C9280EF; Fri, 11 Feb 2011 16:24:44 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3j-prR2cfgL6; Fri, 11 Feb 2011 16:24:44 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 14A66280CB; Fri, 11 Feb 2011 16:24:34 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 42033280BF for ; Fri, 11 Feb 2011 16:24:30 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9cYMamb4Y9-E for ; Fri, 11 Feb 2011 16:24:27 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-bw0-f44.google.com (mail-bw0-f44.google.com [209.85.214.44]) by theia.denx.de (Postfix) with ESMTPS id 0524E280BE for ; Fri, 11 Feb 2011 16:24:25 +0100 (CET) Received: by bwz12 with SMTP id 12so3551273bwz.3 for ; Fri, 11 Feb 2011 07:24:25 -0800 (PST) Received: by 10.204.137.199 with SMTP id x7mr532091bkt.165.1297437865152; Fri, 11 Feb 2011 07:24:25 -0800 (PST) Received: from localhost.localdomain (mail.dev.rtsoft.ru [213.79.90.226]) by mx.google.com with ESMTPS id z18sm544843bkf.8.2011.02.11.07.24.24 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 11 Feb 2011 07:24:24 -0800 (PST) From: Vitaly Kuzmichev To: u-boot@lists.denx.de Date: Fri, 11 Feb 2011 18:18:31 +0300 Message-Id: <1297437515-4069-2-git-send-email-vkuzmichev@mvista.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1297437515-4069-1-git-send-email-vkuzmichev@mvista.com> References: <1297437515-4069-1-git-send-email-vkuzmichev@mvista.com> Subject: [U-Boot] [PATCH 1/5] USB-CDC: handle interrupt after dropped pullup X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 --- drivers/usb/gadget/ether.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 01deeb1..079acea 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -1926,6 +1926,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); }