Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 6e675a1

Browse files
Claire Changkonradwilk
authored andcommitted
swiotlb: Refactor swiotlb_create_debugfs
Split the debugfs creation to make the code reusable for supporting different bounce buffer pools. Signed-off-by: Claire Chang <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Tested-by: Stefano Stabellini <[email protected]> Tested-by: Will Deacon <[email protected]> Signed-off-by: Konrad Rzeszutek Wilk <[email protected]>
1 parent 0a65579 commit 6e675a1

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

kernel/dma/swiotlb.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -669,19 +669,26 @@ bool is_swiotlb_active(void)
669669
EXPORT_SYMBOL_GPL(is_swiotlb_active);
670670

671671
#ifdef CONFIG_DEBUG_FS
672+
static struct dentry *debugfs_dir;
672673

673-
static int __init swiotlb_create_debugfs(void)
674+
static void swiotlb_create_debugfs_files(struct io_tlb_mem *mem)
674675
{
675-
struct io_tlb_mem *mem = io_tlb_default_mem;
676-
677-
if (!mem)
678-
return 0;
679-
mem->debugfs = debugfs_create_dir("swiotlb", NULL);
680676
debugfs_create_ulong("io_tlb_nslabs", 0400, mem->debugfs, &mem->nslabs);
681677
debugfs_create_ulong("io_tlb_used", 0400, mem->debugfs, &mem->used);
678+
}
679+
680+
static int __init swiotlb_create_default_debugfs(void)
681+
{
682+
struct io_tlb_mem *mem = io_tlb_default_mem;
683+
684+
debugfs_dir = debugfs_create_dir("swiotlb", NULL);
685+
if (mem) {
686+
mem->debugfs = debugfs_dir;
687+
swiotlb_create_debugfs_files(mem);
688+
}
682689
return 0;
683690
}
684691

685-
late_initcall(swiotlb_create_debugfs);
692+
late_initcall(swiotlb_create_default_debugfs);
686693

687694
#endif

0 commit comments

Comments
 (0)