swiotlb: fix implicit debugfs_create_dir declaration
PATCH v3 1/1 swiotlb: fix implicit debugfs_create_dir declaration
Factor out the debugfs bits from rmem_swiotlb_device_init() into a separate rmem_swiotlb_debugfs_init().
--- kernel/dma/swiotlb.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
kernel/dma/swiotlb.c +12 -5
@@ -709,6 +709,16 @@ static int __init swiotlb_create_default_debugfs(void)late_initcall (swiotlb_create_default_debugfs); +static void rmem_swiotlb_debugfs_init (const char *name,struct io_tlb_mem *mem) +{ + mem->debugfs =debugfs_create_dir (name, debugfs_dir); +swiotlb_create_debugfs_files (mem); +} +#else +__maybe_unused static void rmem_swiotlb_debugfs_init (const char *name, +struct io_tlb_mem *mem) +{ +}#endif #ifdef CONFIG_DMA_RESTRICTED_POOL
@@ -766,11 +776,8 @@ static int rmem_swiotlb_device_init(struct reserved_mem *rmem, rmem->priv = mem; -if (IS_ENABLED (CONFIG_DEBUG_FS )) { - mem->debugfs = -debugfs_create_dir (rmem->name, debugfs_dir); -swiotlb_create_debugfs_files (mem); - } +if (IS_ENABLED (CONFIG_DEBUG_FS )) +rmem_swiotlb_debugfs_init (rmem->name, mem); } dev->dma_io_tlb_mem = mem;
Signature · 6 lines
2.32.0.93.g670b81a890-goog _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Robin Murphy
reviewerQuoted 15 lines · Claire Chang
Factor out the debugfs bits from
rmem_swiotlb_device_init()into a separatermem_swiotlb_debugfs_init().Fixes 461021875c50 ("swiotlb: Add restricted DMA pool initialization")Reported-by kernel test robot <[email protected]>Signed-off-by Claire Chang <[email protected]>--- kernel/dma/swiotlb.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)kernel/dma/swiotlb.c +0
-0
kernel/dma/swiotlb.c static int __init swiotlb_create_default_debugfs(void) · line 712
Quoted 4 lines
kernel/dma/swiotlb.c +1
-0@@ -709,6 +709,16 @@ static int __init swiotlb_create_default_debugfs(void)late_initcall (swiotlb_create_default_debugfs); +static void rmem_swiotlb_debugfs_init (const char *name,struct io_tlb_mem *mem)
Nit: maybe just pass in the reserved_mem, then dereference rmem->name and rmem->priv inside here?
Quoted 13 lines
kernel/dma/swiotlb.c +9
-0+{ + mem->debugfs =debugfs_create_dir (name, debugfs_dir); +swiotlb_create_debugfs_files (mem); +} +#else +__maybe_unused static void rmem_swiotlb_debugfs_init (const char *name, +struct io_tlb_mem *mem) +{ +}#endif #ifdef CONFIG_DMA_RESTRICTED_POOL
kernel/dma/swiotlb.c static int rmem_swiotlb_device_init(struct reserved_mem *rmem, · line 780
Quoted 10 lines
kernel/dma/swiotlb.c +2
-5@@ -766,11 +776,8 @@ static int rmem_swiotlb_device_init(struct reserved_mem *rmem, rmem->priv = mem; -if (IS_ENABLED (CONFIG_DEBUG_FS )) { - mem->debugfs = -debugfs_create_dir (rmem->name, debugfs_dir); -swiotlb_create_debugfs_files (mem); - } +if (IS_ENABLED (CONFIG_DEBUG_FS )) +rmem_swiotlb_debugfs_init (rmem->name, mem);
Just make the call unconditional (and drop the __maybe_unused annotation above) - the stub already does nothing for the DEBUG_FS=n case, so the IS_ENABLED() is pointless.
Robin.
kernel/dma/swiotlb.c static int rmem_swiotlb_device_init(struct reserved_mem *rmem, · line 783
Quoted 4 lines
kernel/dma/swiotlb.c +0
-0} dev->dma_io_tlb_mem = mem;
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu