Skip to contentSkip to conversation

Fix endianness of generic I/O accessors

PATCH Applied Will Deacon 3 participants 18 messages Dec 10, 2012 – Dec 13, 2012

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

v2 cover Fix endianness of generic I/O accessors

Hello again,

This is version 2 of the patches originally posted here:

http://lkml.indiana.edu/hypermail/linux/kernel/1210.2/00952.html

Changes since then:
- Reordered the series to put the string function removal at the end.
- Matthew's had a crack at fixing up all the other drivers which rely on the generic I/O accessors after a request from James Hogan.

Note that the mmc and smc changes are required in order to build their respective drivers for arm64, regardless of endianness and/or the rest of this series.

Comments welcome, particularly regarding how on Earth this gets merged in a sane manner.

Will

Matthew Leach (6):
net: smc911x: use io{read,write}*_rep accessors
net: dm9000: use io{read,write}*_rep accessors
net: 8390: use io{read,write}*_rep accessors
mtd: nand/gpio: use io{read,write}*_rep accessors
musb: tusb6010: use io{read,write}*_rep accessors
usb: musb: use io{read,write}*_rep accessors

Will Deacon (4):
asm-generic: io: don't perform swab during {in,out} string functions
mmc: mmci: use io{read,write}*_rep accessors instead of string
functions
net: smc91x: use io{read,write}*_rep accessors instead of string
functions
asm-generic: io: remove {read,write} string functions

 drivers/mmc/host/mmci.c               |  8 +++----
 drivers/mtd/nand/gpio.c               |  8 +++----
 drivers/net/ethernet/8390/ax88796.c   | 16 ++++++-------
 drivers/net/ethernet/davicom/dm9000.c | 12 +++++-----
 drivers/net/ethernet/smsc/smc911x.h   | 16 ++++++-------
 drivers/net/ethernet/smsc/smc91x.h    | 20 ++++++++---------
 drivers/usb/musb/musb_core.c          | 12 +++++-----
 drivers/usb/musb/musb_io.h            | 21 ------------------
 drivers/usb/musb/tusb6010.c           |  5 +++--
 include/asm-generic/io.h              | 42 +++++------------------------------
 10 files changed, 55 insertions(+), 105 deletions(-)
Signature · 1 line
1.8.0
#1 lore raw

PATCH v2 1/10 asm-generic: io: don't perform swab during {in,out} string functions

The {in,out}s{b,w,l} functions are designed to operate on a stream of bytes and therefore should not perform any byte-swapping, regardless of the CPU byte order.

This patch fixes the generic IO header so that {in,out}s{b,w,l} call the __raw_{read,write} functions directly rather than going via the endian-correcting accessors.

---
 include/asm-generic/io.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
include/asm-generic/io.h +6 -6
index 448303b..b2600f3 100644
@@ -148,7 +148,7 @@ static inline void insb(unsigned long addr, void *buffer, int count)
 	if (count) {
 		u8 *buf = buffer;
 		do {
-			u8 x = inb(addr);
+			u8 x = __raw_readb(addr + PCI_IOBASE);
 			*buf++ = x;
 		} while (--count);
 	}
@@ -161,7 +161,7 @@ static inline void insw(unsigned long addr, void *buffer, int count)
 	if (count) {
 		u16 *buf = buffer;
 		do {
-			u16 x = inw(addr);
+			u16 x = __raw_readw(addr + PCI_IOBASE);
 			*buf++ = x;
 		} while (--count);
 	}
@@ -174,7 +174,7 @@ static inline void insl(unsigned long addr, void *buffer, int count)
 	if (count) {
 		u32 *buf = buffer;
 		do {
-			u32 x = inl(addr);
+			u32 x = __raw_readl(addr + PCI_IOBASE);
 			*buf++ = x;
 		} while (--count);
 	}
@@ -187,7 +187,7 @@ static inline void outsb(unsigned long addr, const void *buffer, int count)
 	if (count) {
 		const u8 *buf = buffer;
 		do {
-			outb(*buf++, addr);
+			__raw_writeb(*buf++, addr + PCI_IOBASE);
 		} while (--count);
 	}
 }
@@ -199,7 +199,7 @@ static inline void outsw(unsigned long addr, const void *buffer, int count)
 	if (count) {
 		const u16 *buf = buffer;
 		do {
-			outw(*buf++, addr);
+			__raw_writew(*buf++, addr + PCI_IOBASE);
 		} while (--count);
 	}
 }
@@ -211,7 +211,7 @@ static inline void outsl(unsigned long addr, const void *buffer, int count)
 	if (count) {
 		const u32 *buf = buffer;
 		do {
-			outl(*buf++, addr);
+			__raw_writel(*buf++, addr + PCI_IOBASE);
 		} while (--count);
 	}
 }
Signature · 1 line
1.8.0
#2 lore raw

PATCH v2 2/10 mmc: mmci: use io{read,write}*_rep accessors instead of string functions

In reply to Will Deacon

The {read,write}s{b,w,l} operations are not defined by all architectures and are being removed from the asm-generic/io.h interface.

This patch replaces the usage of these string functions with io{read,write}{8,16,32}_rep calls instead, which are defined for all architectures.

Cc Chris Ball <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Davide Ciminaghi <[email protected]>
Cc Ben Herrenschmidt <[email protected]>

---

I believe Davide is pushing an identical patch to this one via rmk, but I'm including it here for completeness.

 drivers/mmc/host/mmci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mmc/host/mmci.c +4 -4
index edc3e9b..4f125b4 100644
@@ -840,14 +840,14 @@ static int mmci_pio_read(struct mmci_host *host, char *buffer, unsigned int rema
 		if (unlikely(count & 0x3)) {
 			if (count < 4) {
 				unsigned char buf[4];
-				readsl(base + MMCIFIFO, buf, 1);
+				ioread32_rep(base + MMCIFIFO, buf, 1);
 				memcpy(ptr, buf, count);
 			} else {
-				readsl(base + MMCIFIFO, ptr, count >> 2);
+				ioread32_rep(base + MMCIFIFO, ptr, count >> 2);
 				count &= ~0x3;
 			}
 		} else {
-			readsl(base + MMCIFIFO, ptr, count >> 2);
+			ioread32_rep(base + MMCIFIFO, ptr, count >> 2);
 		}
 
 		ptr += count;
@@ -900,7 +900,7 @@ static int mmci_pio_write(struct mmci_host *host, char *buffer, unsigned int rem
 		 * byte become a 32bit write, 7 bytes will be two
 		 * 32bit writes etc.
 		 */
-		writesl(base + MMCIFIFO, ptr, (count + 3) >> 2);
+		iowrite32_rep(base + MMCIFIFO, ptr, (count + 3) >> 2);
 
 		ptr += count;
 		remain -= count;
Signature · 1 line
1.8.0
#3 lore raw

PATCH v2 3/10 net: smc91x: use io{read,write}*_rep accessors instead of string functions

In reply to Will Deacon

The {read,write}s{b,w,l} operations are not defined by all architectures and are being removed from the asm-generic/io.h interface.

This patch replaces the usage of these string functions in the default SMC accessors with io{read,write}{8,16,32}_rep calls instead, which are defined for all architectures.

Cc Arnd Bergmann <[email protected]>
Cc Ben Herrenschmidt <[email protected]>
Cc Nicolas Pitre <[email protected]>
---
 drivers/net/ethernet/smsc/smc91x.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/net/ethernet/smsc/smc91x.h +10 -10
index 5f53fbb..370e13d 100644
@@ -286,16 +286,16 @@ static inline void mcf_outsw(void *a, unsigned char *p, int l)
 
 #define SMC_IO_SHIFT		(lp->io_shift)
 
-#define SMC_inb(a, r)		readb((a) + (r))
-#define SMC_inw(a, r)		readw((a) + (r))
-#define SMC_inl(a, r)		readl((a) + (r))
-#define SMC_outb(v, a, r)	writeb(v, (a) + (r))
-#define SMC_outw(v, a, r)	writew(v, (a) + (r))
-#define SMC_outl(v, a, r)	writel(v, (a) + (r))
-#define SMC_insw(a, r, p, l)	readsw((a) + (r), p, l)
-#define SMC_outsw(a, r, p, l)	writesw((a) + (r), p, l)
-#define SMC_insl(a, r, p, l)	readsl((a) + (r), p, l)
-#define SMC_outsl(a, r, p, l)	writesl((a) + (r), p, l)
+#define SMC_inb(a, r)		ioread8((a) + (r))
+#define SMC_inw(a, r)		ioread16((a) + (r))
+#define SMC_inl(a, r)		ioread32((a) + (r))
+#define SMC_outb(v, a, r)	iowrite8(v, (a) + (r))
+#define SMC_outw(v, a, r)	iowrite16(v, (a) + (r))
+#define SMC_outl(v, a, r)	iowrite32(v, (a) + (r))
+#define SMC_insw(a, r, p, l)	ioread16_rep((a) + (r), p, l)
+#define SMC_outsw(a, r, p, l)	iowrite16_rep((a) + (r), p, l)
+#define SMC_insl(a, r, p, l)	ioread32_rep((a) + (r), p, l)
+#define SMC_outsl(a, r, p, l)	iowrite32_rep((a) + (r), p, l)
 
 #define RPC_LSA_DEFAULT		RPC_LED_100_10
 #define RPC_LSB_DEFAULT		RPC_LED_TX_RX
Signature · 1 line
1.8.0
maintainer Applied
#4 lore raw

Re: [PATCH v2 03/10] net: smc91x: use io{read,write}*_rep accessors instead of string functions

From: Will Deacon <[email protected]>
Date: Mon, 10 Dec 2012 19:12:35 +0000

Quoted 7 lines

The {read,write}s{b,w,l} operations are not defined by all architectures and are being removed from the asm-generic/io.h interface.

This patch replaces the usage of these string functions in the default SMC accessors with io{read,write}{8,16,32}_rep calls instead, which are defined for all architectures.

Quoted 5 lines
Cc Arnd Bergmann <[email protected]>
Cc Ben Herrenschmidt <[email protected]>
Cc Nicolas Pitre <[email protected]>

Applied.

#5 lore raw

PATCH v2 4/10 net: smc911x: use io{read,write}*_rep accessors

In reply to Will Deacon

From: Matthew Leach <[email protected]>

The {read,write}s{b,w,l} operations are not defined by all architectures and are being removed from the asm-generic/io.h interface.

This patch replaces the usage of these string functions in the smc911x accessors with io{read,write}{8,16,32}_rep calls instead.

---
 drivers/net/ethernet/smsc/smc911x.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/ethernet/smsc/smc911x.h +8 -8
index 3269292..d51261b 100644
@@ -159,12 +159,12 @@ static inline void SMC_insl(struct smc911x_local *lp, int reg,
 	void __iomem *ioaddr = lp->base + reg;
 
 	if (lp->cfg.flags & SMC911X_USE_32BIT) {
-		readsl(ioaddr, addr, count);
+		ioread32_rep(ioaddr, addr, count);
 		return;
 	}
 
 	if (lp->cfg.flags & SMC911X_USE_16BIT) {
-		readsw(ioaddr, addr, count * 2);
+		ioread16_rep(ioaddr, addr, count * 2);
 		return;
 	}
 
@@ -177,12 +177,12 @@ static inline void SMC_outsl(struct smc911x_local *lp, int reg,
 	void __iomem *ioaddr = lp->base + reg;
 
 	if (lp->cfg.flags & SMC911X_USE_32BIT) {
-		writesl(ioaddr, addr, count);
+		iowrite32_rep(ioaddr, addr, count);
 		return;
 	}
 
 	if (lp->cfg.flags & SMC911X_USE_16BIT) {
-		writesw(ioaddr, addr, count * 2);
+		iowrite16_rep(ioaddr, addr, count * 2);
 		return;
 	}
 
@@ -196,14 +196,14 @@ static inline void SMC_outsl(struct smc911x_local *lp, int reg,
 		 writew(v & 0xFFFF, (lp)->base + (r));	 \
 		 writew(v >> 16, (lp)->base + (r) + 2); \
 	 } while (0)
-#define SMC_insl(lp, r, p, l)	 readsw((short*)((lp)->base + (r)), p, l*2)
-#define SMC_outsl(lp, r, p, l)	 writesw((short*)((lp)->base + (r)), p, l*2)
+#define SMC_insl(lp, r, p, l)	 ioread16_rep((short*)((lp)->base + (r)), p, l*2)
+#define SMC_outsl(lp, r, p, l)	 iowrite16_rep((short*)((lp)->base + (r)), p, l*2)
 
 #elif	SMC_USE_32BIT
 #define SMC_inl(lp, r)		 readl((lp)->base + (r))
 #define SMC_outl(v, lp, r)	 writel(v, (lp)->base + (r))
-#define SMC_insl(lp, r, p, l)	 readsl((int*)((lp)->base + (r)), p, l)
-#define SMC_outsl(lp, r, p, l)	 writesl((int*)((lp)->base + (r)), p, l)
+#define SMC_insl(lp, r, p, l)	 ioread32_rep((int*)((lp)->base + (r)), p, l)
+#define SMC_outsl(lp, r, p, l)	 iowrite32_rep((int*)((lp)->base + (r)), p, l)
 
 #endif /* SMC_USE_16BIT */
 #endif /* SMC_DYNAMIC_BUS_CONFIG */
Signature · 1 line
1.8.0
maintainer
#6 lore raw

Re: [PATCH v2 04/10] net: smc911x: use io{read,write}*_rep accessors

From: Will Deacon <[email protected]>
Date: Mon, 10 Dec 2012 19:12:36 +0000

Quoted 6 lines

From: Matthew Leach <[email protected]>

The {read,write}s{b,w,l} operations are not defined by all architectures and are being removed from the asm-generic/io.h interface.

Quoted 8 lines

This patch replaces the usage of these string functions in the smc911x accessors with io{read,write}{8,16,32}_rep calls instead.

This misses the two uses in smsc911x_tx_writefifo and smsc911x_rx_readfifo.

#7 lore raw

Re: [PATCH v2 04/10] net: smc911x: use io{read,write}*_rep accessors

Hi David,

Quoted 12 lines · David Miller

From: Will Deacon <[email protected]>
Date: Mon, 10 Dec 2012 19:12:36 +0000

Quoted 9 lines

From: Matthew Leach <[email protected]>

The {read,write}s{b,w,l} operations are not defined by all architectures and are being removed from the asm-generic/io.h interface.

This patch replaces the usage of these string functions in the smc911x accessors with io{read,write}{8,16,32}_rep calls instead.

Quoted 8 lines
Quoted 5 lines

This misses the two uses in smsc911x_tx_writefifo and smsc911x_rx_readfifo.

Well spotted, updated patch below.

Cheers,

Will

--->8

Quoted 1 line

From b46e33465e755e945136d19938c9a8331cbafce7 Mon Sep 17 00:00:00 2001

From: Matthew Leach <[email protected]>
Date: Tue, 6 Nov 2012 14:51:11 +0000
Subject: [PATCH v3] net: smc911x: use io{read,write}*_rep accessors

The {read,write}s{b,w,l} operations are not defined by all architectures and are being removed from the asm-generic/io.h interface.

This patch replaces the usage of these string functions in the smc911x accessors with io{read,write}{8,16,32}_rep calls instead.

---
 drivers/net/ethernet/smsc/smc911x.h  | 16 ++++++++--------
 drivers/net/ethernet/smsc/smsc911x.c |  8 ++++----
 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/net/ethernet/smsc/smc911x.h +8 -8
index 3269292..d51261b 100644
@@ -159,12 +159,12 @@ static inline void SMC_insl(struct smc911x_local *lp, int reg,
 	void __iomem *ioaddr = lp->base + reg;
 
 	if (lp->cfg.flags & SMC911X_USE_32BIT) {
-		readsl(ioaddr, addr, count);
+		ioread32_rep(ioaddr, addr, count);
 		return;
 	}
 
 	if (lp->cfg.flags & SMC911X_USE_16BIT) {
-		readsw(ioaddr, addr, count * 2);
+		ioread16_rep(ioaddr, addr, count * 2);
 		return;
 	}
 
@@ -177,12 +177,12 @@ static inline void SMC_outsl(struct smc911x_local *lp, int reg,
 	void __iomem *ioaddr = lp->base + reg;
 
 	if (lp->cfg.flags & SMC911X_USE_32BIT) {
-		writesl(ioaddr, addr, count);
+		iowrite32_rep(ioaddr, addr, count);
 		return;
 	}
 
 	if (lp->cfg.flags & SMC911X_USE_16BIT) {
-		writesw(ioaddr, addr, count * 2);
+		iowrite16_rep(ioaddr, addr, count * 2);
 		return;
 	}
 
@@ -196,14 +196,14 @@ static inline void SMC_outsl(struct smc911x_local *lp, int reg,
 		 writew(v & 0xFFFF, (lp)->base + (r));	 \
 		 writew(v >> 16, (lp)->base + (r) + 2); \
 	 } while (0)
-#define SMC_insl(lp, r, p, l)	 readsw((short*)((lp)->base + (r)), p, l*2)
-#define SMC_outsl(lp, r, p, l)	 writesw((short*)((lp)->base + (r)), p, l*2)
+#define SMC_insl(lp, r, p, l)	 ioread16_rep((short*)((lp)->base + (r)), p, l*2)
+#define SMC_outsl(lp, r, p, l)	 iowrite16_rep((short*)((lp)->base + (r)), p, l*2)
 
 #elif	SMC_USE_32BIT
 #define SMC_inl(lp, r)		 readl((lp)->base + (r))
 #define SMC_outl(v, lp, r)	 writel(v, (lp)->base + (r))
-#define SMC_insl(lp, r, p, l)	 readsl((int*)((lp)->base + (r)), p, l)
-#define SMC_outsl(lp, r, p, l)	 writesl((int*)((lp)->base + (r)), p, l)
+#define SMC_insl(lp, r, p, l)	 ioread32_rep((int*)((lp)->base + (r)), p, l)
+#define SMC_outsl(lp, r, p, l)	 iowrite32_rep((int*)((lp)->base + (r)), p, l)
 
 #endif /* SMC_USE_16BIT */
 #endif /* SMC_DYNAMIC_BUS_CONFIG */
drivers/net/ethernet/smsc/smsc911x.c +4 -4
index c53c0f4..9d46167 100644
@@ -253,7 +253,7 @@ smsc911x_tx_writefifo(struct smsc911x_data *pdata, unsigned int *buf,
 	}
 
 	if (pdata->config.flags & SMSC911X_USE_32BIT) {
-		writesl(pdata->ioaddr + TX_DATA_FIFO, buf, wordcount);
+		iowrite32_rep(pdata->ioaddr + TX_DATA_FIFO, buf, wordcount);
 		goto out;
 	}
 
@@ -285,7 +285,7 @@ smsc911x_tx_writefifo_shift(struct smsc911x_data *pdata, unsigned int *buf,
 	}
 
 	if (pdata->config.flags & SMSC911X_USE_32BIT) {
-		writesl(pdata->ioaddr + __smsc_shift(pdata,
+		iowrite32_rep(pdata->ioaddr + __smsc_shift(pdata,
 						TX_DATA_FIFO), buf, wordcount);
 		goto out;
 	}
@@ -319,7 +319,7 @@ smsc911x_rx_readfifo(struct smsc911x_data *pdata, unsigned int *buf,
 	}
 
 	if (pdata->config.flags & SMSC911X_USE_32BIT) {
-		readsl(pdata->ioaddr + RX_DATA_FIFO, buf, wordcount);
+		ioread32_rep(pdata->ioaddr + RX_DATA_FIFO, buf, wordcount);
 		goto out;
 	}
 
@@ -351,7 +351,7 @@ smsc911x_rx_readfifo_shift(struct smsc911x_data *pdata, unsigned int *buf,
 	}
 
 	if (pdata->config.flags & SMSC911X_USE_32BIT) {
-		readsl(pdata->ioaddr + __smsc_shift(pdata,
+		ioread32_rep(pdata->ioaddr + __smsc_shift(pdata,
 						RX_DATA_FIFO), buf, wordcount);
 		goto out;
 	}
Signature · 1 line
1.8.0
maintainer Applied
#8 lore raw

Re: [PATCH v2 04/10] net: smc911x: use io{read,write}*_rep accessors

From: Will Deacon <[email protected]>
Date: Tue, 11 Dec 2012 14:49:49 +0000

Quoted 5 lines · David Miller
Quoted 2 lines

This misses the two uses in smsc911x_tx_writefifo and smsc911x_rx_readfifo.

Well spotted, updated patch below.

Although I'd like to take credit, the compiler told me :-)

Quoted 9 lines

From b46e33465e755e945136d19938c9a8331cbafce7 Mon Sep 17 00:00:00 2001
From: Matthew Leach <[email protected]>
Date: Tue, 6 Nov 2012 14:51:11 +0000
Subject: [PATCH v3] net: smc911x: use io{read,write}*_rep accessors

The {read,write}s{b,w,l} operations are not defined by all architectures and are being removed from the asm-generic/io.h interface.

Quoted 8 lines

This patch replaces the usage of these string functions in the smc911x accessors with io{read,write}{8,16,32}_rep calls instead.

Applied, thanks.

#9 lore raw

PATCH v2 5/10 net: dm9000: use io{read,write}*_rep accessors

In reply to Will Deacon

From: Matthew Leach <[email protected]>

The {read,write}s{b,w,l} operations are not defined by all architectures and are being removed from the asm-generic/io.h interface.

This patch replaces the usage of these string functions in the default DM9000 accessors with io{read,write}{8,16,32}_rep calls instead. This is required as the dm9000 driver is in use by the blackfin architecture which uses the asm-generic io accessors.

---
 drivers/net/ethernet/davicom/dm9000.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/davicom/dm9000.c +6 -6
index 36499d5..61648a6 100644
@@ -193,35 +193,35 @@ iow(board_info_t * db, int reg, int value)
 
 static void dm9000_outblk_8bit(void __iomem *reg, void *data, int count)
 {
-	writesb(reg, data, count);
+	iowrite8_rep(reg, data, count);
 }
 
 static void dm9000_outblk_16bit(void __iomem *reg, void *data, int count)
 {
-	writesw(reg, data, (count+1) >> 1);
+	iowrite16_rep(reg, data, (count+1) >> 1);
 }
 
 static void dm9000_outblk_32bit(void __iomem *reg, void *data, int count)
 {
-	writesl(reg, data, (count+3) >> 2);
+	iowrite32_rep(reg, data, (count+3) >> 2);
 }
 
 /* input block from chip to memory */
 
 static void dm9000_inblk_8bit(void __iomem *reg, void *data, int count)
 {
-	readsb(reg, data, count);
+	ioread8_rep(reg, data, count);
 }
 
 
 static void dm9000_inblk_16bit(void __iomem *reg, void *data, int count)
 {
-	readsw(reg, data, (count+1) >> 1);
+	ioread16_rep(reg, data, (count+1) >> 1);
 }
 
 static void dm9000_inblk_32bit(void __iomem *reg, void *data, int count)
 {
-	readsl(reg, data, (count+3) >> 2);
+	ioread32_rep(reg, data, (count+3) >> 2);
 }
 
 /* dump block from chip to null */
Signature · 1 line
1.8.0
maintainer Applied
#10 lore raw

Re: [PATCH v2 05/10] net: dm9000: use io{read,write}*_rep accessors

From: Will Deacon <[email protected]>
Date: Mon, 10 Dec 2012 19:12:37 +0000

Quoted 11 lines

From: Matthew Leach <[email protected]>

The {read,write}s{b,w,l} operations are not defined by all architectures and are being removed from the asm-generic/io.h interface.

This patch replaces the usage of these string functions in the default DM9000 accessors with io{read,write}{8,16,32}_rep calls instead. This is required as the dm9000 driver is in use by the blackfin architecture which uses the asm-generic io accessors.

Quoted 6 lines

Applied.

#11 lore raw

PATCH v2 6/10 net: 8390: use io{read,write}*_rep accessors

In reply to Will Deacon

From: Matthew Leach <[email protected]>

The {read,write}s{b,w,l} operations are not defined by all architectures and are being removed from the asm-generic/io.h interface.

This patch replaces the usage of these string functions in the 8390 accessors with io{read,write}{8,16,32}_rep calls instead.

---
 drivers/net/ethernet/8390/ax88796.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/ethernet/8390/ax88796.c +8 -8
index 203ff9d..0338352 100644
@@ -191,11 +191,11 @@ static void ax_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr,
 	ei_outb(E8390_RREAD+E8390_START, nic_base + NE_CMD);
 
 	if (ei_local->word16)
-		readsw(nic_base + NE_DATAPORT, hdr,
-		       sizeof(struct e8390_pkt_hdr) >> 1);
+		ioread16_rep(nic_base + NE_DATAPORT, hdr,
+			     sizeof(struct e8390_pkt_hdr) >> 1);
 	else
-		readsb(nic_base + NE_DATAPORT, hdr,
-		       sizeof(struct e8390_pkt_hdr));
+		ioread8_rep(nic_base + NE_DATAPORT, hdr,
+			    sizeof(struct e8390_pkt_hdr));
 
 	ei_outb(ENISR_RDC, nic_base + EN0_ISR);	/* Ack intr. */
 	ei_local->dmaing &= ~0x01;
@@ -237,12 +237,12 @@ static void ax_block_input(struct net_device *dev, int count,
 	ei_outb(E8390_RREAD+E8390_START, nic_base + NE_CMD);
 
 	if (ei_local->word16) {
-		readsw(nic_base + NE_DATAPORT, buf, count >> 1);
+		ioread16_rep(nic_base + NE_DATAPORT, buf, count >> 1);
 		if (count & 0x01)
 			buf[count-1] = ei_inb(nic_base + NE_DATAPORT);
 
 	} else {
-		readsb(nic_base + NE_DATAPORT, buf, count);
+		ioread8_rep(nic_base + NE_DATAPORT, buf, count);
 	}
 
 	ei_local->dmaing &= ~1;
@@ -286,9 +286,9 @@ static void ax_block_output(struct net_device *dev, int count,
 
 	ei_outb(E8390_RWRITE+E8390_START, nic_base + NE_CMD);
 	if (ei_local->word16)
-		writesw(nic_base + NE_DATAPORT, buf, count >> 1);
+		iowrite16_rep(nic_base + NE_DATAPORT, buf, count >> 1);
 	else
-		writesb(nic_base + NE_DATAPORT, buf, count);
+		iowrite8_rep(nic_base + NE_DATAPORT, buf, count);
 
 	dma_start = jiffies;
 
Signature · 1 line
1.8.0
maintainer Applied
#12 lore raw

Re: [PATCH v2 06/10] net: 8390: use io{read,write}*_rep accessors

From: Will Deacon <[email protected]>
Date: Mon, 10 Dec 2012 19:12:38 +0000

Quoted 9 lines

From: Matthew Leach <[email protected]>

The {read,write}s{b,w,l} operations are not defined by all architectures and are being removed from the asm-generic/io.h interface.

This patch replaces the usage of these string functions in the 8390 accessors with io{read,write}{8,16,32}_rep calls instead.

Quoted 6 lines

Applied.

#13 lore raw

PATCH v2 7/10 mtd: nand/gpio: use io{read,write}*_rep accessors

In reply to Will Deacon

From: Matthew Leach <[email protected]>

The {read,write}s{b,w,l} operations are not defined by all architectures and are being removed from the asm-generic/io.h interface.

This patch replaces the usage of these string functions in the mtd gpio accessors with io{read,write}{8,16,32}_rep calls instead.

Cc Arnd Bergmann <[email protected]>
Cc Ben Herrenschmidt <[email protected]>
Cc David Woodhouse <[email protected]>
---
 drivers/mtd/nand/gpio.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/nand/gpio.c +4 -4
index bc73bc5..0d233e9 100644
@@ -90,14 +90,14 @@ static void gpio_nand_writebuf(struct mtd_info *mtd, const u_char *buf, int len)
 {
 	struct nand_chip *this = mtd->priv;
 
-	writesb(this->IO_ADDR_W, buf, len);
+	iowrite8_rep(this->IO_ADDR_W, buf, len);
 }
 
 static void gpio_nand_readbuf(struct mtd_info *mtd, u_char *buf, int len)
 {
 	struct nand_chip *this = mtd->priv;
 
-	readsb(this->IO_ADDR_R, buf, len);
+	ioread8_rep(this->IO_ADDR_R, buf, len);
 }
 
 static void gpio_nand_writebuf16(struct mtd_info *mtd, const u_char *buf,
@@ -106,7 +106,7 @@ static void gpio_nand_writebuf16(struct mtd_info *mtd, const u_char *buf,
 	struct nand_chip *this = mtd->priv;
 
 	if (IS_ALIGNED((unsigned long)buf, 2)) {
-		writesw(this->IO_ADDR_W, buf, len>>1);
+		iowrite16_rep(this->IO_ADDR_W, buf, len>>1);
 	} else {
 		int i;
 		unsigned short *ptr = (unsigned short *)buf;
@@ -121,7 +121,7 @@ static void gpio_nand_readbuf16(struct mtd_info *mtd, u_char *buf, int len)
 	struct nand_chip *this = mtd->priv;
 
 	if (IS_ALIGNED((unsigned long)buf, 2)) {
-		readsw(this->IO_ADDR_R, buf, len>>1);
+		ioread16_rep(this->IO_ADDR_R, buf, len>>1);
 	} else {
 		int i;
 		unsigned short *ptr = (unsigned short *)buf;
Signature · 1 line
1.8.0
#14 lore raw

Re: [PATCH v2 07/10] mtd: nand/gpio: use io{read,write}*_rep accessors

Quoted 8 lines · Will Deacon

From: Matthew Leach <[email protected]>

The {read,write}s{b,w,l} operations are not defined by all architectures and are being removed from the asm-generic/io.h interface.

This patch replaces the usage of these string functions in the mtd gpio accessors with io{read,write}{8,16,32}_rep calls instead.

Pushed this one to l2-mtd.git, thanks!

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#15 lore raw

PATCH v2 8/10 musb: tusb6010: use io{read,write}*_rep accessors

In reply to Will Deacon

From: Matthew Leach <[email protected]>

The {read,write}s{b,w,l} operations are not defined by all architectures and are being removed from the asm-generic/io.h interface.

This patch replaces the usage of these string functions in the tusb6010 accessors with io{read,write}{8,16,32}_rep calls instead.

---
 drivers/usb/musb/tusb6010.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/musb/tusb6010.c +3 -2
index dc4d75e..0cc2f50 100644
@@ -22,6 +22,7 @@
 #include <linux/prefetch.h>
 #include <linux/usb.h>
 #include <linux/irq.h>
+#include <linux/io.h>
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
 #include <linux/usb/nop-usb-xceiv.h>
@@ -198,7 +199,7 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *buf)
 		/* Best case is 32bit-aligned destination address */
 		if ((0x02 & (unsigned long) buf) == 0) {
 			if (len >= 4) {
-				writesl(fifo, buf, len >> 2);
+				iowrite32_rep(fifo, buf, len >> 2);
 				buf += (len & ~0x03);
 				len &= 0x03;
 			}
@@ -245,7 +246,7 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *buf)
 		/* Best case is 32bit-aligned destination address */
 		if ((0x02 & (unsigned long) buf) == 0) {
 			if (len >= 4) {
-				readsl(fifo, buf, len >> 2);
+				ioread32_rep(fifo, buf, len >> 2);
 				buf += (len & ~0x03);
 				len &= 0x03;
 			}
Signature · 1 line
1.8.0
#16 lore raw

PATCH v2 9/10 usb: musb: use io{read,write}*_rep accessors

In reply to Will Deacon

From: Matthew Leach <[email protected]>

The {read,write}s{b,w,l} operations are not defined by all architectures and are being removed from the asm-generic/io.h interface.

This patch replaces the usage of these string functions in the musb accessors with io{read,write}{8,16,32}_rep calls instead.

---
 drivers/usb/musb/musb_core.c | 12 ++++++------
 drivers/usb/musb/musb_io.h   | 21 ---------------------
 2 files changed, 6 insertions(+), 27 deletions(-)
drivers/usb/musb/musb_core.c +6 -6
index bb56a0e..4f45e97 100644
@@ -281,7 +281,7 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
 		/* best case is 32bit-aligned source address */
 		if ((0x02 & (unsigned long) src) == 0) {
 			if (len >= 4) {
-				writesl(fifo, src + index, len >> 2);
+				iowrite32_rep(fifo, src + index, len >> 2);
 				index += len & ~0x03;
 			}
 			if (len & 0x02) {
@@ -290,7 +290,7 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
 			}
 		} else {
 			if (len >= 2) {
-				writesw(fifo, src + index, len >> 1);
+				iowrite16_rep(fifo, src + index, len >> 1);
 				index += len & ~0x01;
 			}
 		}
@@ -298,7 +298,7 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
 			musb_writeb(fifo, 0, src[index]);
 	} else  {
 		/* byte aligned */
-		writesb(fifo, src, len);
+		iowrite8_rep(fifo, src, len);
 	}
 }
 
@@ -324,7 +324,7 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
 		/* best case is 32bit-aligned destination address */
 		if ((0x02 & (unsigned long) dst) == 0) {
 			if (len >= 4) {
-				readsl(fifo, dst, len >> 2);
+				ioread32_rep(fifo, dst, len >> 2);
 				index = len & ~0x03;
 			}
 			if (len & 0x02) {
@@ -333,7 +333,7 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
 			}
 		} else {
 			if (len >= 2) {
-				readsw(fifo, dst, len >> 1);
+				ioread16_rep(fifo, dst, len >> 1);
 				index = len & ~0x01;
 			}
 		}
@@ -341,7 +341,7 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
 			dst[index] = musb_readb(fifo, 0);
 	} else  {
 		/* byte aligned */
-		readsb(fifo, dst, len);
+		ioread8_rep(fifo, dst, len);
 	}
 }
 #endif
drivers/usb/musb/musb_io.h +0 -21
index 565ad16..eebeed7 100644
@@ -37,27 +37,6 @@
 
 #include <linux/io.h>
 
-#if !defined(CONFIG_ARM) && !defined(CONFIG_SUPERH) \
-	&& !defined(CONFIG_AVR32) && !defined(CONFIG_PPC32) \
-	&& !defined(CONFIG_PPC64) && !defined(CONFIG_BLACKFIN) \
-	&& !defined(CONFIG_MIPS) && !defined(CONFIG_M68K) \
-	&& !defined(CONFIG_XTENSA)
-static inline void readsl(const void __iomem *addr, void *buf, int len)
-	{ insl((unsigned long)addr, buf, len); }
-static inline void readsw(const void __iomem *addr, void *buf, int len)
-	{ insw((unsigned long)addr, buf, len); }
-static inline void readsb(const void __iomem *addr, void *buf, int len)
-	{ insb((unsigned long)addr, buf, len); }
-
-static inline void writesl(const void __iomem *addr, const void *buf, int len)
-	{ outsl((unsigned long)addr, buf, len); }
-static inline void writesw(const void __iomem *addr, const void *buf, int len)
-	{ outsw((unsigned long)addr, buf, len); }
-static inline void writesb(const void __iomem *addr, const void *buf, int len)
-	{ outsb((unsigned long)addr, buf, len); }
-
-#endif
-
 #ifndef CONFIG_BLACKFIN
 
 /* NOTE:  these offsets are all in bytes */
Signature · 1 line
1.8.0
#17 lore raw

PATCH v2 10/10 asm-generic: io: remove {read,write} string functions

In reply to Will Deacon

The {read,write}s{b,w,l} functions are not defined across all architectures and therefore shouldn't be used by portable drivers. We should encourage driver writers to use the io{read,write}{8,16,32}_rep functions instead.

This patch removes the {read,write} string functions for the generic IO header as they have no place in a new architecture port.

---
 include/asm-generic/io.h | 30 ------------------------------
 1 file changed, 30 deletions(-)
include/asm-generic/io.h +0 -30
index b2600f3..403b861 100644
@@ -217,36 +217,6 @@ static inline void outsl(unsigned long addr, const void *buffer, int count)
 }
 #endif
 
-static inline void readsl(const void __iomem *addr, void *buf, int len)
-{
-	insl(addr - PCI_IOBASE, buf, len);
-}
-
-static inline void readsw(const void __iomem *addr, void *buf, int len)
-{
-	insw(addr - PCI_IOBASE, buf, len);
-}
-
-static inline void readsb(const void __iomem *addr, void *buf, int len)
-{
-	insb(addr - PCI_IOBASE, buf, len);
-}
-
-static inline void writesl(const void __iomem *addr, const void *buf, int len)
-{
-	outsl(addr - PCI_IOBASE, buf, len);
-}
-
-static inline void writesw(const void __iomem *addr, const void *buf, int len)
-{
-	outsw(addr - PCI_IOBASE, buf, len);
-}
-
-static inline void writesb(const void __iomem *addr, const void *buf, int len)
-{
-	outsb(addr - PCI_IOBASE, buf, len);
-}
-
 #ifndef CONFIG_GENERIC_IOMAP
 #define ioread8(addr)		readb(addr)
 #define ioread16(addr)		readw(addr)
Signature · 1 line
1.8.0