Skip to contentSkip to conversation

dma-mapping: no need to pass a bus_type into get_arch_dma_ops()

PATCH In review Greg Kroah-Hartman 3 participants 3 messages Feb 14, 2023

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dma-mapping: no need to pass a bus_type into get_arch_dma_ops()

The get_arch_dma_ops() arch-specific function never does anything with the struct bus_type that is passed into it, so remove it entirely as it is not needed.

Cc Richard Henderson <[email protected]>
Cc Ivan Kokshaysky <[email protected]>
Cc Matt Turner <[email protected]>
Cc Thomas Bogendoerfer <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc Helge Deller <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dave Hansen <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Marek Szyprowski <[email protected]>
Cc Robin Murphy <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>

---
Note: Unless someone objects, I would like to take this through the driver-core tree, as further bus_type cleanups depend on it, and it's stand-alone from everyone else's tree at the moment from what I can determine.

 arch/alpha/include/asm/dma-mapping.h  | 2 +-
 arch/ia64/include/asm/dma-mapping.h   | 2 +-
 arch/mips/include/asm/dma-mapping.h   | 2 +-
 arch/parisc/include/asm/dma-mapping.h | 2 +-
 arch/sparc/include/asm/dma-mapping.h  | 2 +-
 arch/x86/include/asm/dma-mapping.h    | 2 +-
 include/asm-generic/dma-mapping.h     | 2 +-
 include/linux/dma-map-ops.h           | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)
arch/alpha/include/asm/dma-mapping.h +1 -1
index 0ee6a5c99b16..6ce7e2041685 100644
@@ -4,7 +4,7 @@
 
 extern const struct dma_map_ops alpha_pci_ops;
 
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
+static inline const struct dma_map_ops *get_arch_dma_ops(void)
 {
 #ifdef CONFIG_ALPHA_JENSEN
 	return NULL;
arch/ia64/include/asm/dma-mapping.h +1 -1
index a5d9d788eede..af6fa8e1597c 100644
@@ -8,7 +8,7 @@
  */
 extern const struct dma_map_ops *dma_ops;
 
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
+static inline const struct dma_map_ops *get_arch_dma_ops(void)
 {
 	return dma_ops;
 }
arch/mips/include/asm/dma-mapping.h +1 -1
index 34de7b17b41b..0fee561ac796 100644
@@ -6,7 +6,7 @@
 
 extern const struct dma_map_ops jazz_dma_ops;
 
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
+static inline const struct dma_map_ops *get_arch_dma_ops(void)
 {
 #if defined(CONFIG_MACH_JAZZ)
 	return &jazz_dma_ops;
arch/parisc/include/asm/dma-mapping.h +1 -1
index d5bd94247371..635665004fe6 100644
@@ -21,7 +21,7 @@
 
 extern const struct dma_map_ops *hppa_dma_ops;
 
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
+static inline const struct dma_map_ops *get_arch_dma_ops(void)
 {
 	return hppa_dma_ops;
 }
arch/sparc/include/asm/dma-mapping.h +1 -1
index 2f051343612e..55c12fc2ba63 100644
@@ -4,7 +4,7 @@
 
 extern const struct dma_map_ops *dma_ops;
 
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
+static inline const struct dma_map_ops *get_arch_dma_ops(void)
 {
 	/* sparc32 uses per-device dma_ops */
 	return IS_ENABLED(CONFIG_SPARC64) ? dma_ops : NULL;
arch/x86/include/asm/dma-mapping.h +1 -1
index 1c66708e3062..d1dac96ee30b 100644
@@ -4,7 +4,7 @@
 
 extern const struct dma_map_ops *dma_ops;
 
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
+static inline const struct dma_map_ops *get_arch_dma_ops(void)
 {
 	return dma_ops;
 }
include/asm-generic/dma-mapping.h +1 -1
index c13f46109e88..46a0016efd81 100644
@@ -2,7 +2,7 @@
 #ifndef _ASM_GENERIC_DMA_MAPPING_H
 #define _ASM_GENERIC_DMA_MAPPING_H
 
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
+static inline const struct dma_map_ops *get_arch_dma_ops(void)
 {
 	return NULL;
 }
include/linux/dma-map-ops.h +1 -1
index d678afeb8a13..41bf4bdb117a 100644
@@ -90,7 +90,7 @@ static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
 {
 	if (dev->dma_ops)
 		return dev->dma_ops;
-	return get_arch_dma_ops(dev->bus);
+	return get_arch_dma_ops();
 }
 
 static inline void set_dma_ops(struct device *dev,
Signature · 1 line
2.39.1
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Greg Kroah-Hartman

The get_arch_dma_ops() arch-specific function never does anything with the struct bus_type that is passed into it, so remove it entirely as it is not needed.

Yes. (and eventually get_arch_dma_ops should go away entirely, but that's a separate story).

Quoted 4 lines

Note: Unless someone objects, I would like to take this through the driver-core tree, as further bus_type cleanups depend on it, and it's stand-alone from everyone else's tree at the moment from what I can determine.

Please do!

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

The get_arch_dma_ops() arch-specific function never does anything with the struct bus_type that is passed into it, so remove it entirely as it is not needed.

---
Note: Unless someone objects, I would like to take this through the driver-core tree, as further bus_type cleanups depend on it, and it's stand-alone from everyone else's tree at the moment from what I can determine.

Nice find!

It looks like the bus was last required in 2020 before commit 255a69a94b8c ("sparc32: use per-device dma_ops").

Arnd