linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [13/18] fotg210-udc: pass struct device to DMA API functions
@ 2019-02-01  8:47 Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2019-02-01  8:47 UTC (permalink / raw)
  To: John Crispin, Vinod Koul, Dmitry Tarnyagin, Nicolas Ferre,
	Sudip Mukherjee, Felipe Balbi, linux-mips, linux-kernel,
	dmaengine, netdev, linux-usb, linux-fbdev, alsa-devel
  Cc: iommu

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>
---
 drivers/usb/gadget/udc/fotg210-udc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c
index fe9cf415f2f1..cec49294bac6 100644
--- a/drivers/usb/gadget/udc/fotg210-udc.c
+++ b/drivers/usb/gadget/udc/fotg210-udc.c
@@ -326,6 +326,7 @@ static void fotg210_wait_dma_done(struct fotg210_ep *ep)
 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,

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [13/18] fotg210-udc: pass struct device to DMA API functions
@ 2019-02-01 13:20 Felipe Balbi
  0 siblings, 0 replies; 2+ messages in thread
From: Felipe Balbi @ 2019-02-01 13:20 UTC (permalink / raw)
  To: Christoph Hellwig, John Crispin, Vinod Koul, Dmitry Tarnyagin,
	Nicolas Ferre, Sudip Mukherjee, linux-mips, linux-kernel,
	dmaengine, netdev, linux-usb, linux-fbdev, alsa-devel
  Cc: iommu

Christoph Hellwig <hch@lst.de> writes:

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

In case you're taking the entire series:

Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-01 13:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-01 13:20 [13/18] fotg210-udc: pass struct device to DMA API functions Felipe Balbi
  -- strict thread matches above, loose matches on Subject: below --
2019-02-01  8:47 Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).