Skip to content

Commit

Permalink
swiotlb: Refactor swiotlb_create_debugfs
Browse files Browse the repository at this point in the history
Split the debugfs creation to make the code reusable for supporting
different bounce buffer pools.

Signed-off-by: Claire Chang <tientzu@chromium.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: Stefano Stabellini <sstabellini@kernel.org>
Tested-by: Will Deacon <will@kernel.org>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
  • Loading branch information
Claire Chang authored and Konrad Rzeszutek Wilk committed Jun 22, 2021
1 parent 781938e commit 1d9f944
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions kernel/dma/swiotlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,19 +669,26 @@ bool is_swiotlb_active(void)
EXPORT_SYMBOL_GPL(is_swiotlb_active);

#ifdef CONFIG_DEBUG_FS
static struct dentry *debugfs_dir;

static int __init swiotlb_create_debugfs(void)
static void swiotlb_create_debugfs_files(struct io_tlb_mem *mem)
{
struct io_tlb_mem *mem = io_tlb_default_mem;

if (!mem)
return 0;
mem->debugfs = debugfs_create_dir("swiotlb", NULL);
debugfs_create_ulong("io_tlb_nslabs", 0400, mem->debugfs, &mem->nslabs);
debugfs_create_ulong("io_tlb_used", 0400, mem->debugfs, &mem->used);
}

static int __init swiotlb_create_default_debugfs(void)
{
struct io_tlb_mem *mem = io_tlb_default_mem;

debugfs_dir = debugfs_create_dir("swiotlb", NULL);
if (mem) {
mem->debugfs = debugfs_dir;
swiotlb_create_debugfs_files(mem);
}
return 0;
}

late_initcall(swiotlb_create_debugfs);
late_initcall(swiotlb_create_default_debugfs);

#endif

0 comments on commit 1d9f944

Please sign in to comment.