Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e50190a8 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Linus Torvalds
Browse files

[PATCH] 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.

Signed-off-by: default avatarMatthew Wilcox <willy@parisc-linux.org>
Acked-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 53d5ed62
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -533,19 +533,6 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);
#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
+0 −17
Original line number Diff line number Diff line
@@ -193,23 +193,6 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
#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)
+0 −21
Original line number Diff line number Diff line
@@ -385,27 +385,6 @@ static inline void pci_iounmap(struct pci_dev *dev, void __iomem *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 */
+0 −27
Original line number Diff line number Diff line
@@ -224,33 +224,6 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int

#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
 *
+0 −32
Original line number Diff line number Diff line
@@ -166,38 +166,6 @@ static inline void _writel(unsigned long l, unsigned long addr)

#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)
{
Loading