summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-11-21 13:38:19 -0500
committerChristoph Hellwig <hch@lst.de>2018-12-06 09:56:49 -0500
commita4abe0ad10654b122caed873d8a7a58989d7cf9b (patch)
treedaf599491f4bbfd5451303c66aa3eebe7877b98e
parentcad34be747b8a92146e71c8267f2c1d6794e34c0 (diff)
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>
-rw-r--r--drivers/xen/swiotlb-xen.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
index 2a7f545bd0b5..6dc969d5ea2f 100644
--- a/drivers/xen/swiotlb-xen.c
+++ b/drivers/xen/swiotlb-xen.c
@@ -53,8 +53,6 @@
53 * API. 53 * API.
54 */ 54 */
55 55
56#define XEN_SWIOTLB_ERROR_CODE (~(dma_addr_t)0x0)
57
58static char *xen_io_tlb_start, *xen_io_tlb_end; 56static char *xen_io_tlb_start, *xen_io_tlb_end;
59static unsigned long xen_io_tlb_nslabs; 57static unsigned long xen_io_tlb_nslabs;
60/* 58/*
@@ -406,7 +404,7 @@ static dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
406 map = swiotlb_tbl_map_single(dev, start_dma_addr, phys, size, dir, 404 map = swiotlb_tbl_map_single(dev, start_dma_addr, phys, size, dir,
407 attrs); 405 attrs);
408 if (map == SWIOTLB_MAP_ERROR) 406 if (map == SWIOTLB_MAP_ERROR)
409 return XEN_SWIOTLB_ERROR_CODE; 407 return DMA_MAPPING_ERROR;
410 408
411 dev_addr = xen_phys_to_bus(map); 409 dev_addr = xen_phys_to_bus(map);
412 xen_dma_map_page(dev, pfn_to_page(map >> PAGE_SHIFT), 410 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,
421 attrs |= DMA_ATTR_SKIP_CPU_SYNC; 419 attrs |= DMA_ATTR_SKIP_CPU_SYNC;
422 swiotlb_tbl_unmap_single(dev, map, size, dir, attrs); 420 swiotlb_tbl_unmap_single(dev, map, size, dir, attrs);
423 421
424 return XEN_SWIOTLB_ERROR_CODE; 422 return DMA_MAPPING_ERROR;
425} 423}
426 424
427/* 425/*
@@ -700,11 +698,6 @@ xen_swiotlb_get_sgtable(struct device *dev, struct sg_table *sgt,
700 return dma_common_get_sgtable(dev, sgt, cpu_addr, handle, size, attrs); 698 return dma_common_get_sgtable(dev, sgt, cpu_addr, handle, size, attrs);
701} 699}
702 700
703static int xen_swiotlb_mapping_error(struct device *dev, dma_addr_t dma_addr)
704{
705 return dma_addr == XEN_SWIOTLB_ERROR_CODE;
706}
707
708const struct dma_map_ops xen_swiotlb_dma_ops = { 701const struct dma_map_ops xen_swiotlb_dma_ops = {
709 .alloc = xen_swiotlb_alloc_coherent, 702 .alloc = xen_swiotlb_alloc_coherent,
710 .free = xen_swiotlb_free_coherent, 703 .free = xen_swiotlb_free_coherent,
@@ -719,5 +712,4 @@ const struct dma_map_ops xen_swiotlb_dma_ops = {
719 .dma_supported = xen_swiotlb_dma_supported, 712 .dma_supported = xen_swiotlb_dma_supported,
720 .mmap = xen_swiotlb_dma_mmap, 713 .mmap = xen_swiotlb_dma_mmap,
721 .get_sgtable = xen_swiotlb_get_sgtable, 714 .get_sgtable = xen_swiotlb_get_sgtable,
722 .mapping_error = xen_swiotlb_mapping_error,
723}; 715};