Skip to content

Commit a20388b

Browse files
author
Christoph Hellwig
committed
alpha: remove the mapping_error dma_map_ops method
Return DMA_MAPPING_ERROR instead of 0 on a dma mapping failure and let the core dma-mapping code handle the rest. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 52f0b3e commit a20388b

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

arch/alpha/kernel/pci_iommu.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ pci_map_single_1(struct pci_dev *pdev, void *cpu_addr, size_t size,
291291
use direct_map above, it now must be considered an error. */
292292
if (! alpha_mv.mv_pci_tbi) {
293293
printk_once(KERN_WARNING "pci_map_single: no HW sg\n");
294-
return 0;
294+
return DMA_MAPPING_ERROR;
295295
}
296296

297297
arena = hose->sg_pci;
@@ -307,7 +307,7 @@ pci_map_single_1(struct pci_dev *pdev, void *cpu_addr, size_t size,
307307
if (dma_ofs < 0) {
308308
printk(KERN_WARNING "pci_map_single failed: "
309309
"could not allocate dma page tables\n");
310-
return 0;
310+
return DMA_MAPPING_ERROR;
311311
}
312312

313313
paddr &= PAGE_MASK;
@@ -455,7 +455,7 @@ static void *alpha_pci_alloc_coherent(struct device *dev, size_t size,
455455
memset(cpu_addr, 0, size);
456456

457457
*dma_addrp = pci_map_single_1(pdev, cpu_addr, size, 0);
458-
if (*dma_addrp == 0) {
458+
if (*dma_addrp == DMA_MAPPING_ERROR) {
459459
free_pages((unsigned long)cpu_addr, order);
460460
if (alpha_mv.mv_pci_tbi || (gfp & GFP_DMA))
461461
return NULL;
@@ -671,7 +671,7 @@ static int alpha_pci_map_sg(struct device *dev, struct scatterlist *sg,
671671
sg->dma_address
672672
= pci_map_single_1(pdev, SG_ENT_VIRT_ADDRESS(sg),
673673
sg->length, dac_allowed);
674-
return sg->dma_address != 0;
674+
return sg->dma_address != DMA_MAPPING_ERROR;
675675
}
676676

677677
start = sg;
@@ -935,19 +935,13 @@ iommu_unbind(struct pci_iommu_arena *arena, long pg_start, long pg_count)
935935
return 0;
936936
}
937937

938-
static int alpha_pci_mapping_error(struct device *dev, dma_addr_t dma_addr)
939-
{
940-
return dma_addr == 0;
941-
}
942-
943938
const struct dma_map_ops alpha_pci_ops = {
944939
.alloc = alpha_pci_alloc_coherent,
945940
.free = alpha_pci_free_coherent,
946941
.map_page = alpha_pci_map_page,
947942
.unmap_page = alpha_pci_unmap_page,
948943
.map_sg = alpha_pci_map_sg,
949944
.unmap_sg = alpha_pci_unmap_sg,
950-
.mapping_error = alpha_pci_mapping_error,
951945
.dma_supported = alpha_pci_supported,
952946
};
953947
EXPORT_SYMBOL(alpha_pci_ops);

0 commit comments

Comments
 (0)