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

dma-mapping: move dma-debug.h to kernel/dma/

Most of dma-debug.h is not required by anything outside of kernel/dma.
Move the four declarations needed by dma-mappin.h or dma-ops providers
into dma-mapping.h and dma-map-ops.h, and move the remainder of the
file to kernel/dma/debug.h.

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

+34 -52
-1
arch/arm/include/asm/dma-iommu.h
··· 6 6 7 7 #include <linux/mm_types.h> 8 8 #include <linux/scatterlist.h> 9 - #include <linux/dma-debug.h> 10 9 #include <linux/kref.h> 11 10 12 11 struct dma_iommu_mapping {
-1
arch/arm/include/asm/dma-mapping.h
··· 6 6 7 7 #include <linux/mm_types.h> 8 8 #include <linux/scatterlist.h> 9 - #include <linux/dma-debug.h> 10 9 11 10 #include <xen/xen.h> 12 11 #include <asm/xen/hypervisor.h>
-1
arch/microblaze/kernel/dma.c
··· 10 10 #include <linux/device.h> 11 11 #include <linux/dma-noncoherent.h> 12 12 #include <linux/gfp.h> 13 - #include <linux/dma-debug.h> 14 13 #include <linux/export.h> 15 14 #include <linux/bug.h> 16 15 #include <asm/cacheflush.h>
-1
arch/sh/drivers/pci/pci.c
··· 13 13 #include <linux/pci.h> 14 14 #include <linux/init.h> 15 15 #include <linux/types.h> 16 - #include <linux/dma-debug.h> 17 16 #include <linux/io.h> 18 17 #include <linux/mutex.h> 19 18 #include <linux/spinlock.h>
-1
arch/x86/include/asm/dma-mapping.h
··· 8 8 */ 9 9 10 10 #include <linux/scatterlist.h> 11 - #include <linux/dma-debug.h> 12 11 #include <asm/io.h> 13 12 #include <asm/swiotlb.h> 14 13
-1
arch/x86/kernel/pci-dma.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <linux/dma-map-ops.h> 3 3 #include <linux/dma-direct.h> 4 - #include <linux/dma-debug.h> 5 4 #include <linux/iommu.h> 6 5 #include <linux/dmar.h> 7 6 #include <linux/export.h>
+1
drivers/pci/pci-driver.c
··· 19 19 #include <linux/kexec.h> 20 20 #include <linux/of_device.h> 21 21 #include <linux/acpi.h> 22 + #include <linux/dma-map-ops.h> 22 23 #include "pci.h" 23 24 #include "pcie/portdrv.h" 24 25
+3 -41
include/linux/dma-debug.h kernel/dma/debug.h
··· 5 5 * Author: Joerg Roedel <joerg.roedel@amd.com> 6 6 */ 7 7 8 - #ifndef __DMA_DEBUG_H 9 - #define __DMA_DEBUG_H 10 - 11 - #include <linux/types.h> 12 - 13 - struct device; 14 - struct scatterlist; 15 - struct bus_type; 8 + #ifndef _KERNEL_DMA_DEBUG_H 9 + #define _KERNEL_DMA_DEBUG_H 16 10 17 11 #ifdef CONFIG_DMA_API_DEBUG 18 - 19 - extern void dma_debug_add_bus(struct bus_type *bus); 20 - 21 - extern void debug_dma_map_single(struct device *dev, const void *addr, 22 - unsigned long len); 23 - 24 12 extern void debug_dma_map_page(struct device *dev, struct page *page, 25 13 size_t offset, size_t size, 26 14 int direction, dma_addr_t dma_addr); 27 - 28 - extern void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr); 29 15 30 16 extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr, 31 17 size_t size, int direction); ··· 50 64 extern void debug_dma_sync_sg_for_device(struct device *dev, 51 65 struct scatterlist *sg, 52 66 int nelems, int direction); 53 - 54 - extern void debug_dma_dump_mappings(struct device *dev); 55 - 56 67 #else /* CONFIG_DMA_API_DEBUG */ 57 - 58 - static inline void dma_debug_add_bus(struct bus_type *bus) 59 - { 60 - } 61 - 62 - static inline void debug_dma_map_single(struct device *dev, const void *addr, 63 - unsigned long len) 64 - { 65 - } 66 - 67 68 static inline void debug_dma_map_page(struct device *dev, struct page *page, 68 69 size_t offset, size_t size, 69 70 int direction, dma_addr_t dma_addr) 70 - { 71 - } 72 - 73 - static inline void debug_dma_mapping_error(struct device *dev, 74 - dma_addr_t dma_addr) 75 71 { 76 72 } 77 73 ··· 118 150 int nelems, int direction) 119 151 { 120 152 } 121 - 122 - static inline void debug_dma_dump_mappings(struct device *dev) 123 - { 124 - } 125 - 126 153 #endif /* CONFIG_DMA_API_DEBUG */ 127 - 128 - #endif /* __DMA_DEBUG_H */ 154 + #endif /* _KERNEL_DMA_DEBUG_H */
+12
include/linux/dma-map-ops.h
··· 220 220 } 221 221 #endif /* CONFIG_ARCH_HAS_TEARDOWN_DMA_OPS */ 222 222 223 + #ifdef CONFIG_DMA_API_DEBUG 224 + void dma_debug_add_bus(struct bus_type *bus); 225 + void debug_dma_dump_mappings(struct device *dev); 226 + #else 227 + static inline void dma_debug_add_bus(struct bus_type *bus) 228 + { 229 + } 230 + static inline void debug_dma_dump_mappings(struct device *dev) 231 + { 232 + } 233 + #endif /* CONFIG_DMA_API_DEBUG */ 234 + 223 235 extern const struct dma_map_ops dma_dummy_ops; 224 236 225 237 #endif /* _LINUX_DMA_MAP_OPS_H */
+15 -1
include/linux/dma-mapping.h
··· 6 6 #include <linux/string.h> 7 7 #include <linux/device.h> 8 8 #include <linux/err.h> 9 - #include <linux/dma-debug.h> 10 9 #include <linux/dma-direction.h> 11 10 #include <linux/scatterlist.h> 12 11 #include <linux/bug.h> ··· 74 75 #define DMA_MAPPING_ERROR (~(dma_addr_t)0) 75 76 76 77 #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) 78 + 79 + #ifdef CONFIG_DMA_API_DEBUG 80 + void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr); 81 + void debug_dma_map_single(struct device *dev, const void *addr, 82 + unsigned long len); 83 + #else 84 + static inline void debug_dma_mapping_error(struct device *dev, 85 + dma_addr_t dma_addr) 86 + { 87 + } 88 + static inline void debug_dma_map_single(struct device *dev, const void *addr, 89 + unsigned long len) 90 + { 91 + } 92 + #endif /* CONFIG_DMA_API_DEBUG */ 77 93 78 94 #ifdef CONFIG_HAS_DMA 79 95 static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
+2 -3
kernel/dma/debug.c
··· 9 9 10 10 #include <linux/sched/task_stack.h> 11 11 #include <linux/scatterlist.h> 12 - #include <linux/dma-mapping.h> 12 + #include <linux/dma-map-ops.h> 13 13 #include <linux/sched/task.h> 14 14 #include <linux/stacktrace.h> 15 - #include <linux/dma-debug.h> 16 15 #include <linux/spinlock.h> 17 16 #include <linux/vmalloc.h> 18 17 #include <linux/debugfs.h> ··· 23 24 #include <linux/ctype.h> 24 25 #include <linux/list.h> 25 26 #include <linux/slab.h> 26 - 27 27 #include <asm/sections.h> 28 + #include "debug.h" 28 29 29 30 #define HASH_SIZE 16384ULL 30 31 #define HASH_FN_SHIFT 13
+1
kernel/dma/mapping.c
··· 14 14 #include <linux/of_device.h> 15 15 #include <linux/slab.h> 16 16 #include <linux/vmalloc.h> 17 + #include "debug.h" 17 18 18 19 /* 19 20 * Managed DMA API
-1
mm/memory.c
··· 65 65 #include <linux/gfp.h> 66 66 #include <linux/migrate.h> 67 67 #include <linux/string.h> 68 - #include <linux/dma-debug.h> 69 68 #include <linux/debugfs.h> 70 69 #include <linux/userfaultfd_k.h> 71 70 #include <linux/dax.h>