Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7379aaa authored by Ming Lei's avatar Ming Lei Committed by Greg Kroah-Hartman
Browse files

usb: musb: gadget: fix ZLP sending in musb_g_tx(v1)

This patch fixes the problem reported by Sergei:

>how come? we need to send ZLP before giving back the request.
>Well, look at the code ionce again. We need to send ZLP *after*
>request->actual == request->length, but as the check is inserted
>after the ZLP send, ZLP *may* be sent once the first DMA completes,
>not the last.

The patch also has been discussed on the link below:

	http://marc.info/?t=128454814900001&r=1&w=2



Signed-off-by: default avatarMing Lei <tom.leiming@gmail.com>
Reported-by: default avatarSergei Shtylyov <sshtylyov@mvista.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Anand Gadiyar <gadiyar@ti.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a6038ee7
Loading
Loading
Loading
Loading
+29 −30
Original line number Diff line number Diff line
@@ -477,13 +477,13 @@ void musb_g_tx(struct musb *musb, u8 epnum)
				epnum, csr, musb_ep->dma->actual_len, request);
		}

		if (is_dma || request->actual == request->length) {
		/*
		 * First, maybe a terminating short packet. Some DMA
		 * engines might handle this by themselves.
		 */
		if ((request->zero && request->length
				&& request->length % musb_ep->packet_sz == 0)
			&& (request->length % musb_ep->packet_sz == 0)
			&& (request->actual == request->length))
#ifdef CONFIG_USB_INVENTRA_DMA
			|| (is_dma && (!dma->desired_mode ||
				(request->actual &
@@ -512,7 +512,6 @@ void musb_g_tx(struct musb *musb, u8 epnum)
				return;
			}
		}
		}

		txstate(musb, to_musb_request(request));
	}