diff mbox

[18/28] usb: dwc3: ep0: fix Data Phase for transfer sizes aligned to wMaxPacketSize

Message ID 20141023134808.GA13573@saruman
State New
Headers show

Commit Message

Felipe Balbi Oct. 23, 2014, 1:48 p.m. UTC
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 mbox

Patch

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;