Commit fb91cddc authored by Tony Lindgren's avatar Tony Lindgren Committed by Felipe Balbi

usb: musb: Remove DMA ifdef for musb_gadget.c short_packet

Let's get rid of the horrible ifdef in middle of the expression.
We can do it by adding a variable for short_packet and testing
it separately for DMA related code.
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 729697a1
...@@ -489,6 +489,7 @@ void musb_g_tx(struct musb *musb, u8 epnum) ...@@ -489,6 +489,7 @@ void musb_g_tx(struct musb *musb, u8 epnum)
if (request) { if (request) {
u8 is_dma = 0; u8 is_dma = 0;
bool short_packet = false;
if (dma && (csr & MUSB_TXCSR_DMAENAB)) { if (dma && (csr & MUSB_TXCSR_DMAENAB)) {
is_dma = 1; is_dma = 1;
...@@ -507,15 +508,18 @@ void musb_g_tx(struct musb *musb, u8 epnum) ...@@ -507,15 +508,18 @@ void musb_g_tx(struct musb *musb, u8 epnum)
* First, maybe a terminating short packet. Some DMA * First, maybe a terminating short packet. Some DMA
* engines might handle this by themselves. * engines might handle this by themselves.
*/ */
if ((request->zero && request->length if ((request->zero && request->length)
&& (request->length % musb_ep->packet_sz == 0) && (request->length % musb_ep->packet_sz == 0)
&& (request->actual == request->length)) && (request->actual == request->length))
#if defined(CONFIG_USB_INVENTRA_DMA) || defined(CONFIG_USB_UX500_DMA) short_packet = true;
|| (is_dma && (!dma->desired_mode ||
if ((musb_dma_inventra(musb) || musb_dma_ux500(musb)) &&
(is_dma && (!dma->desired_mode ||
(request->actual & (request->actual &
(musb_ep->packet_sz - 1)))) (musb_ep->packet_sz - 1)))))
#endif short_packet = true;
) {
if (short_packet) {
/* /*
* On DMA completion, FIFO may not be * On DMA completion, FIFO may not be
* available yet... * available yet...
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment