Skip to contentSkip to conversation

swiotlb: fix implicit debugfs_create_dir declaration

PATCH Superseded Claire Chang 2 participants 3 messages Jun 29, 2021 – Jun 30, 2021 DMA mapping helpers

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 swiotlb: fix implicit debugfs_create_dir declaration

Remove the ifdef to fix implicit function declaration for other pools.

Fixes 1d9f94400a7a ("swiotlb: Refactor swiotlb_create_debugfs")
---
 kernel/dma/swiotlb.c | 5 -----
 1 file changed, 5 deletions(-)
kernel/dma/swiotlb.c +0 -5
index 0ffbaae9fba2..8ae0bef392c3 100644
@@ -36,9 +36,7 @@
 #include <linux/scatterlist.h>
 #include <linux/mem_encrypt.h>
 #include <linux/set_memory.h>
-#ifdef CONFIG_DEBUG_FS
 #include <linux/debugfs.h>
-#endif
 #ifdef CONFIG_DMA_RESTRICTED_POOL
 #include <linux/io.h>
 #include <linux/of.h>
@@ -686,7 +684,6 @@ bool is_swiotlb_active(struct device *dev)
 }
 EXPORT_SYMBOL_GPL(is_swiotlb_active);
 
-#ifdef CONFIG_DEBUG_FS
 static struct dentry *debugfs_dir;
 
 static void swiotlb_create_debugfs_files(struct io_tlb_mem *mem)
@@ -709,8 +706,6 @@ static int __init swiotlb_create_default_debugfs(void)
 
 late_initcall(swiotlb_create_default_debugfs);
 
-#endif
-
 #ifdef CONFIG_DMA_RESTRICTED_POOL
 struct page *swiotlb_alloc(struct device *dev, size_t size)
 {
Signature · 6 lines
2.32.0.93.g670b81a890-goog

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
reviewer
#1 lore raw
Quoted 3 lines · Claire Chang

Remove the ifdef to fix implicit function declaration for other pools.

Fixes 1d9f94400a7a ("swiotlb: Refactor swiotlb_create_debugfs")

There doesn't appear to be a problem with that commit - AFAICS it's 461021875c50 ("swiotlb: Add restricted DMA pool initialization") which introduces a reference to debugfs_create_dir() outside the existing #ifdef guards.

FWIW (assuming it's the real problem) I'd be inclined to factor out the debugfs bits from rmem_swiotlb_device_init() into a separate rmem_swiotlb_debugfs_init() (or similar) function which can live alongside the others under the #ifdef and be stubbed out in an #else case.

Robin.

Quoted 30 lines
---
  kernel/dma/swiotlb.c | 5 -----
  1 file changed, 5 deletions(-)
kernel/dma/swiotlb.c +0 -3
index 0ffbaae9fba2..8ae0bef392c3 100644
@@ -36,9 +36,7 @@
  #include <linux/scatterlist.h>
  #include <linux/mem_encrypt.h>
  #include <linux/set_memory.h>
-#ifdef CONFIG_DEBUG_FS
  #include <linux/debugfs.h>
-#endif
  #ifdef CONFIG_DMA_RESTRICTED_POOL
  #include <linux/io.h>
  #include <linux/of.h>
@@ -686,7 +684,6 @@ bool is_swiotlb_active(struct device *dev)
  }
  EXPORT_SYMBOL_GPL(is_swiotlb_active);
 
-#ifdef CONFIG_DEBUG_FS
  static struct dentry *debugfs_dir;
 
  static void swiotlb_create_debugfs_files(struct io_tlb_mem *mem)

kernel/dma/swiotlb.c static int __init swiotlb_create_default_debugfs(void) · line 711

Quoted 8 lines
kernel/dma/swiotlb.c +0 -2
@@ -709,8 +706,6 @@ static int __init swiotlb_create_default_debugfs(void)
 
  late_initcall(swiotlb_create_default_debugfs);
 
-#endif
-
  #ifdef CONFIG_DMA_RESTRICTED_POOL
  struct page *swiotlb_alloc(struct device *dev, size_t size)
  {

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

#2 lore raw
Quoted 11 lines · Robin Murphy
Quoted 3 lines · Claire Chang

Remove the ifdef to fix implicit function declaration for other pools.

Fixes 1d9f94400a7a ("swiotlb: Refactor swiotlb_create_debugfs")

There doesn't appear to be a problem with that commit - AFAICS it's 461021875c50 ("swiotlb: Add restricted DMA pool initialization") which introduces a reference to debugfs_create_dir() outside the existing #ifdef guards.

Quoted 4 lines

FWIW (assuming it's the real problem) I'd be inclined to factor out the debugfs bits from rmem_swiotlb_device_init() into a separate rmem_swiotlb_debugfs_init() (or similar) function which can live alongside the others under the #ifdef and be stubbed out in an #else case.

v3 here: https://lore.kernel.org/patchwork/patch/1452807/

Quoted 33 lines

Robin.

Quoted 30 lines
---
  kernel/dma/swiotlb.c | 5 -----
  1 file changed, 5 deletions(-)
kernel/dma/swiotlb.c +0 -3
index 0ffbaae9fba2..8ae0bef392c3 100644
@@ -36,9 +36,7 @@
  #include <linux/scatterlist.h>
  #include <linux/mem_encrypt.h>
  #include <linux/set_memory.h>
-#ifdef CONFIG_DEBUG_FS
  #include <linux/debugfs.h>
-#endif
  #ifdef CONFIG_DMA_RESTRICTED_POOL
  #include <linux/io.h>
  #include <linux/of.h>
@@ -686,7 +684,6 @@ bool is_swiotlb_active(struct device *dev)
  }
  EXPORT_SYMBOL_GPL(is_swiotlb_active);
 
-#ifdef CONFIG_DEBUG_FS
  static struct dentry *debugfs_dir;
 
  static void swiotlb_create_debugfs_files(struct io_tlb_mem *mem)
@@ -709,8 +706,6 @@ static int __init swiotlb_create_default_debugfs(void)
 
Quoted 8 lines

kernel/dma/swiotlb.c static int __init swiotlb_create_default_debugfs(void) · line 711

Quoted 8 lines
kernel/dma/swiotlb.c +0 -2
  late_initcall(swiotlb_create_default_debugfs);
 
-#endif
-
  #ifdef CONFIG_DMA_RESTRICTED_POOL
  struct page *swiotlb_alloc(struct device *dev, size_t size)
  {

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu