Re: [RESEND/PATCH 5/6] USB: musb-gadget: complete request only ifdata is transfered over

From: Sergei Shtylyov
Date: Tue Sep 14 2010 - 06:48:10 EST


Hello.

On 14-09-2010 10:56, Felipe Balbi wrote:

Oops, I've been too fast and haven't realized that the check done here
_is_ actually wrong. It causes ZLP send to trigger too fast in the DMA
case. So please fix this patch. Felipe, please drop it for now.

patch is not even touching that part of the code,

Yeah, and that's the problem.

not even
reading/writing TXCSR_TXPKTRDY bit care to explain please.

If a DMA interrupt comes when the whole transfer is not yet complete (and other Ming Lei's patches are making this possible), it will pass due to the 'ís_dma' condition above the patched code:

if (is_dma || request->actual == request->length) {

and then it will hit the code sending the final ZLP (above this patched code too):

/*
* 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)
#ifdef CONFIG_USB_INVENTRA_DMA
|| (is_dma && (!dma->desired_mode ||
(request->actual &
(musb_ep->packet_sz - 1))))
#endif
) {

before the transfer is complete while it should only be hit when and only when the whole transfer is complete. The current code doesn't look correct as well though, all due to this 'ís_dma' condition. Surely this needs fixing.

WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/