Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

alpha: Remove usage of the deprecated "pci-dma-compat.h" API

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.
It can be found in [3].

[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/
[3]: https://lore.kernel.org/kernel-janitors/20200716192821.321233-1-christophe.jaillet@wanadoo.fr/

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>

authored by

Christophe JAILLET and committed by
Christoph Hellwig
06cc5cf1 e62c17f0

+10 -9
+4 -3
arch/alpha/include/asm/floppy.h
··· 43 43 static int prev_dir; 44 44 int dir; 45 45 46 - dir = (mode != DMA_MODE_READ) ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE; 46 + dir = (mode != DMA_MODE_READ) ? DMA_FROM_DEVICE : DMA_TO_DEVICE; 47 47 48 48 if (bus_addr 49 49 && (addr != prev_addr || size != prev_size || dir != prev_dir)) { 50 50 /* different from last time -- unmap prev */ 51 - pci_unmap_single(isa_bridge, bus_addr, prev_size, prev_dir); 51 + dma_unmap_single(&isa_bridge->dev, bus_addr, prev_size, 52 + prev_dir); 52 53 bus_addr = 0; 53 54 } 54 55 55 56 if (!bus_addr) /* need to map it */ 56 - bus_addr = pci_map_single(isa_bridge, addr, size, dir); 57 + bus_addr = dma_map_single(&isa_bridge->dev, addr, size, dir); 57 58 58 59 /* remember this one as prev */ 59 60 prev_addr = addr;
+6 -6
arch/alpha/kernel/pci_iommu.c
··· 333 333 struct pci_dev *pdev = alpha_gendev_to_pci(dev); 334 334 int dac_allowed; 335 335 336 - BUG_ON(dir == PCI_DMA_NONE); 336 + BUG_ON(dir == DMA_NONE); 337 337 338 338 dac_allowed = pdev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0; 339 339 return pci_map_single_1(pdev, (char *)page_address(page) + offset, ··· 356 356 struct pci_iommu_arena *arena; 357 357 long dma_ofs, npages; 358 358 359 - BUG_ON(dir == PCI_DMA_NONE); 359 + BUG_ON(dir == DMA_NONE); 360 360 361 361 if (dma_addr >= __direct_map_base 362 362 && dma_addr < __direct_map_base + __direct_map_size) { ··· 460 460 unsigned long attrs) 461 461 { 462 462 struct pci_dev *pdev = alpha_gendev_to_pci(dev); 463 - pci_unmap_single(pdev, dma_addr, size, PCI_DMA_BIDIRECTIONAL); 463 + dma_unmap_single(&pdev->dev, dma_addr, size, DMA_BIDIRECTIONAL); 464 464 free_pages((unsigned long)cpu_addr, get_order(size)); 465 465 466 466 DBGA2("pci_free_consistent: [%llx,%zx] from %ps\n", ··· 639 639 dma_addr_t max_dma; 640 640 int dac_allowed; 641 641 642 - BUG_ON(dir == PCI_DMA_NONE); 642 + BUG_ON(dir == DMA_NONE); 643 643 644 644 dac_allowed = dev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0; 645 645 ··· 702 702 /* Some allocation failed while mapping the scatterlist 703 703 entries. Unmap them now. */ 704 704 if (out > start) 705 - pci_unmap_sg(pdev, start, out - start, dir); 705 + dma_unmap_sg(&pdev->dev, start, out - start, dir); 706 706 return -ENOMEM; 707 707 } 708 708 ··· 722 722 dma_addr_t max_dma; 723 723 dma_addr_t fbeg, fend; 724 724 725 - BUG_ON(dir == PCI_DMA_NONE); 725 + BUG_ON(dir == DMA_NONE); 726 726 727 727 if (! alpha_mv.mv_pci_tbi) 728 728 return;