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

x86/dma: Remove the x86_dma_fallback_dev hack

Now that we removed support for the NULL device argument in the DMA API,
there is no need to cater for that in the x86 code.

Signed-off-by: Christoph Hellwig <hch@lst.de>

-43
-10
arch/x86/include/asm/dma-mapping.h
··· 13 13 #include <asm/swiotlb.h> 14 14 #include <linux/dma-contiguous.h> 15 15 16 - #ifdef CONFIG_ISA 17 - # define ISA_DMA_BIT_MASK DMA_BIT_MASK(24) 18 - #else 19 - # define ISA_DMA_BIT_MASK DMA_BIT_MASK(32) 20 - #endif 21 - 22 16 extern int iommu_merge; 23 - extern struct device x86_dma_fallback_dev; 24 17 extern int panic_on_overflow; 25 18 26 19 extern const struct dma_map_ops *dma_ops; ··· 22 29 { 23 30 return dma_ops; 24 31 } 25 - 26 - bool arch_dma_alloc_attrs(struct device **dev); 27 - #define arch_dma_alloc_attrs arch_dma_alloc_attrs 28 32 29 33 #endif
-6
arch/x86/kernel/amd_gart_64.c
··· 233 233 unsigned long bus; 234 234 phys_addr_t paddr = page_to_phys(page) + offset; 235 235 236 - if (!dev) 237 - dev = &x86_dma_fallback_dev; 238 - 239 236 if (!need_iommu(dev, paddr, size)) 240 237 return paddr; 241 238 ··· 388 391 389 392 if (nents == 0) 390 393 return 0; 391 - 392 - if (!dev) 393 - dev = &x86_dma_fallback_dev; 394 394 395 395 out = 0; 396 396 start = 0;
-20
arch/x86/kernel/pci-dma.c
··· 51 51 52 52 extern struct iommu_table_entry __iommu_table[], __iommu_table_end[]; 53 53 54 - /* Dummy device used for NULL arguments (normally ISA). */ 55 - struct device x86_dma_fallback_dev = { 56 - .init_name = "fallback device", 57 - .coherent_dma_mask = ISA_DMA_BIT_MASK, 58 - .dma_mask = &x86_dma_fallback_dev.coherent_dma_mask, 59 - }; 60 - EXPORT_SYMBOL(x86_dma_fallback_dev); 61 - 62 54 void __init pci_iommu_alloc(void) 63 55 { 64 56 struct iommu_table_entry *p; ··· 68 76 } 69 77 } 70 78 } 71 - 72 - bool arch_dma_alloc_attrs(struct device **dev) 73 - { 74 - if (!*dev) 75 - *dev = &x86_dma_fallback_dev; 76 - 77 - if (!is_device_dma_capable(*dev)) 78 - return false; 79 - return true; 80 - 81 - } 82 - EXPORT_SYMBOL(arch_dma_alloc_attrs); 83 79 84 80 /* 85 81 * See <Documentation/x86/x86_64/boot-options.txt> for the iommu kernel
-7
kernel/dma/mapping.c
··· 238 238 } 239 239 EXPORT_SYMBOL_GPL(dma_get_required_mask); 240 240 241 - #ifndef arch_dma_alloc_attrs 242 - #define arch_dma_alloc_attrs(dev) (true) 243 - #endif 244 - 245 241 void *dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle, 246 242 gfp_t flag, unsigned long attrs) 247 243 { ··· 251 255 252 256 /* let the implementation decide on the zone to allocate from: */ 253 257 flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM); 254 - 255 - if (!arch_dma_alloc_attrs(&dev)) 256 - return NULL; 257 258 258 259 if (dma_is_direct(ops)) 259 260 cpu_addr = dma_direct_alloc(dev, size, dma_handle, flag, attrs);