* [PATCH v3] swiotlb: fix implicit debugfs_create_dir declaration
@ 2021-06-30 4:06 Claire Chang
2021-06-30 13:49 ` Robin Murphy
0 siblings, 1 reply; 2+ messages in thread
From: Claire Chang @ 2021-06-30 4:06 UTC (permalink / raw)
To: konrad.wilk, hch, m.szyprowski, robin.murphy, Will Deacon, sstabellini
Cc: iommu, linux-kernel, tfiga, Nicolas Boichat, Claire Chang,
kernel test robot
Factor out the debugfs bits from rmem_swiotlb_device_init() into a separate
rmem_swiotlb_debugfs_init().
Fixes: 461021875c50 ("swiotlb: Add restricted DMA pool initialization")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Claire Chang <tientzu@chromium.org>
---
kernel/dma/swiotlb.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 0ffbaae9fba2..355dc98d381c 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -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;
--
2.32.0.93.g670b81a890-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] swiotlb: fix implicit debugfs_create_dir declaration
2021-06-30 4:06 [PATCH v3] swiotlb: fix implicit debugfs_create_dir declaration Claire Chang
@ 2021-06-30 13:49 ` Robin Murphy
0 siblings, 0 replies; 2+ messages in thread
From: Robin Murphy @ 2021-06-30 13:49 UTC (permalink / raw)
To: Claire Chang, konrad.wilk, hch, m.szyprowski, Will Deacon, sstabellini
Cc: iommu, linux-kernel, tfiga, Nicolas Boichat, kernel test robot
On 2021-06-30 05:06, Claire Chang wrote:
> Factor out the debugfs bits from rmem_swiotlb_device_init() into a separate
> rmem_swiotlb_debugfs_init().
>
> Fixes: 461021875c50 ("swiotlb: Add restricted DMA pool initialization")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Claire Chang <tientzu@chromium.org>
> ---
> kernel/dma/swiotlb.c | 17 ++++++++++++-----
> 1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
> index 0ffbaae9fba2..355dc98d381c 100644
> --- a/kernel/dma/swiotlb.c
> +++ b/kernel/dma/swiotlb.c
> @@ -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?
> +{
> + 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);
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.
> }
>
> dev->dma_io_tlb_mem = mem;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-30 13:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-30 4:06 [PATCH v3] swiotlb: fix implicit debugfs_create_dir declaration Claire Chang
2021-06-30 13:49 ` Robin Murphy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).