Skip to contentSkip to conversation

sh: remove unused SLOW_DOWN_IO

PATCH New Bjorn Helgaas 1 participant 5 messages Oct 21, 2022 SuperH

lore
Share & tools
lore
#0 lore raw

v2 cover sh: remove unused SLOW_DOWN_IO

From: Bjorn Helgaas <[email protected]>

[Sorry for the noise; I sent this a few minutes ago, but it bounced from all the individual recipients because of DMARC issues]

Only alpha and sh define SLOW_DOWN_IO, and there are no uses of it. Remove it from sh and clean up some nearby macros.

These were previously posted 4/15/2022 at
https://lore.kernel.org/all/[email protected]/
and reposted 10/13/2022 at
https://lore.kernel.org/all/[email protected]/

Changes from v1 to v2:
- Drop the ia64 patch because Andrew applied it

      https://lore.kernel.org/all/[email protected]/

- Fix the sh build issues reported by the kernel test robot:

      https://lore.kernel.org/all/[email protected]/

- Add minor sh cleanup patches to __BUILD_IOPORT_SINGLE(),

    __BUILD_IOPORT_PFX(), and __BUILD_MEMORY_STRING()

- Split sh and alpha to separate series

Bjorn Helgaas (4):
sh: remove unused SLOW_DOWN_IO
sh: remove unused __BUILD_IOPORT_SINGLE 'pfx' parameter
sh: remove unnecessary __BUILD_IOPORT_PFX()
sh: remove unnecessary __BUILD_MEMORY_STRING() 'pfx' parameter

 arch/sh/include/asm/io.h | 42 +++++++++++++---------------------------
 1 file changed, 13 insertions(+), 29 deletions(-)
#1 lore raw

PATCH v2 1/4 sh: remove unused SLOW_DOWN_IO

From: Bjorn Helgaas <[email protected]>

io.h defines SLOW_DOWN_IO only when CONF_SLOWDOWN_IO is defined, but CONF_SLOWDOWN_IO is never defined and is in fact explicitly undefined. Remove SLOW_DOWN_IO and related code.

N.B. 37b7a97884ba ("sh: machvec IO death.") went to some trouble to add CONF_SLOWDOWN_IO and SLOW_DOWN_IO, for no obvious reason. Maybe there was some out-of-tree case that used this.

---
 arch/sh/include/asm/io.h | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)
arch/sh/include/asm/io.h +3 -16
index fba90e670ed4..8043b7c235ca 100644
@@ -121,11 +121,6 @@ __BUILD_MEMORY_STRING(__raw_, q, u64)
 
 #ifdef CONFIG_HAS_IOPORT_MAP
 
-/*
- * Slowdown I/O port space accesses for antique hardware.
- */
-#undef CONF_SLOWDOWN_IO
-
 /*
  * On SuperH I/O ports are memory mapped, so we access them using normal
  * load/store instructions. sh_io_port_base is the virtual address to
@@ -145,13 +140,7 @@ static inline void __set_io_port_base(unsigned long pbase)
 extern void __iomem *__ioport_map(unsigned long addr, unsigned int size);
 #endif
 
-#ifdef CONF_SLOWDOWN_IO
-#define SLOW_DOWN_IO __raw_readw(sh_io_port_base)
-#else
-#define SLOW_DOWN_IO
-#endif
-
-#define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, p, slow)			\
+#define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, p)			\
 									\
 static inline void pfx##out##bwlq##p(type val, unsigned long port)	\
 {									\
@@ -159,7 +148,6 @@ static inline void pfx##out##bwlq##p(type val, unsigned long port)	\
 									\
 	__addr = __ioport_map(port, sizeof(type));			\
 	*__addr = val;							\
-	slow;								\
 }									\
 									\
 static inline type pfx##in##bwlq##p(unsigned long port)			\
@@ -169,14 +157,13 @@ static inline type pfx##in##bwlq##p(unsigned long port)			\
 									\
 	__addr = __ioport_map(port, sizeof(type));			\
 	__val = *__addr;						\
-	slow;								\
 									\
 	return __val;							\
 }
 
 #define __BUILD_IOPORT_PFX(bus, bwlq, type)				\
-	__BUILD_IOPORT_SINGLE(bus, bwlq, type, ,)			\
-	__BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
+	__BUILD_IOPORT_SINGLE(bus, bwlq, type,)				\
+	__BUILD_IOPORT_SINGLE(bus, bwlq, type, _p)
 
 #define BUILDIO_IOPORT(bwlq, type)					\
 	__BUILD_IOPORT_PFX(, bwlq, type)
Signature · 1 line
2.25.1
#2 lore raw

PATCH v2 2/4 sh: remove unused __BUILD_IOPORT_SINGLE 'pfx' parameter

In reply to Bjorn Helgaas

From: Bjorn Helgaas <[email protected]>

Previously __BUILD_IOPORT_SINGLE() accepted a "pfx" parameter, to which __BUILD_IOPORT_PFX(), the only user of __BUILD_IOPORT_SINGLE(), passed along its own "bus" parameter. But users of __BUILD_IOPORT_PFX() supplied nothing, so both "bus" and "pfx" are pointless. Remove them.

---
 arch/sh/include/asm/io.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
arch/sh/include/asm/io.h +7 -7
index 8043b7c235ca..193640bd9563 100644
@@ -140,9 +140,9 @@ static inline void __set_io_port_base(unsigned long pbase)
 extern void __iomem *__ioport_map(unsigned long addr, unsigned int size);
 #endif
 
-#define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, p)			\
+#define __BUILD_IOPORT_SINGLE(bwlq, type, p)				\
 									\
-static inline void pfx##out##bwlq##p(type val, unsigned long port)	\
+static inline void out##bwlq##p(type val, unsigned long port)		\
 {									\
 	volatile type *__addr;						\
 									\
@@ -150,7 +150,7 @@ static inline void pfx##out##bwlq##p(type val, unsigned long port)	\
 	*__addr = val;							\
 }									\
 									\
-static inline type pfx##in##bwlq##p(unsigned long port)			\
+static inline type in##bwlq##p(unsigned long port)			\
 {									\
 	volatile type *__addr;						\
 	type __val;							\
@@ -161,12 +161,12 @@ static inline type pfx##in##bwlq##p(unsigned long port)			\
 	return __val;							\
 }
 
-#define __BUILD_IOPORT_PFX(bus, bwlq, type)				\
-	__BUILD_IOPORT_SINGLE(bus, bwlq, type,)				\
-	__BUILD_IOPORT_SINGLE(bus, bwlq, type, _p)
+#define __BUILD_IOPORT_PFX(bwlq, type)					\
+	__BUILD_IOPORT_SINGLE(bwlq, type,)				\
+	__BUILD_IOPORT_SINGLE(bwlq, type, _p)
 
 #define BUILDIO_IOPORT(bwlq, type)					\
-	__BUILD_IOPORT_PFX(, bwlq, type)
+	__BUILD_IOPORT_PFX(bwlq, type)
 
 BUILDIO_IOPORT(b, u8)
 BUILDIO_IOPORT(w, u16)
Signature · 1 line
2.25.1
#3 lore raw

PATCH v2 3/4 sh: remove unnecessary __BUILD_IOPORT_PFX()

In reply to Bjorn Helgaas

From: Bjorn Helgaas <[email protected]>

The only reason __BUILD_IOPORT_PFX() existed was to accept a "bus" parameter, but nothing ever used that. Remove __BUILD_IOPORT_PFX() and collapse it into BUILDIO_IOPORT().

---
 arch/sh/include/asm/io.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/sh/include/asm/io.h +1 -4
index 193640bd9563..e29e8870dc3b 100644
@@ -161,13 +161,10 @@ static inline type in##bwlq##p(unsigned long port)			\
 	return __val;							\
 }
 
-#define __BUILD_IOPORT_PFX(bwlq, type)					\
+#define BUILDIO_IOPORT(bwlq, type)					\
 	__BUILD_IOPORT_SINGLE(bwlq, type,)				\
 	__BUILD_IOPORT_SINGLE(bwlq, type, _p)
 
-#define BUILDIO_IOPORT(bwlq, type)					\
-	__BUILD_IOPORT_PFX(bwlq, type)
-
 BUILDIO_IOPORT(b, u8)
 BUILDIO_IOPORT(w, u16)
 BUILDIO_IOPORT(l, u32)
Signature · 1 line
2.25.1
#4 lore raw

PATCH v2 4/4 sh: remove unnecessary __BUILD_MEMORY_STRING() 'pfx' parameter

In reply to Bjorn Helgaas

From: Bjorn Helgaas <[email protected]>

Previously __BUILD_MEMORY_STRING() accepted a "pfx" parameter, to which all users passed "__raw_". Simplify this by dropping the parameter and encoding "__raw_" in the function name explicitly.

---
 arch/sh/include/asm/io.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
arch/sh/include/asm/io.h +8 -8
index e29e8870dc3b..179420fc4053 100644
@@ -86,11 +86,11 @@ __BUILD_UNCACHED_IO(w, u16)
 __BUILD_UNCACHED_IO(l, u32)
 __BUILD_UNCACHED_IO(q, u64)
 
-#define __BUILD_MEMORY_STRING(pfx, bwlq, type)				\
+#define __BUILD_MEMORY_STRING(bwlq, type)				\
 									\
 static inline void							\
-pfx##writes##bwlq(volatile void __iomem *mem, const void *addr,		\
-		  unsigned int count)					\
+__raw_writes##bwlq(volatile void __iomem *mem, const void *addr,	\
+		   unsigned int count)					\
 {									\
 	const volatile type *__addr = addr;				\
 									\
@@ -100,8 +100,8 @@ pfx##writes##bwlq(volatile void __iomem *mem, const void *addr,		\
 	}								\
 }									\
 									\
-static inline void pfx##reads##bwlq(volatile void __iomem *mem,		\
-				    void *addr, unsigned int count)	\
+static inline void __raw_reads##bwlq(volatile void __iomem *mem,	\
+				     void *addr, unsigned int count)	\
 {									\
 	volatile type *__addr = addr;					\
 									\
@@ -111,13 +111,13 @@ static inline void pfx##reads##bwlq(volatile void __iomem *mem,		\
 	}								\
 }
 
-__BUILD_MEMORY_STRING(__raw_, b, u8)
-__BUILD_MEMORY_STRING(__raw_, w, u16)
+__BUILD_MEMORY_STRING(b, u8)
+__BUILD_MEMORY_STRING(w, u16)
 
 void __raw_writesl(void __iomem *addr, const void *data, int longlen);
 void __raw_readsl(const void __iomem *addr, void *data, int longlen);
 
-__BUILD_MEMORY_STRING(__raw_, q, u64)
+__BUILD_MEMORY_STRING(q, u64)
 
 #ifdef CONFIG_HAS_IOPORT_MAP
 
Signature · 1 line
2.25.1