2010/9/17 Sergei Shtylyov <sshtylyov@xxxxxxxxxx>: > Hello. > > Ming Lei wrote: > >>>>> I don't understand why we have to check this twice when only once >>>>> would >>>>> suffice. >>>> >>>> This check can handle both zero and non-zero request, so it is needed. > >>> It's needed above all the other checks, that's all. We don't need to >>> check >>> it twice. > >> The 1st check is >> >> if ((request->zero && request->length >> && (request->length % musb_ep->packet_sz == 0) >> && (request->actual == request->length) >> || ... ) { >> ... >> } > >> The 2nd is > >> if (request->actual == request->length) { >> musb_g_giveback(musb_ep, request, 0); >> ...... >> } > >> The 1st check only can handle request with zlp, > > That's only in your patch. The original code was correct, except 'is_dma' > part. We have discussed the patch for some time already, why do you say original code again? For the patch, it is more clear than original code in logic: - handle zlp or short packet first if one of two conditions is true - complete the request if data transfer is over If you have not any objections for this patch instead of original code, I will submit to Felipe and let him decide. -- Lei Ming -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html