[PATCH] usb: dwc3: gadget: fix up DMA direction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If we're using an IN endpoint, the DMA direction
is DMA_FROM_DEVICE, rather than DMA_TO_DEVICE.

Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Felipe Balbi <balbi@xxxxxx>
---

Greg, I will be sending this to the 3.3 merge window,
it's already on my branch, that's why I'm Ccing stable,
so this should be applied only to 3.2. If there's still
time to apply this on 3.2, please take the patch in on
top of my latest pull request and I can drop it from
my pull for -next.

 drivers/usb/dwc3/gadget.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 026c53c..c92fefa 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -68,7 +68,7 @@ void dwc3_map_buffer_to_dma(struct dwc3_request *req)
 	if (req->request.dma == DMA_ADDR_INVALID) {
 		req->request.dma = dma_map_single(dwc->dev, req->request.buf,
 				req->request.length, req->direction
-				? DMA_TO_DEVICE : DMA_FROM_DEVICE);
+				? DMA_FROM_DEVICE : DMA_TO_DEVICE);
 		req->mapped = true;
 	}
 }
@@ -85,7 +85,7 @@ void dwc3_unmap_buffer_from_dma(struct dwc3_request *req)
 	if (req->mapped) {
 		dma_unmap_single(dwc->dev, req->request.dma,
 				req->request.length, req->direction
-				? DMA_TO_DEVICE : DMA_FROM_DEVICE);
+				? DMA_FROM_DEVICE : DMA_TO_DEVICE);
 		req->mapped = 0;
 		req->request.dma = DMA_ADDR_INVALID;
 	}
-- 
1.7.8.rc4

--
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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux