fotg210-udc: pass struct device to DMA API functions
authorChristoph Hellwig <hch@lst.de>
Fri, 1 Feb 2019 08:47:56 +0000 (09:47 +0100)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 11 Feb 2019 13:30:14 +0000 (15:30 +0200)
The DMA API generally relies on a struct device to work properly, and
only barely works without one for legacy reasons.  Pass the easily
available struct device from the platform_device to remedy this.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/udc/fotg210-udc.c

index fe9cf415f2f1acc43e40f36c2ddfee0cb55b5a28..cec49294bac64736cd6b90755292d1718b982b06 100644 (file)
@@ -326,6 +326,7 @@ dma_reset:
 static void fotg210_start_dma(struct fotg210_ep *ep,
                        struct fotg210_request *req)
 {
+       struct device *dev = &ep->fotg210->gadget.dev;
        dma_addr_t d;
        u8 *buffer;
        u32 length;
@@ -348,10 +349,10 @@ static void fotg210_start_dma(struct fotg210_ep *ep,
                        length = req->req.length;
        }
 
-       d = dma_map_single(NULL, buffer, length,
+       d = dma_map_single(dev, buffer, length,
                        ep->dir_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
 
-       if (dma_mapping_error(NULL, d)) {
+       if (dma_mapping_error(dev, d)) {
                pr_err("dma_mapping_error\n");
                return;
        }
@@ -366,7 +367,7 @@ static void fotg210_start_dma(struct fotg210_ep *ep,
        /* update actual transfer length */
        req->req.actual += length;
 
-       dma_unmap_single(NULL, d, length, DMA_TO_DEVICE);
+       dma_unmap_single(dev, d, length, DMA_TO_DEVICE);
 }
 
 static void fotg210_ep0_queue(struct fotg210_ep *ep,