Skip to content

Commit 06cc5cf

Browse files
tititiou36Christoph Hellwig
authored andcommitted
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>
1 parent e62c17f commit 06cc5cf

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

arch/alpha/include/asm/floppy.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,18 @@ alpha_fd_dma_setup(char *addr, unsigned long size, int mode, int io)
4343
static int prev_dir;
4444
int dir;
4545

46-
dir = (mode != DMA_MODE_READ) ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE;
46+
dir = (mode != DMA_MODE_READ) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
4747

4848
if (bus_addr
4949
&& (addr != prev_addr || size != prev_size || dir != prev_dir)) {
5050
/* 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);
5253
bus_addr = 0;
5354
}
5455

5556
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);
5758

5859
/* remember this one as prev */
5960
prev_addr = addr;

arch/alpha/kernel/pci_iommu.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ static dma_addr_t alpha_pci_map_page(struct device *dev, struct page *page,
333333
struct pci_dev *pdev = alpha_gendev_to_pci(dev);
334334
int dac_allowed;
335335

336-
BUG_ON(dir == PCI_DMA_NONE);
336+
BUG_ON(dir == DMA_NONE);
337337

338338
dac_allowed = pdev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0;
339339
return pci_map_single_1(pdev, (char *)page_address(page) + offset,
@@ -356,7 +356,7 @@ static void alpha_pci_unmap_page(struct device *dev, dma_addr_t dma_addr,
356356
struct pci_iommu_arena *arena;
357357
long dma_ofs, npages;
358358

359-
BUG_ON(dir == PCI_DMA_NONE);
359+
BUG_ON(dir == DMA_NONE);
360360

361361
if (dma_addr >= __direct_map_base
362362
&& dma_addr < __direct_map_base + __direct_map_size) {
@@ -460,7 +460,7 @@ static void alpha_pci_free_coherent(struct device *dev, size_t size,
460460
unsigned long attrs)
461461
{
462462
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);
464464
free_pages((unsigned long)cpu_addr, get_order(size));
465465

466466
DBGA2("pci_free_consistent: [%llx,%zx] from %ps\n",
@@ -639,7 +639,7 @@ static int alpha_pci_map_sg(struct device *dev, struct scatterlist *sg,
639639
dma_addr_t max_dma;
640640
int dac_allowed;
641641

642-
BUG_ON(dir == PCI_DMA_NONE);
642+
BUG_ON(dir == DMA_NONE);
643643

644644
dac_allowed = dev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0;
645645

@@ -702,7 +702,7 @@ static int alpha_pci_map_sg(struct device *dev, struct scatterlist *sg,
702702
/* Some allocation failed while mapping the scatterlist
703703
entries. Unmap them now. */
704704
if (out > start)
705-
pci_unmap_sg(pdev, start, out - start, dir);
705+
dma_unmap_sg(&pdev->dev, start, out - start, dir);
706706
return -ENOMEM;
707707
}
708708

@@ -722,7 +722,7 @@ static void alpha_pci_unmap_sg(struct device *dev, struct scatterlist *sg,
722722
dma_addr_t max_dma;
723723
dma_addr_t fbeg, fend;
724724

725-
BUG_ON(dir == PCI_DMA_NONE);
725+
BUG_ON(dir == DMA_NONE);
726726

727727
if (! alpha_mv.mv_pci_tbi)
728728
return;

0 commit comments

Comments
 (0)