diff options
Diffstat (limited to 'drivers/usb/gadget/net2272.c')
-rw-r--r-- | drivers/usb/gadget/net2272.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/usb/gadget/net2272.c b/drivers/usb/gadget/net2272.c index 7322d293213e..01ae56f47174 100644 --- a/drivers/usb/gadget/net2272.c +++ b/drivers/usb/gadget/net2272.c | |||
@@ -385,12 +385,9 @@ net2272_done(struct net2272_ep *ep, struct net2272_request *req, int status) | |||
385 | status = req->req.status; | 385 | status = req->req.status; |
386 | 386 | ||
387 | dev = ep->dev; | 387 | dev = ep->dev; |
388 | if (use_dma && req->mapped) { | 388 | if (use_dma && ep->dma) |
389 | dma_unmap_single(dev->dev, req->req.dma, req->req.length, | 389 | usb_gadget_unmap_request(&dev->gadget, &req->req, |
390 | ep->is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | 390 | ep->is_in); |
391 | req->req.dma = DMA_ADDR_INVALID; | ||
392 | req->mapped = 0; | ||
393 | } | ||
394 | 391 | ||
395 | if (status && status != -ESHUTDOWN) | 392 | if (status && status != -ESHUTDOWN) |
396 | dev_vdbg(dev->dev, "complete %s req %p stat %d len %u/%u buf %p\n", | 393 | dev_vdbg(dev->dev, "complete %s req %p stat %d len %u/%u buf %p\n", |
@@ -850,10 +847,11 @@ net2272_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) | |||
850 | return -ESHUTDOWN; | 847 | return -ESHUTDOWN; |
851 | 848 | ||
852 | /* set up dma mapping in case the caller didn't */ | 849 | /* set up dma mapping in case the caller didn't */ |
853 | if (use_dma && ep->dma && _req->dma == DMA_ADDR_INVALID) { | 850 | if (use_dma && ep->dma) { |
854 | _req->dma = dma_map_single(dev->dev, _req->buf, _req->length, | 851 | status = usb_gadget_map_request(&dev->gadget, _req, |
855 | ep->is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | 852 | ep->is_in); |
856 | req->mapped = 1; | 853 | if (status) |
854 | return status; | ||
857 | } | 855 | } |
858 | 856 | ||
859 | dev_vdbg(dev->dev, "%s queue req %p, len %d buf %p dma %08llx %s\n", | 857 | dev_vdbg(dev->dev, "%s queue req %p, len %d buf %p dma %08llx %s\n", |