From patchwork Tue Sep 7 15:23:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 161411 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 o87FQ6gi004268 for ; Tue, 7 Sep 2010 15:26:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757661Ab0IGPZg (ORCPT ); Tue, 7 Sep 2010 11:25:36 -0400 Received: from mail-pw0-f46.google.com ([209.85.160.46]:54138 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757536Ab0IGPZd (ORCPT ); Tue, 7 Sep 2010 11:25:33 -0400 Received: by pwi3 with SMTP id 3so1436030pwi.19 for ; Tue, 07 Sep 2010 08:25:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=QiWRv1u65yiaikkN3439WLmCM9goWJwIsB4giENhXqY=; b=B/1e43KgQY/cmmPZ0LS6EDdCMR0SHyDCFfWByDGEL/A0JVPUr6GJ5bTFeCaM9LhiGY IGDUj2sMQyW18lSQwowgVmzXBfZq2lrf4Dhk1YYKolEKWkC88kDCDEog2VhHQ3MaXAsY E/06F8/nLFGBbAbkHnal1ygQDEwDNmAkkFlTU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=OCciRJzfOXpGKsowi+CiGfTlwcyhqOIVPL40/QfmGKIjo+mI2SilrHgEiBLVwiOH9A 6QuQgC+FVHPHxl3DididTP0jbvnjPHjnmZLgRLlQzukhxfwZilCgOQ4pkL6W9hZJDkRr SVA/O3h9y64GPXGtXO7x5JkjXCNeNHLCJo7uw= Received: by 10.142.133.11 with SMTP id g11mr71237wfd.156.1283873132440; Tue, 07 Sep 2010 08:25:32 -0700 (PDT) Received: from localhost ([183.16.32.111]) by mx.google.com with ESMTPS id 9sm5927146wfd.0.2010.09.07.08.25.22 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 07 Sep 2010 08:25:29 -0700 (PDT) From: tom.leiming@gmail.com To: greg@kroah.com Cc: linux-usb@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Ming Lei , David Brownell , Felipe Balbi , Anand Gadiyar , Mike Frysinger , Sergei Shtylyov Subject: [RESEND/PATCH 5/6] USB: musb-gadget: complete request only if data is transfered over Date: Tue, 7 Sep 2010 23:23:33 +0800 Message-Id: <1283873014-32511-6-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 1.6.2.5 In-Reply-To: <1283873014-32511-1-git-send-email-tom.leiming@gmail.com> References: <1283873014-32511-1-git-send-email-tom.leiming@gmail.com> 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]); Tue, 07 Sep 2010 15:26:06 +0000 (UTC) diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index f3ee04f..fa826f9 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -501,14 +501,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; + } } }