dma-mapping: fix the prototype of dma_unmap_single()
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 14 Feb 2020 07:40:18 +0000 (16:40 +0900)
committerPeng Fan <peng.fan@nxp.com>
Wed, 19 Feb 2020 13:27:30 +0000 (21:27 +0800)
dma_unmap_single() takes the dma address, not virtual address.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
arch/arm/include/asm/dma-mapping.h
arch/nds32/include/asm/dma-mapping.h
arch/riscv/include/asm/dma-mapping.h
arch/x86/include/asm/dma-mapping.h
drivers/mmc/tmio-common.c
drivers/mtd/nand/raw/denali.c
drivers/net/macb.c
drivers/usb/dwc3/core.c
drivers/usb/gadget/udc/udc-core.c

index d0895a2096668e4923aff31de120e50ab6c6c559..efdbed7280dd98f5719659b3f80c12523c1cbb37 100644 (file)
@@ -42,11 +42,9 @@ static inline dma_addr_t dma_map_single(void *vaddr, size_t len,
        return addr;
 }
 
-static inline void dma_unmap_single(volatile void *vaddr, size_t len,
+static inline void dma_unmap_single(dma_addr_t addr, size_t len,
                                    enum dma_data_direction dir)
 {
-       unsigned long addr = (unsigned long)vaddr;
-
        len = ALIGN(len, ARCH_DMA_MINALIGN);
 
        if (dir != DMA_TO_DEVICE)
index 9387dec3476880c4bc6a6574a5db94932af4a439..784f489db54ebd67a9ff16493f8601a1db4326bd 100644 (file)
@@ -34,11 +34,9 @@ static inline dma_addr_t dma_map_single(void *vaddr, size_t len,
        return addr;
 }
 
-static inline void dma_unmap_single(volatile void *vaddr, size_t len,
+static inline void dma_unmap_single(dma_addr_t addr, size_t len,
                                    enum dma_data_direction dir)
 {
-       unsigned long addr = (unsigned long)vaddr;
-
        len = ALIGN(len, ARCH_DMA_MINALIGN);
 
        if (dir != DMA_TO_DEVICE)
index eac56f8fbdfaa3e884675f071cad4009d54039af..1ac4a4fed58d7df137a34302fc395c2cc045b9c0 100644 (file)
@@ -44,11 +44,9 @@ static inline dma_addr_t dma_map_single(void *vaddr, size_t len,
        return addr;
 }
 
-static inline void dma_unmap_single(volatile void *vaddr, size_t len,
+static inline void dma_unmap_single(dma_addr_t addr, size_t len,
                                    enum dma_data_direction dir)
 {
-       unsigned long addr = (unsigned long)vaddr;
-
        len = ALIGN(len, ARCH_DMA_MINALIGN);
 
        if (dir != DMA_TO_DEVICE)
index 7e205e3313acb4b569ec62afe8aa1bb4d2fbff38..37704da5dd4ff66d68d911799e0b5f3e858ebb48 100644 (file)
@@ -42,11 +42,9 @@ static inline dma_addr_t dma_map_single(void *vaddr, size_t len,
        return addr;
 }
 
-static inline void dma_unmap_single(volatile void *vaddr, size_t len,
+static inline void dma_unmap_single(dma_addr_t addr, size_t len,
                                    enum dma_data_direction dir)
 {
-       unsigned long addr = (unsigned long)vaddr;
-
        len = ALIGN(len, ARCH_DMA_MINALIGN);
 
        if (dir != DMA_TO_DEVICE)
index 092b740f564eefb01cedd8d635f545019688ba4b..53213888473b589f421fbcd1224b85d33d7818f9 100644 (file)
@@ -353,7 +353,7 @@ static int tmio_sd_dma_xfer(struct udevice *dev, struct mmc_data *data)
        if (poll_flag == TMIO_SD_DMA_INFO1_END_RD)
                udelay(1);
 
-       dma_unmap_single(buf, len, dir);
+       dma_unmap_single(dma_addr, len, dir);
 
        return ret;
 }
index f51d3e25c762c28b867b16293bad46fa66c67d76..3e0ac39777d8c9c3114e36d5efca4e401120c6ad 100644 (file)
@@ -581,7 +581,7 @@ static int denali_dma_xfer(struct denali_nand_info *denali, void *buf,
 
        iowrite32(0, denali->reg + DMA_ENABLE);
 
-       dma_unmap_single(buf, size, dir);
+       dma_unmap_single(dma_addr, size, dir);
 
        if (irq_status & INTR__ERASED_PAGE)
                memset(buf, 0xff, size);
index 0d4929bec1319783e31859d7e3ed21aa30cf6fd4..7a2b1abeeb03a135641a56fe45d704598d51de4d 100644 (file)
@@ -342,7 +342,7 @@ static int _macb_send(struct macb_device *macb, const char *name, void *packet,
                udelay(1);
        }
 
-       dma_unmap_single(packet, length, DMA_TO_DEVICE);
+       dma_unmap_single(paddr, length, DMA_TO_DEVICE);
 
        if (i <= MACB_TX_TIMEOUT) {
                if (ctrl & MACB_BIT(TX_UNDERRUN))
index c5066529b7d0a50f597775f9f03ac1e1835e512d..6ad1000c9af63f1bb7c332e2b21575037354f149 100644 (file)
@@ -288,8 +288,8 @@ static int dwc3_setup_scratch_buffers(struct dwc3 *dwc)
        return 0;
 
 err1:
-       dma_unmap_single((void *)(uintptr_t)dwc->scratch_addr, dwc->nr_scratch *
-                        DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL);
+       dma_unmap_single(scratch_addr, dwc->nr_scratch * DWC3_SCRATCHBUF_SIZE,
+                        DMA_BIDIRECTIONAL);
 
 err0:
        return ret;
@@ -303,7 +303,7 @@ static void dwc3_free_scratch_buffers(struct dwc3 *dwc)
        if (!dwc->nr_scratch)
                return;
 
-       dma_unmap_single((void *)(uintptr_t)dwc->scratch_addr, dwc->nr_scratch *
+       dma_unmap_single(dwc->scratch_addr, dwc->nr_scratch *
                         DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL);
        kfree(dwc->scratchbuf);
 }
index a33ab5c95d4ebb0a875df6c61f7d0d684ad22ed5..528874507b41ae65fd02ebd8a99c40da636e5275 100644 (file)
@@ -67,7 +67,7 @@ void usb_gadget_unmap_request(struct usb_gadget *gadget,
        if (req->length == 0)
                return;
 
-       dma_unmap_single((void *)(uintptr_t)req->dma, req->length,
+       dma_unmap_single(req->dma, req->length,
                         is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
 }
 EXPORT_SYMBOL_GPL(usb_gadget_unmap_request);