Skip to contentSkip to conversation

Use linux/io.h instead of asm/io.h

PATCH In review Matthew Wilcox 5 participants 9 messages Oct 5, 2006 – Oct 8, 2006

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

PATCH 1/1 Use linux/io.h instead of asm/io.h

In preparation for moving check_signature, change these users from asm/io.h to linux/io.h

---
 drivers/block/xd.c                |    2 +-
 drivers/input/misc/wistron_btns.c |    2 +-
 drivers/net/eth16i.c              |    2 +-
 drivers/scsi/aha152x.c            |    2 +-
 drivers/scsi/dtc.c                |    2 +-
 drivers/scsi/fdomain.c            |    2 +-
 drivers/scsi/seagate.c            |    2 +-
 drivers/scsi/t128.c               |    2 +-
 drivers/scsi/wd7000.c             |    2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)
drivers/block/xd.c +1 -1
index ebf3025..dd43361 100644
@@ -48,9 +48,9 @@ #include <linux/wait.h>
 #include <linux/blkdev.h>
 #include <linux/blkpg.h>
 #include <linux/delay.h>
+#include <linux/io.h>
 
 #include <asm/system.h>
-#include <asm/io.h>
 #include <asm/uaccess.h>
 #include <asm/dma.h>
 
drivers/input/misc/wistron_btns.c +1 -1
index 4639537..7b9d1c1 100644
@@ -17,7 +17,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 59 Temple Place Suite 330, Boston, MA 02111-1307, USA.
  */
-#include <asm/io.h>
+#include <linux/io.h>
 #include <linux/dmi.h>
 #include <linux/init.h>
 #include <linux/input.h>
drivers/net/eth16i.c +1 -1
index f16b6a5..a731c10 100644
@@ -162,9 +162,9 @@ #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 #include <linux/bitops.h>
 #include <linux/jiffies.h>
+#include <linux/io.h>		  
 
 #include <asm/system.h>
-#include <asm/io.h>
 #include <asm/dma.h>
 
 
drivers/scsi/aha152x.c +1 -1
index fb6a476..004c152 100644
@@ -238,7 +238,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <asm/irq.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <linux/blkdev.h>
 #include <asm/system.h>
 #include <linux/errno.h>
drivers/scsi/dtc.c +1 -1
index 0d5713d..5475672 100644
@@ -82,7 +82,7 @@ #include <linux/stat.h>
 #include <linux/string.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include "scsi.h"
 #include <scsi/scsi_host.h>
 #include "dtc.h"
drivers/scsi/fdomain.c +1 -1
index b0694dc..df1ec7c 100644
@@ -278,9 +278,9 @@ #include <linux/proc_fs.h>
 #include <linux/pci.h>
 #include <linux/stat.h>
 #include <linux/delay.h>
+#include <linux/io.h>
 #include <scsi/scsicam.h>
 
-#include <asm/io.h>
 #include <asm/system.h>
 
 #include <scsi/scsi.h>
drivers/scsi/seagate.c +1 -1
index 4e6666c..0ade232 100644
@@ -97,8 +97,8 @@ #include <linux/init.h>
 #include <linux/blkdev.h>
 #include <linux/stat.h>
 #include <linux/delay.h>
+#include <linux/io.h>
 
-#include <asm/io.h>
 #include <asm/system.h>
 #include <asm/uaccess.h>
 
drivers/scsi/t128.c +1 -1
index 2df6747..0b7a70f 100644
@@ -109,7 +109,7 @@ #define PSEUDO_DMA
 #include <asm/system.h>
 #include <linux/signal.h>
 #include <linux/sched.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <linux/blkdev.h>
 #include <linux/interrupt.h>
 #include <linux/stat.h>
drivers/scsi/wd7000.c +1 -1
index a0b61af..96ec581 100644
@@ -178,10 +178,10 @@ #include <linux/proc_fs.h>
 #include <linux/blkdev.h>
 #include <linux/init.h>
 #include <linux/stat.h>
+#include <linux/io.h>
 
 #include <asm/system.h>
 #include <asm/dma.h>
-#include <asm/io.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
Signature · 1 line
1.4.1.1
#1 lore raw

PATCH 1/1 Consolidate check_signature

There's nothing arch-specific about check_signature(), so move it to <linux/io.h>. Use a cross between the Alpha and i386 implementations as the generic one.

---
 include/asm-alpha/io.h   |   13 -------------
 include/asm-arm/io.h     |   17 -----------------
 include/asm-frv/io.h     |   21 ---------------------
 include/asm-i386/io.h    |   27 ---------------------------
 include/asm-m32r/io.h    |   32 --------------------------------
 include/asm-mips/io.h    |   26 --------------------------
 include/asm-powerpc/io.h |   26 --------------------------
 include/asm-ppc/io.h     |   16 ----------------
 include/asm-sh/io.h      |   16 ----------------
 include/asm-sh64/io.h    |   16 ----------------
 include/asm-sparc64/io.h |   15 ---------------
 include/asm-x86_64/io.h  |   27 ---------------------------
 include/linux/io.h       |   27 +++++++++++++++++++++++++++
 13 files changed, 27 insertions(+), 252 deletions(-)
include/asm-alpha/io.h +0 -13
index f5ae98c..5d15af2 100644
@@ -533,19 +533,6 @@ extern void outsl (unsigned long port, c
 #define eth_io_copy_and_sum(skb,src,len,unused) \
   memcpy_fromio((skb)->data,src,len)
 
-static inline int
-check_signature(const volatile void __iomem *io_addr,
-		const unsigned char *signature, int length)
-{
-	do {
-		if (readb(io_addr) != *signature)
-			return 0;
-		io_addr++;
-		signature++;
-	} while (--length);
-	return 1;
-}
-
 /*
  * The Alpha Jensen hardware for some rather strange reason puts
  * the RTC clock at 0x170 instead of 0x70. Probably due to some
include/asm-arm/io.h +0 -17
index 8076a85..54d5f94 100644
@@ -193,23 +193,6 @@ #define memcpy_toio(c,a,l)	_memcpy_toio(
 #define eth_io_copy_and_sum(s,c,l,b) \
 				eth_copy_and_sum((s),__mem_pci(c),(l),(b))
 
-static inline int
-check_signature(void __iomem *io_addr, const unsigned char *signature,
-		int length)
-{
-	int retval = 0;
-	do {
-		if (readb(io_addr) != *signature)
-			goto out;
-		io_addr++;
-		signature++;
-		length--;
-	} while (length);
-	retval = 1;
-out:
-	return retval;
-}
-
 #elif !defined(readb)
 
 #define readb(c)			(__readwrite_bug("readb"),0)
include/asm-frv/io.h +0 -21
index 7765f55..20e44fe 100644
@@ -385,27 +385,6 @@ #define xlate_dev_mem_ptr(p)	__va(p)
  */
 #define xlate_dev_kmem_ptr(p)	p
 
-/*
- * Check BIOS signature
- */
-static inline int check_signature(volatile void __iomem *io_addr,
-				  const unsigned char *signature, int length)
-{
-	int retval = 0;
-
-	do {
-		if (readb(io_addr) != *signature)
-			goto out;
-		io_addr++;
-		signature++;
-		length--;
-	} while (length);
-
-	retval = 1;
-out:
-	return retval;
-}
-
 #endif /* __KERNEL__ */
 
 #endif /* _ASM_IO_H */
include/asm-i386/io.h +0 -27
index b3724fe..68df0dc 100644
@@ -224,33 +224,6 @@ #define __ISA_IO_base ((char __iomem *)(
 
 #define eth_io_copy_and_sum(a,b,c,d)		eth_copy_and_sum((a),(void __force *)(b),(c),(d))
 
-/**
- *	check_signature		-	find BIOS signatures
- *	@io_addr: mmio address to check 
- *	@signature:  signature block
- *	@length: length of signature
- *
- *	Perform a signature comparison with the mmio address io_addr. This
- *	address should have been obtained by ioremap.
- *	Returns 1 on a match.
- */
- 
-static inline int check_signature(volatile void __iomem * io_addr,
-	const unsigned char *signature, int length)
-{
-	int retval = 0;
-	do {
-		if (readb(io_addr) != *signature)
-			goto out;
-		io_addr++;
-		signature++;
-		length--;
-	} while (length);
-	retval = 1;
-out:
-	return retval;
-}
-
 /*
  *	Cache management
  *
include/asm-m32r/io.h +0 -32
index 70ad1c9..d06933b 100644
@@ -166,38 +166,6 @@ #define mmiowb()
 
 #define flush_write_buffers() do { } while (0)  /* M32R_FIXME */
 
-/**
- *	check_signature		-	find BIOS signatures
- *	@io_addr: mmio address to check
- *	@signature:  signature block
- *	@length: length of signature
- *
- *	Perform a signature comparison with the ISA mmio address io_addr.
- *	Returns 1 on a match.
- *
- *	This function is deprecated. New drivers should use ioremap and
- *	check_signature.
- */
-
-static inline int check_signature(void __iomem *io_addr,
-        const unsigned char *signature, int length)
-{
-        int retval = 0;
-#if 0
-printk("check_signature\n");
-        do {
-                if (readb(io_addr) != *signature)
-                        goto out;
-                io_addr++;
-                signature++;
-                length--;
-        } while (length);
-        retval = 1;
-out:
-#endif
-        return retval;
-}
-
 static inline void
 memset_io(volatile void __iomem *addr, unsigned char val, int count)
 {
include/asm-mips/io.h +0 -26
index df624e1..c2d124b 100644
@@ -562,32 +562,6 @@ #define __ISA_IO_base ((char *)(isa_slot
 #define eth_io_copy_and_sum(skb,src,len,unused) memcpy_fromio((skb)->data,(src),(len))
 
 /*
- *     check_signature         -       find BIOS signatures
- *     @io_addr: mmio address to check
- *     @signature:  signature block
- *     @length: length of signature
- *
- *     Perform a signature comparison with the mmio address io_addr. This
- *     address should have been obtained by ioremap.
- *     Returns 1 on a match.
- */
-static inline int check_signature(char __iomem *io_addr,
-	const unsigned char *signature, int length)
-{
-	int retval = 0;
-	do {
-		if (readb(io_addr) != *signature)
-			goto out;
-		io_addr++;
-		signature++;
-		length--;
-	} while (length);
-	retval = 1;
-out:
-	return retval;
-}
-
-/*
  * The caches on some architectures aren't dma-coherent and have need to
  * handle this in software.  There are three types of operations that
  * can be applied to dma buffers.
include/asm-powerpc/io.h +0 -26
index cbbd8c6..3baff8b 100644
@@ -404,32 +404,6 @@ static inline void __out_be64(volatile u
 
 #include <asm/eeh.h>
 
-/**
- *	check_signature		-	find BIOS signatures
- *	@io_addr: mmio address to check
- *	@signature:  signature block
- *	@length: length of signature
- *
- *	Perform a signature comparison with the mmio address io_addr. This
- *	address should have been obtained by ioremap.
- *	Returns 1 on a match.
- */
-static inline int check_signature(const volatile void __iomem * io_addr,
-	const unsigned char *signature, int length)
-{
-	int retval = 0;
-	do {
-		if (readb(io_addr) != *signature)
-			goto out;
-		io_addr++;
-		signature++;
-		length--;
-	} while (length);
-	retval = 1;
-out:
-	return retval;
-}
-
 /* Nothing to do */
 
 #define dma_cache_inv(_start,_size)		do { } while (0)
include/asm-ppc/io.h +0 -16
index 3d9a9e6..a4c411b 100644
@@ -439,22 +439,6 @@ #define iobarrier_rw() eieio()
 #define iobarrier_r()  eieio()
 #define iobarrier_w()  eieio()
 
-static inline int check_signature(volatile void __iomem * io_addr,
-	const unsigned char *signature, int length)
-{
-	int retval = 0;
-	do {
-		if (readb(io_addr) != *signature)
-			goto out;
-		io_addr++;
-		signature++;
-		length--;
-	} while (length);
-	retval = 1;
-out:
-	return retval;
-}
-
 /*
  * Here comes the ppc implementation of the IOMAP 
  * interfaces.
include/asm-sh/io.h +0 -16
index ed12d38..a0e55b0 100644
@@ -304,22 +304,6 @@ #define p3_ioremap(offset, size, flags)	
 #define iounmap(addr)					\
 	__iounmap((addr))
 
-static inline int check_signature(char __iomem *io_addr,
-			const unsigned char *signature, int length)
-{
-	int retval = 0;
-	do {
-		if (readb(io_addr) != *signature)
-			goto out;
-		io_addr++;
-		signature++;
-		length--;
-	} while (length);
-	retval = 1;
-out:
-	return retval;
-}
-
 /*
  * The caches on some architectures aren't dma-coherent and have need to
  * handle this in software.  There are three types of operations that
include/asm-sh64/io.h +0 -16
index 252fedb..14d8e7b 100644
@@ -178,22 +178,6 @@ extern void iounmap(void *addr);
 unsigned long onchip_remap(unsigned long addr, unsigned long size, const char* name);
 extern void onchip_unmap(unsigned long vaddr);
 
-static __inline__ int check_signature(volatile void __iomem *io_addr,
-			const unsigned char *signature, int length)
-{
-	int retval = 0;
-	do {
-		if (readb(io_addr) != *signature)
-			goto out;
-		io_addr++;
-		signature++;
-		length--;
-	} while (length);
-	retval = 1;
-out:
-	return retval;
-}
-
 /*
  * The caches on some architectures aren't dma-coherent and have need to
  * handle this in software.  There are three types of operations that
include/asm-sparc64/io.h +0 -15
index 0056770..30b912d 100644
@@ -440,21 +440,6 @@ _memcpy_toio(volatile void __iomem *dst,
 
 #define memcpy_toio(d,s,sz)	_memcpy_toio(d,s,sz)
 
-static inline int check_signature(void __iomem *io_addr,
-				  const unsigned char *signature,
-				  int length)
-{
-	int retval = 0;
-	do {
-		if (readb(io_addr) != *signature++)
-			goto out;
-		io_addr++;
-	} while (--length);
-	retval = 1;
-out:
-	return retval;
-}
-
 #define mmiowb()
 
 #ifdef __KERNEL__
include/asm-x86_64/io.h +0 -27
index 70e91fe..6ee9fad 100644
@@ -254,33 +254,6 @@ #define __ISA_IO_base ((char __iomem *)(
 
 #define eth_io_copy_and_sum(a,b,c,d)		eth_copy_and_sum((a),(void *)(b),(c),(d))
 
-/**
- *	check_signature		-	find BIOS signatures
- *	@io_addr: mmio address to check 
- *	@signature:  signature block
- *	@length: length of signature
- *
- *	Perform a signature comparison with the mmio address io_addr. This
- *	address should have been obtained by ioremap.
- *	Returns 1 on a match.
- */
- 
-static inline int check_signature(void __iomem *io_addr,
-	const unsigned char *signature, int length)
-{
-	int retval = 0;
-	do {
-		if (readb(io_addr) != *signature)
-			goto out;
-		io_addr++;
-		signature++;
-		length--;
-	} while (length);
-	retval = 1;
-out:
-	return retval;
-}
-
 /* Nothing to do */
 
 #define dma_cache_inv(_start,_size)		do { } while (0)
include/linux/io.h +27 -0
index aa3f5af..8194375 100644
@@ -27,4 +27,31 @@ void __iowrite64_copy(void __iomem *to, 
 int ioremap_page_range(unsigned long addr, unsigned long end,
 		       unsigned long phys_addr, pgprot_t prot);
 
+/**
+ *	check_signature		-	find BIOS signatures
+ *	@io_addr: mmio address to check 
+ *	@signature:  signature block
+ *	@length: length of signature
+ *
+ *	Perform a signature comparison with the mmio address io_addr. This
+ *	address should have been obtained by ioremap.
+ *	Returns 1 on a match.
+ */
+ 
+static inline int check_signature(const volatile void __iomem *io_addr,
+	const unsigned char *signature, int length)
+{
+	int retval = 0;
+	do {
+		if (readb(io_addr) != *signature)
+			goto out;
+		io_addr++;
+		signature++;
+		length--;
+	} while (length);
+	retval = 1;
+out:
+	return retval;
+}
+
 #endif /* _LINUX_IO_H */
Signature · 1 line
1.4.1.1
#2 lore raw

Re: [PATCH] Consolidate check_signature

Quoted 5 lines · Matthew Wilcox

There's nothing arch-specific about check_signature(), so move it to <linux/io.h>. Use a cross between the Alpha and i386 implementations as the generic one.

IMO this isn't 2.6.19-rc1 material.

Much more appropriate for 2.6.20, after living in -mm for a while.

Jeff

#4 lore raw

Re: [PATCH] Consolidate check_signature

In reply to Matthew Wilcox
Quoted 3 lines · On Thu, 05 Oct 2006 11:05:55 -0600 Matthew Wilcox <[email protected]> wrote:

There's nothing arch-specific about check_signature(), so move it to <linux/io.h>. Use a cross between the Alpha and i386 implementations as the generic one.

It wuld have been nice to have uninlined it too. And to have given it a less crappy name.

#5 lore raw

Re: [PATCH] Consolidate check_signature

Quoted 9 lines · Andrew Morton
Quoted 3 lines · On Thu, 05 Oct 2006 11:05:55 -0600 Matthew Wilcox <[email protected]> wrote:

There's nothing arch-specific about check_signature(), so move it to <linux/io.h>. Use a cross between the Alpha and i386 implementations as the generic one.

It wuld have been nice to have uninlined it too. And to have given it a less crappy name.

memcmp_withio(), to follow the general style?

#7 lore raw
Quoted 5 lines · Jeff Garzik
Quoted 2 lines · Matthew Wilcox

In preparation for moving check_signature, change these users from asm/io.h to linux/io.h

The vast majority of drivers include asm/io.h.

Yes. linux/io.h was only created recently. It's proper style to include linux/foo.h when both linux/foo.h and asm/foo.h exist [1] This is just a transition which hasn't been completed yet (indeed, has barely begun).

Quoted 2 lines

Wouldn't it be better to move check_signature to include/asm-generic/io.h, and include that where needed?

I really don't think that proliferating header files unnecessarily is a good idea.

[1] Except, of course, <linux/irq.h>, but I thought rmk was going to fix that.