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

ARM/dma-mapping: merge __dma_supported into arm_dma_supported

Merge __dma_supported into its only caller, and move the resulting
function so that it doesn't need a forward declaration. Also mark
it static as there are no callers outside of dma-mapping.c.

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

+17 -26
-2
arch/arm/include/asm/dma-iommu.h
··· 33 33 struct dma_iommu_mapping *mapping); 34 34 void arm_iommu_detach_device(struct device *dev); 35 35 36 - int arm_dma_supported(struct device *dev, u64 mask); 37 - 38 36 #endif /* __KERNEL__ */ 39 37 #endif
+17 -24
arch/arm/mm/dma-mapping.c
··· 179 179 __dma_page_cpu_to_dev(page, offset, size, dir); 180 180 } 181 181 182 + /* 183 + * Return whether the given device DMA address mask can be supported 184 + * properly. For example, if your device can only drive the low 24-bits 185 + * during bus mastering, then you would pass 0x00ffffff as the mask 186 + * to this function. 187 + */ 188 + static int arm_dma_supported(struct device *dev, u64 mask) 189 + { 190 + unsigned long max_dma_pfn = min(max_pfn - 1, arm_dma_pfn_limit); 191 + 192 + /* 193 + * Translate the device's DMA mask to a PFN limit. This 194 + * PFN number includes the page which we can DMA to. 195 + */ 196 + return dma_to_pfn(dev, mask) >= max_dma_pfn; 197 + } 198 + 182 199 const struct dma_map_ops arm_dma_ops = { 183 200 .alloc = arm_dma_alloc, 184 201 .free = arm_dma_free, ··· 235 218 .get_required_mask = dma_direct_get_required_mask, 236 219 }; 237 220 EXPORT_SYMBOL(arm_coherent_dma_ops); 238 - 239 - static int __dma_supported(struct device *dev, u64 mask) 240 - { 241 - unsigned long max_dma_pfn = min(max_pfn - 1, arm_dma_pfn_limit); 242 - 243 - /* 244 - * Translate the device's DMA mask to a PFN limit. This 245 - * PFN number includes the page which we can DMA to. 246 - */ 247 - if (dma_to_pfn(dev, mask) < max_dma_pfn) 248 - return 0; 249 - return 1; 250 - } 251 221 252 222 static void __dma_clear_buffer(struct page *page, size_t size, int coherent_flag) 253 223 { ··· 1056 1052 for_each_sg(sg, s, nents, i) 1057 1053 ops->sync_single_for_device(dev, sg_dma_address(s), s->length, 1058 1054 dir); 1059 - } 1060 - 1061 - /* 1062 - * Return whether the given device DMA address mask can be supported 1063 - * properly. For example, if your device can only drive the low 24-bits 1064 - * during bus mastering, then you would pass 0x00ffffff as the mask 1065 - * to this function. 1066 - */ 1067 - int arm_dma_supported(struct device *dev, u64 mask) 1068 - { 1069 - return __dma_supported(dev, mask); 1070 1055 } 1071 1056 1072 1057 static const struct dma_map_ops *arm_get_dma_map_ops(bool coherent)