Skip to content

Commit a1fd09e

Browse files
author
Christoph Hellwig
committed
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 <[email protected]>
1 parent 5db5d93 commit a1fd09e

File tree

13 files changed

+34
-52
lines changed

13 files changed

+34
-52
lines changed

arch/arm/include/asm/dma-iommu.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
#include <linux/mm_types.h>
88
#include <linux/scatterlist.h>
9-
#include <linux/dma-debug.h>
109
#include <linux/kref.h>
1110

1211
struct dma_iommu_mapping {

arch/arm/include/asm/dma-mapping.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
#include <linux/mm_types.h>
88
#include <linux/scatterlist.h>
9-
#include <linux/dma-debug.h>
109

1110
#include <xen/xen.h>
1211
#include <asm/xen/hypervisor.h>

arch/microblaze/kernel/dma.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <linux/device.h>
1111
#include <linux/dma-noncoherent.h>
1212
#include <linux/gfp.h>
13-
#include <linux/dma-debug.h>
1413
#include <linux/export.h>
1514
#include <linux/bug.h>
1615
#include <asm/cacheflush.h>

arch/sh/drivers/pci/pci.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <linux/pci.h>
1414
#include <linux/init.h>
1515
#include <linux/types.h>
16-
#include <linux/dma-debug.h>
1716
#include <linux/io.h>
1817
#include <linux/mutex.h>
1918
#include <linux/spinlock.h>

arch/x86/include/asm/dma-mapping.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99

1010
#include <linux/scatterlist.h>
11-
#include <linux/dma-debug.h>
1211
#include <asm/io.h>
1312
#include <asm/swiotlb.h>
1413

arch/x86/kernel/pci-dma.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0
22
#include <linux/dma-map-ops.h>
33
#include <linux/dma-direct.h>
4-
#include <linux/dma-debug.h>
54
#include <linux/iommu.h>
65
#include <linux/dmar.h>
76
#include <linux/export.h>

drivers/pci/pci-driver.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/kexec.h>
2020
#include <linux/of_device.h>
2121
#include <linux/acpi.h>
22+
#include <linux/dma-map-ops.h>
2223
#include "pci.h"
2324
#include "pcie/portdrv.h"
2425

include/linux/dma-map-ops.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,18 @@ static inline void arch_teardown_dma_ops(struct device *dev)
220220
}
221221
#endif /* CONFIG_ARCH_HAS_TEARDOWN_DMA_OPS */
222222

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+
223235
extern const struct dma_map_ops dma_dummy_ops;
224236

225237
#endif /* _LINUX_DMA_MAP_OPS_H */

include/linux/dma-mapping.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <linux/string.h>
77
#include <linux/device.h>
88
#include <linux/err.h>
9-
#include <linux/dma-debug.h>
109
#include <linux/dma-direction.h>
1110
#include <linux/scatterlist.h>
1211
#include <linux/bug.h>
@@ -76,6 +75,21 @@
7675

7776
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
7877

78+
#ifdef CONFIG_DMA_API_DEBUG
79+
void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
80+
void debug_dma_map_single(struct device *dev, const void *addr,
81+
unsigned long len);
82+
#else
83+
static inline void debug_dma_mapping_error(struct device *dev,
84+
dma_addr_t dma_addr)
85+
{
86+
}
87+
static inline void debug_dma_map_single(struct device *dev, const void *addr,
88+
unsigned long len)
89+
{
90+
}
91+
#endif /* CONFIG_DMA_API_DEBUG */
92+
7993
#ifdef CONFIG_HAS_DMA
8094
static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
8195
{

kernel/dma/debug.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99

1010
#include <linux/sched/task_stack.h>
1111
#include <linux/scatterlist.h>
12-
#include <linux/dma-mapping.h>
12+
#include <linux/dma-map-ops.h>
1313
#include <linux/sched/task.h>
1414
#include <linux/stacktrace.h>
15-
#include <linux/dma-debug.h>
1615
#include <linux/spinlock.h>
1716
#include <linux/vmalloc.h>
1817
#include <linux/debugfs.h>
@@ -24,8 +23,8 @@
2423
#include <linux/ctype.h>
2524
#include <linux/list.h>
2625
#include <linux/slab.h>
27-
2826
#include <asm/sections.h>
27+
#include "debug.h"
2928

3029
#define HASH_SIZE 16384ULL
3130
#define HASH_FN_SHIFT 13

0 commit comments

Comments
 (0)