Skip to contentSkip to conversation

dma-debug: make dma_debug_add_bus take a const pointer

PATCH In review Greg Kroah-Hartman 3 participants 3 messages Dec 19, 2023 DMA mapping helpers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dma-debug: make dma_debug_add_bus take a const pointer

The driver core now can handle a const struct bus_type pointer, and the dma_debug_add_bus() call just passes on the pointer give to it to the driver core, so make this pointer const as well to allow everyone to use read-only struct bus_type pointers going forward.

Cc Christoph Hellwig <[email protected]>
Cc Marek Szyprowski <[email protected]>
Cc Robin Murphy <[email protected]>
---
 include/linux/dma-map-ops.h | 4 ++--
 kernel/dma/debug.c          | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
include/linux/dma-map-ops.h +2 -2
index f2fc203fb8a1..e401f824a007 100644
@@ -443,10 +443,10 @@ static inline void arch_teardown_dma_ops(struct device *dev)
 #endif /* CONFIG_ARCH_HAS_TEARDOWN_DMA_OPS */
 
 #ifdef CONFIG_DMA_API_DEBUG
-void dma_debug_add_bus(struct bus_type *bus);
+void dma_debug_add_bus(const struct bus_type *bus);
 void debug_dma_dump_mappings(struct device *dev);
 #else
-static inline void dma_debug_add_bus(struct bus_type *bus)
+static inline void dma_debug_add_bus(const struct bus_type *bus)
 {
 }
 static inline void debug_dma_dump_mappings(struct device *dev)
kernel/dma/debug.c +1 -1
index 3de494375b7b..1a5c86dd87d5 100644
@@ -876,7 +876,7 @@ static int dma_debug_device_change(struct notifier_block *nb, unsigned long acti
 	return 0;
 }
 
-void dma_debug_add_bus(struct bus_type *bus)
+void dma_debug_add_bus(const struct bus_type *bus)
 {
 	struct notifier_block *nb;
 
Signature · 1 line
2.43.0
#1 lore raw
Quoted 4 lines · Greg Kroah-Hartman

The driver core now can handle a const struct bus_type pointer, and the dma_debug_add_bus() call just passes on the pointer give to it to the driver core, so make this pointer const as well to allow everyone to use read-only struct bus_type pointers going forward.

This looks good to me. Do you want me to queue it up or take it with the other constification patches?

reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Greg Kroah-Hartman
Quoted 4 lines · Greg Kroah-Hartman

The driver core now can handle a const struct bus_type pointer, and the dma_debug_add_bus() call just passes on the pointer give to it to the driver core, so make this pointer const as well to allow everyone to use read-only struct bus_type pointers going forward.

Quoted 40 lines
Cc Christoph Hellwig <[email protected]>
Cc Marek Szyprowski <[email protected]>
Cc Robin Murphy <[email protected]>
---
  include/linux/dma-map-ops.h | 4 ++--
  kernel/dma/debug.c          | 2 +-
  2 files changed, 3 insertions(+), 3 deletions(-)
include/linux/dma-map-ops.h +2 -2
index f2fc203fb8a1..e401f824a007 100644
@@ -443,10 +443,10 @@ static inline void arch_teardown_dma_ops(struct device *dev)
  #endif /* CONFIG_ARCH_HAS_TEARDOWN_DMA_OPS */
 
  #ifdef CONFIG_DMA_API_DEBUG
-void dma_debug_add_bus(struct bus_type *bus);
+void dma_debug_add_bus(const struct bus_type *bus);
  void debug_dma_dump_mappings(struct device *dev);
  #else
-static inline void dma_debug_add_bus(struct bus_type *bus)
+static inline void dma_debug_add_bus(const struct bus_type *bus)
  {
  }
  static inline void debug_dma_dump_mappings(struct device *dev)
kernel/dma/debug.c +1 -1
index 3de494375b7b..1a5c86dd87d5 100644
@@ -876,7 +876,7 @@ static int dma_debug_device_change(struct notifier_block *nb, unsigned long acti
  	return 0;
  }
 
-void dma_debug_add_bus(struct bus_type *bus)
+void dma_debug_add_bus(const struct bus_type *bus)
  {
  	struct notifier_block *nb;