From patchwork Thu Oct 23 13:48:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 39365 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CE2E720341 for ; Thu, 23 Oct 2014 13:48:41 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id m15sf616425wgh.7 for ; Thu, 23 Oct 2014 06:48:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:cc:subject:message-id :reply-to:references:mime-version:content-type:content-disposition :in-reply-to:user-agent:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=MdJ/rxhkLi0qX+XEOB2aT5c2DLLSrghDihGGScrkewE=; b=hNi1Ilq5WuCARys9RT0rM85BmsZlVBPTkVmGUElDeoJnOR1wrk/Xkxt1+q5oWsnHRK kv0Z+HHJm4cbptdIyU+KPUJ0y3TMZFFFYlE/5m+OIPAtYDLbULaRbSS8pHU8oI1yQBdQ xrFAuiQwJ1rYX/koulGudw1S/eHZ/e/YKYuAQOTpS5VEwzgXDVCbOCP+sqlzyL7czrdA rxy83W4/KcIhnHyuwFMtN6rRjp0Q0zw//O4q8mqxtuViNYUBBjfkgWz0v4A1AJVf0Zum IU3rQHXaJAKWMSJ/GwGCWVEmLDDhO8YiCFHTb8FbVyyNvYBnSXnV63DIEqVsRh0mDnL8 CPAA== X-Gm-Message-State: ALoCoQlzLgrgWug4xN629nroTjGXULYWDEHyrEftQsUHXwCApCJnGjCuAJkPvIR87sHeiiZRPzUA X-Received: by 10.180.83.134 with SMTP id q6mr2401191wiy.7.1414072121001; Thu, 23 Oct 2014 06:48:41 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.8 with SMTP id lk8ls276392lac.17.gmail; Thu, 23 Oct 2014 06:48:40 -0700 (PDT) X-Received: by 10.152.43.97 with SMTP id v1mr5237407lal.3.1414072120825; Thu, 23 Oct 2014 06:48:40 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id pt7si2640550lbb.120.2014.10.23.06.48.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Oct 2014 06:48:40 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id pv20so867228lab.6 for ; Thu, 23 Oct 2014 06:48:40 -0700 (PDT) X-Received: by 10.112.14.69 with SMTP id n5mr5303578lbc.34.1414072120572; Thu, 23 Oct 2014 06:48:40 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp257885lbz; Thu, 23 Oct 2014 06:48:39 -0700 (PDT) X-Received: by 10.70.92.68 with SMTP id ck4mr5292564pdb.28.1414072118382; Thu, 23 Oct 2014 06:48:38 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m5si1698040pda.77.2014.10.23.06.48.36 for ; Thu, 23 Oct 2014 06:48:38 -0700 (PDT) Received-SPF: none (google.com: linux-usb-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755585AbaJWNsf (ORCPT + 3 others); Thu, 23 Oct 2014 09:48:35 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:56745 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751711AbaJWNse (ORCPT ); Thu, 23 Oct 2014 09:48:34 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s9NDmOIl028500; Thu, 23 Oct 2014 08:48:24 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9NDmOKs026944; Thu, 23 Oct 2014 08:48:24 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Thu, 23 Oct 2014 08:48:24 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9NDmNIX012997; Thu, 23 Oct 2014 08:48:23 -0500 Date: Thu, 23 Oct 2014 08:48:08 -0500 From: Felipe Balbi To: Alan Stern CC: Anton Tikhomirov , "'Paul Zimmerman'" , "'David Laight'" , "'Felipe Balbi'" , "'Linux USB Mailing List'" Subject: Re: [PATCH 18/28] usb: dwc3: ep0: fix Data Phase for transfer sizes aligned to wMaxPacketSize Message-ID: <20141023134808.GA13573@saruman> Reply-To: References: <00b701cfedbc$1f1750d0$5d45f270$%tikhomirov@samsung.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On Wed, Oct 22, 2014 at 10:14:54AM -0400, Alan Stern wrote: > On Wed, 22 Oct 2014, Anton Tikhomirov wrote: > > > > That's right, and it's true for USB-2 as well. A ZLP is needed only in > > > cases where the host otherwise wouldn't know the transfer is over, > > > i.e., when the transfer length is a nonzero multiple of the maxpacket > > > size and is smaller than wLength. > > > > Shall we use/check struct usb_request's zero flag for this? > > Of course; we have to. There's no other way for the UDC driver to know > whether the transfer is shorter than the host expects. alright, so I take it this incremental diff is enough ? diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index 0a34e71..ce6b0c7 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c @@ -830,7 +830,8 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, } else { dwc3_gadget_giveback(ep0, r, 0); - if (IS_ALIGNED(ur->length, ep0->endpoint.maxpacket)) { + if (IS_ALIGNED(ur->length, ep0->endpoint.maxpacket) && + ur->zero) { int ret; dwc->ep0_next_event = DWC3_EP0_COMPLETE;