Skip to content

Commit a4abe0a

Browse files
author
Christoph Hellwig
committed
xen-swiotlb: 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 cad34be commit a4abe0a

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

drivers/xen/swiotlb-xen.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@
5353
* API.
5454
*/
5555

56-
#define XEN_SWIOTLB_ERROR_CODE (~(dma_addr_t)0x0)
57-
5856
static char *xen_io_tlb_start, *xen_io_tlb_end;
5957
static unsigned long xen_io_tlb_nslabs;
6058
/*
@@ -406,7 +404,7 @@ static dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
406404
map = swiotlb_tbl_map_single(dev, start_dma_addr, phys, size, dir,
407405
attrs);
408406
if (map == SWIOTLB_MAP_ERROR)
409-
return XEN_SWIOTLB_ERROR_CODE;
407+
return DMA_MAPPING_ERROR;
410408

411409
dev_addr = xen_phys_to_bus(map);
412410
xen_dma_map_page(dev, pfn_to_page(map >> PAGE_SHIFT),
@@ -421,7 +419,7 @@ static dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
421419
attrs |= DMA_ATTR_SKIP_CPU_SYNC;
422420
swiotlb_tbl_unmap_single(dev, map, size, dir, attrs);
423421

424-
return XEN_SWIOTLB_ERROR_CODE;
422+
return DMA_MAPPING_ERROR;
425423
}
426424

427425
/*
@@ -700,11 +698,6 @@ xen_swiotlb_get_sgtable(struct device *dev, struct sg_table *sgt,
700698
return dma_common_get_sgtable(dev, sgt, cpu_addr, handle, size, attrs);
701699
}
702700

703-
static int xen_swiotlb_mapping_error(struct device *dev, dma_addr_t dma_addr)
704-
{
705-
return dma_addr == XEN_SWIOTLB_ERROR_CODE;
706-
}
707-
708701
const struct dma_map_ops xen_swiotlb_dma_ops = {
709702
.alloc = xen_swiotlb_alloc_coherent,
710703
.free = xen_swiotlb_free_coherent,
@@ -719,5 +712,4 @@ const struct dma_map_ops xen_swiotlb_dma_ops = {
719712
.dma_supported = xen_swiotlb_dma_supported,
720713
.mmap = xen_swiotlb_dma_mmap,
721714
.get_sgtable = xen_swiotlb_get_sgtable,
722-
.mapping_error = xen_swiotlb_mapping_error,
723715
};

0 commit comments

Comments
 (0)