[PATCH] floppy: Remove usage of the deprecated "pci-dma-compat.h" API

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE1701d LANDED

Landed in mainline as e57c2fd6cdf8 on 2022-01-04.

3 messages, 3 authors, 2022-01-10 · open the first message on its own page

[PATCH] floppy: Remove usage of the deprecated "pci-dma-compat.h" API

From: Christophe JAILLET <hidden>
Date: 2022-01-02 10:30:01

In [1], Christoph Hellwig has proposed to remove the wrappers in
include/linux/pci-dma-compat.h.

Some reasons why this API should be removed have been given by Julia
Lawall in [2].

A coccinelle script has been used to perform the needed transformation
Only relevant parts are given below.
@@ @@
-    PCI_DMA_TODEVICE
+    DMA_TO_DEVICE
@@ @@
-    PCI_DMA_FROMDEVICE
+    DMA_FROM_DEVICE
@@
expression e1, e2, e3, e4;
@@
-    pci_map_single(e1, e2, e3, e4)
+    dma_map_single(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_unmap_single(e1, e2, e3, e4)
+    dma_unmap_single(&e1->dev, e2, e3, e4)

[1]: https://lore.kernel.org/kernel-janitors/20200421081257.GA131897@infradead.org/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/

Signed-off-by: Christophe JAILLET <redacted>
---
 arch/powerpc/include/asm/floppy.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/include/asm/floppy.h b/arch/powerpc/include/asm/floppy.h
index 7af9a68fd949..f8ce178b43b7 100644
--- a/arch/powerpc/include/asm/floppy.h
+++ b/arch/powerpc/include/asm/floppy.h
@@ -134,17 +134,19 @@ static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)
 	int dir;
 
 	doing_vdma = 0;
-	dir = (mode == DMA_MODE_READ) ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE;
+	dir = (mode == DMA_MODE_READ) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
 
 	if (bus_addr 
 	    && (addr != prev_addr || size != prev_size || dir != prev_dir)) {
 		/* different from last time -- unmap prev */
-		pci_unmap_single(isa_bridge_pcidev, bus_addr, prev_size, prev_dir);
+		dma_unmap_single(&isa_bridge_pcidev->dev, bus_addr, prev_size,
+				 prev_dir);
 		bus_addr = 0;
 	}
 
 	if (!bus_addr)	/* need to map it */
-		bus_addr = pci_map_single(isa_bridge_pcidev, addr, size, dir);
+		bus_addr = dma_map_single(&isa_bridge_pcidev->dev, addr, size,
+					  dir);
 
 	/* remember this one as prev */
 	prev_addr = addr;
-- 
2.32.0

Re: [PATCH] floppy: Remove usage of the deprecated "pci-dma-compat.h" API

From: Christoph Hellwig <hch@infradead.org>
Date: 2022-01-03 09:24:24

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

Re: [PATCH] floppy: Remove usage of the deprecated "pci-dma-compat.h" API

From: Michael Ellerman <hidden>
Date: 2022-01-10 01:51:38

On Sun, 2 Jan 2022 11:29:54 +0100, Christophe JAILLET wrote:
In [1], Christoph Hellwig has proposed to remove the wrappers in
include/linux/pci-dma-compat.h.

Some reasons why this API should be removed have been given by Julia
Lawall in [2].

A coccinelle script has been used to perform the needed transformation
Only relevant parts are given below.

[...]
Applied to powerpc/next.

[1/1] floppy: Remove usage of the deprecated "pci-dma-compat.h" API
      https://git.kernel.org/powerpc/c/e57c2fd6cdf8db581ac93b909b2664751e7cf30c

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help