From patchwork Sat Aug 28 02:51:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 139181 X-Patchwork-Delegate: me@felipebalbi.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o7S2prJD013565 for ; Sat, 28 Aug 2010 02:51:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752687Ab0H1Cvt (ORCPT ); Fri, 27 Aug 2010 22:51:49 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:50417 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751726Ab0H1Cvt convert rfc822-to-8bit (ORCPT ); Fri, 27 Aug 2010 22:51:49 -0400 Received: by wwb28 with SMTP id 28so4296669wwb.1 for ; Fri, 27 Aug 2010 19:51:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=qg0WW3e/PZHO5YM01QqxxTKPGGllYYczYYF3nl8ahVM=; b=dDn+OHUmVk+vh5ulrURFw9pHA+X6NSIOeBpU08sA9ARkOn6SDT0rzYx+qBfe7zBmPS DJ7uVXvbahg7FgbIISnxK/ybcxC8dFfep9e+etU/V0tAMNI2L1A5tLBrD0hmwGvsilzC wBdhKSw1UmUmlYdAK/Q1+FAZ3QutfJ8ZE/JUY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Ki7O/EdztIlApa2an4HehMM0UQognIVNbCZ+snKSy2mUs4wkxguF9/bu50uj9PD7R/ rJHVgUBd0VmC742XLS2v1sbRXzlVQnDX+E7W6b9s4JWW2dAR3k9p3A5FqFuTpbhZBG0s Em8Q41iyqVsrlozxohHqiNa0D8jrVURyigTt8= MIME-Version: 1.0 Received: by 10.227.133.81 with SMTP id e17mr1501449wbt.186.1282963907162; Fri, 27 Aug 2010 19:51:47 -0700 (PDT) Received: by 10.216.134.32 with HTTP; Fri, 27 Aug 2010 19:51:47 -0700 (PDT) In-Reply-To: <201008271627.08137.vapier@gentoo.org> References: <1282909040-2936-1-git-send-email-tom.leiming@gmail.com> <201008271627.08137.vapier@gentoo.org> Date: Sat, 28 Aug 2010 10:51:47 +0800 Message-ID: Subject: Re: [PATCH 1/2] USB: musb-gadget: fix bulk IN infinite hangs in double buffer case From: Ming Lei To: Mike Frysinger Cc: greg@kroah.com, dbrownell@users.sourceforge.net, felipe.balbi@nokia.com, linux-usb@vger.kernel.org, linux-omap@vger.kernel.org, Anand Gadiyar , Sergei Shtylyov Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sat, 28 Aug 2010 02:51:53 +0000 (UTC) diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index e898228..1cf6d28 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -503,14 +503,14 @@ void musb_g_tx(struct musb *musb, u8 epnum) request->zero = 0; } - /* ... or if not, then complete it. */ - musb_g_giveback(musb_ep, request, 0); - - request = musb_ep->desc ? next_request(musb_ep) : NULL; - if (!request) { - DBG(4, "%s idle now\n", - musb_ep->end_point.name); - return; + if (request->actual == request->length) { + musb_g_giveback(musb_ep, request, 0); + request = musb_ep->desc ? next_request(musb_ep) : NULL; + if (!request) { + DBG(4, "%s idle now\n", + musb_ep->end_point.name); + return; + } } }