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

mips/jazz: remove the mapping_error dma_map_ops method

The Jazz iommu code already returns (~(dma_addr_t)0x0) on mapping
failures, so we can switch over to returning DMA_MAPPING_ERROR 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>

+5 -17
-6
arch/mips/include/asm/jazzdma.h
··· 40 40 #define VDMA_OFFSET(a) ((unsigned int)(a) & (VDMA_PAGESIZE-1)) 41 41 42 42 /* 43 - * error code returned by vdma_alloc() 44 - * (See also arch/mips/kernel/jazzdma.c) 45 - */ 46 - #define VDMA_ERROR 0xffffffff 47 - 48 - /* 49 43 * VDMA pagetable entry description 50 44 */ 51 45 typedef volatile struct VDMA_PGTBL_ENTRY {
+5 -11
arch/mips/jazz/jazzdma.c
··· 104 104 if (vdma_debug) 105 105 printk("vdma_alloc: Invalid physical address: %08lx\n", 106 106 paddr); 107 - return VDMA_ERROR; /* invalid physical address */ 107 + return DMA_MAPPING_ERROR; /* invalid physical address */ 108 108 } 109 109 if (size > 0x400000 || size == 0) { 110 110 if (vdma_debug) 111 111 printk("vdma_alloc: Invalid size: %08lx\n", size); 112 - return VDMA_ERROR; /* invalid physical address */ 112 + return DMA_MAPPING_ERROR; /* invalid physical address */ 113 113 } 114 114 115 115 spin_lock_irqsave(&vdma_lock, flags); ··· 123 123 first < VDMA_PGTBL_ENTRIES) first++; 124 124 if (first + pages > VDMA_PGTBL_ENTRIES) { /* nothing free */ 125 125 spin_unlock_irqrestore(&vdma_lock, flags); 126 - return VDMA_ERROR; 126 + return DMA_MAPPING_ERROR; 127 127 } 128 128 129 129 last = first + 1; ··· 569 569 return NULL; 570 570 571 571 *dma_handle = vdma_alloc(virt_to_phys(ret), size); 572 - if (*dma_handle == VDMA_ERROR) { 572 + if (*dma_handle == DMA_MAPPING_ERROR) { 573 573 dma_direct_free_pages(dev, size, ret, *dma_handle, attrs); 574 574 return NULL; 575 575 } ··· 620 620 arch_sync_dma_for_device(dev, sg_phys(sg), sg->length, 621 621 dir); 622 622 sg->dma_address = vdma_alloc(sg_phys(sg), sg->length); 623 - if (sg->dma_address == VDMA_ERROR) 623 + if (sg->dma_address == DMA_MAPPING_ERROR) 624 624 return 0; 625 625 sg_dma_len(sg) = sg->length; 626 626 } ··· 674 674 arch_sync_dma_for_cpu(dev, sg_phys(sg), sg->length, dir); 675 675 } 676 676 677 - static int jazz_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) 678 - { 679 - return dma_addr == VDMA_ERROR; 680 - } 681 - 682 677 const struct dma_map_ops jazz_dma_ops = { 683 678 .alloc = jazz_dma_alloc, 684 679 .free = jazz_dma_free, ··· 687 692 .sync_sg_for_device = jazz_dma_sync_sg_for_device, 688 693 .dma_supported = dma_direct_supported, 689 694 .cache_sync = arch_dma_cache_sync, 690 - .mapping_error = jazz_dma_mapping_error, 691 695 }; 692 696 EXPORT_SYMBOL(jazz_dma_ops);