usb: gadget: net2272: use generic map/umap routines

those routines have everything we need to map/unmap
USB requests and it's better to use them.

Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
Felipe Balbi 2011-12-19 12:07:40 +02:00
parent 05d00fbe87
commit af93f2c77a
1 changed files with 8 additions and 10 deletions

View File

@ -385,12 +385,9 @@ net2272_done(struct net2272_ep *ep, struct net2272_request *req, int status)
status = req->req.status; status = req->req.status;
dev = ep->dev; dev = ep->dev;
if (use_dma && req->mapped) { if (use_dma && ep->dma)
dma_unmap_single(dev->dev, req->req.dma, req->req.length, usb_gadget_unmap_request(&dev->gadget, &req->req,
ep->is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); ep->is_in);
req->req.dma = DMA_ADDR_INVALID;
req->mapped = 0;
}
if (status && status != -ESHUTDOWN) if (status && status != -ESHUTDOWN)
dev_vdbg(dev->dev, "complete %s req %p stat %d len %u/%u buf %p\n", 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)
return -ESHUTDOWN; return -ESHUTDOWN;
/* set up dma mapping in case the caller didn't */ /* set up dma mapping in case the caller didn't */
if (use_dma && ep->dma && _req->dma == DMA_ADDR_INVALID) { if (use_dma && ep->dma) {
_req->dma = dma_map_single(dev->dev, _req->buf, _req->length, status = usb_gadget_map_request(&dev->gadget, _req,
ep->is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); ep->is_in);
req->mapped = 1; if (status)
return status;
} }
dev_vdbg(dev->dev, "%s queue req %p, len %d buf %p dma %08llx %s\n", dev_vdbg(dev->dev, "%s queue req %p, len %d buf %p dma %08llx %s\n",