Commit e50190a8341485b413f599033cb74649f849d939

Authored by Matthew Wilcox
Committed by Linus Torvalds
1 parent 53d5ed627d

[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: Matthew Wilcox <willy@parisc-linux.org>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 13 changed files with 27 additions and 252 deletions Side-by-side Diff

include/asm-alpha/io.h
... ... @@ -533,19 +533,6 @@
533 533 #define eth_io_copy_and_sum(skb,src,len,unused) \
534 534 memcpy_fromio((skb)->data,src,len)
535 535  
536   -static inline int
537   -check_signature(const volatile void __iomem *io_addr,
538   - const unsigned char *signature, int length)
539   -{
540   - do {
541   - if (readb(io_addr) != *signature)
542   - return 0;
543   - io_addr++;
544   - signature++;
545   - } while (--length);
546   - return 1;
547   -}
548   -
549 536 /*
550 537 * The Alpha Jensen hardware for some rather strange reason puts
551 538 * the RTC clock at 0x170 instead of 0x70. Probably due to some
include/asm-arm/io.h
... ... @@ -193,23 +193,6 @@
193 193 #define eth_io_copy_and_sum(s,c,l,b) \
194 194 eth_copy_and_sum((s),__mem_pci(c),(l),(b))
195 195  
196   -static inline int
197   -check_signature(void __iomem *io_addr, const unsigned char *signature,
198   - int length)
199   -{
200   - int retval = 0;
201   - do {
202   - if (readb(io_addr) != *signature)
203   - goto out;
204   - io_addr++;
205   - signature++;
206   - length--;
207   - } while (length);
208   - retval = 1;
209   -out:
210   - return retval;
211   -}
212   -
213 196 #elif !defined(readb)
214 197  
215 198 #define readb(c) (__readwrite_bug("readb"),0)
include/asm-frv/io.h
... ... @@ -385,27 +385,6 @@
385 385 */
386 386 #define xlate_dev_kmem_ptr(p) p
387 387  
388   -/*
389   - * Check BIOS signature
390   - */
391   -static inline int check_signature(volatile void __iomem *io_addr,
392   - const unsigned char *signature, int length)
393   -{
394   - int retval = 0;
395   -
396   - do {
397   - if (readb(io_addr) != *signature)
398   - goto out;
399   - io_addr++;
400   - signature++;
401   - length--;
402   - } while (length);
403   -
404   - retval = 1;
405   -out:
406   - return retval;
407   -}
408   -
409 388 #endif /* __KERNEL__ */
410 389  
411 390 #endif /* _ASM_IO_H */
include/asm-i386/io.h
... ... @@ -224,33 +224,6 @@
224 224  
225 225 #define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void __force *)(b),(c),(d))
226 226  
227   -/**
228   - * check_signature - find BIOS signatures
229   - * @io_addr: mmio address to check
230   - * @signature: signature block
231   - * @length: length of signature
232   - *
233   - * Perform a signature comparison with the mmio address io_addr. This
234   - * address should have been obtained by ioremap.
235   - * Returns 1 on a match.
236   - */
237   -
238   -static inline int check_signature(volatile void __iomem * io_addr,
239   - const unsigned char *signature, int length)
240   -{
241   - int retval = 0;
242   - do {
243   - if (readb(io_addr) != *signature)
244   - goto out;
245   - io_addr++;
246   - signature++;
247   - length--;
248   - } while (length);
249   - retval = 1;
250   -out:
251   - return retval;
252   -}
253   -
254 227 /*
255 228 * Cache management
256 229 *
include/asm-m32r/io.h
... ... @@ -166,38 +166,6 @@
166 166  
167 167 #define flush_write_buffers() do { } while (0) /* M32R_FIXME */
168 168  
169   -/**
170   - * check_signature - find BIOS signatures
171   - * @io_addr: mmio address to check
172   - * @signature: signature block
173   - * @length: length of signature
174   - *
175   - * Perform a signature comparison with the ISA mmio address io_addr.
176   - * Returns 1 on a match.
177   - *
178   - * This function is deprecated. New drivers should use ioremap and
179   - * check_signature.
180   - */
181   -
182   -static inline int check_signature(void __iomem *io_addr,
183   - const unsigned char *signature, int length)
184   -{
185   - int retval = 0;
186   -#if 0
187   -printk("check_signature\n");
188   - do {
189   - if (readb(io_addr) != *signature)
190   - goto out;
191   - io_addr++;
192   - signature++;
193   - length--;
194   - } while (length);
195   - retval = 1;
196   -out:
197   -#endif
198   - return retval;
199   -}
200   -
201 169 static inline void
202 170 memset_io(volatile void __iomem *addr, unsigned char val, int count)
203 171 {
include/asm-mips/io.h
... ... @@ -562,32 +562,6 @@
562 562 #define eth_io_copy_and_sum(skb,src,len,unused) memcpy_fromio((skb)->data,(src),(len))
563 563  
564 564 /*
565   - * check_signature - find BIOS signatures
566   - * @io_addr: mmio address to check
567   - * @signature: signature block
568   - * @length: length of signature
569   - *
570   - * Perform a signature comparison with the mmio address io_addr. This
571   - * address should have been obtained by ioremap.
572   - * Returns 1 on a match.
573   - */
574   -static inline int check_signature(char __iomem *io_addr,
575   - const unsigned char *signature, int length)
576   -{
577   - int retval = 0;
578   - do {
579   - if (readb(io_addr) != *signature)
580   - goto out;
581   - io_addr++;
582   - signature++;
583   - length--;
584   - } while (length);
585   - retval = 1;
586   -out:
587   - return retval;
588   -}
589   -
590   -/*
591 565 * The caches on some architectures aren't dma-coherent and have need to
592 566 * handle this in software. There are three types of operations that
593 567 * can be applied to dma buffers.
include/asm-powerpc/io.h
... ... @@ -404,32 +404,6 @@
404 404  
405 405 #include <asm/eeh.h>
406 406  
407   -/**
408   - * check_signature - find BIOS signatures
409   - * @io_addr: mmio address to check
410   - * @signature: signature block
411   - * @length: length of signature
412   - *
413   - * Perform a signature comparison with the mmio address io_addr. This
414   - * address should have been obtained by ioremap.
415   - * Returns 1 on a match.
416   - */
417   -static inline int check_signature(const volatile void __iomem * io_addr,
418   - const unsigned char *signature, int length)
419   -{
420   - int retval = 0;
421   - do {
422   - if (readb(io_addr) != *signature)
423   - goto out;
424   - io_addr++;
425   - signature++;
426   - length--;
427   - } while (length);
428   - retval = 1;
429   -out:
430   - return retval;
431   -}
432   -
433 407 /* Nothing to do */
434 408  
435 409 #define dma_cache_inv(_start,_size) do { } while (0)
include/asm-ppc/io.h
... ... @@ -439,22 +439,6 @@
439 439 #define iobarrier_r() eieio()
440 440 #define iobarrier_w() eieio()
441 441  
442   -static inline int check_signature(volatile void __iomem * io_addr,
443   - const unsigned char *signature, int length)
444   -{
445   - int retval = 0;
446   - do {
447   - if (readb(io_addr) != *signature)
448   - goto out;
449   - io_addr++;
450   - signature++;
451   - length--;
452   - } while (length);
453   - retval = 1;
454   -out:
455   - return retval;
456   -}
457   -
458 442 /*
459 443 * Here comes the ppc implementation of the IOMAP
460 444 * interfaces.
... ... @@ -304,22 +304,6 @@
304 304 #define iounmap(addr) \
305 305 __iounmap((addr))
306 306  
307   -static inline int check_signature(char __iomem *io_addr,
308   - const unsigned char *signature, int length)
309   -{
310   - int retval = 0;
311   - do {
312   - if (readb(io_addr) != *signature)
313   - goto out;
314   - io_addr++;
315   - signature++;
316   - length--;
317   - } while (length);
318   - retval = 1;
319   -out:
320   - return retval;
321   -}
322   -
323 307 /*
324 308 * The caches on some architectures aren't dma-coherent and have need to
325 309 * handle this in software. There are three types of operations that
include/asm-sh64/io.h
... ... @@ -178,22 +178,6 @@
178 178 unsigned long onchip_remap(unsigned long addr, unsigned long size, const char* name);
179 179 extern void onchip_unmap(unsigned long vaddr);
180 180  
181   -static __inline__ int check_signature(volatile void __iomem *io_addr,
182   - const unsigned char *signature, int length)
183   -{
184   - int retval = 0;
185   - do {
186   - if (readb(io_addr) != *signature)
187   - goto out;
188   - io_addr++;
189   - signature++;
190   - length--;
191   - } while (length);
192   - retval = 1;
193   -out:
194   - return retval;
195   -}
196   -
197 181 /*
198 182 * The caches on some architectures aren't dma-coherent and have need to
199 183 * handle this in software. There are three types of operations that
include/asm-sparc64/io.h
... ... @@ -440,21 +440,6 @@
440 440  
441 441 #define memcpy_toio(d,s,sz) _memcpy_toio(d,s,sz)
442 442  
443   -static inline int check_signature(void __iomem *io_addr,
444   - const unsigned char *signature,
445   - int length)
446   -{
447   - int retval = 0;
448   - do {
449   - if (readb(io_addr) != *signature++)
450   - goto out;
451   - io_addr++;
452   - } while (--length);
453   - retval = 1;
454   -out:
455   - return retval;
456   -}
457   -
458 443 #define mmiowb()
459 444  
460 445 #ifdef __KERNEL__
include/asm-x86_64/io.h
... ... @@ -254,33 +254,6 @@
254 254  
255 255 #define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void *)(b),(c),(d))
256 256  
257   -/**
258   - * check_signature - find BIOS signatures
259   - * @io_addr: mmio address to check
260   - * @signature: signature block
261   - * @length: length of signature
262   - *
263   - * Perform a signature comparison with the mmio address io_addr. This
264   - * address should have been obtained by ioremap.
265   - * Returns 1 on a match.
266   - */
267   -
268   -static inline int check_signature(void __iomem *io_addr,
269   - const unsigned char *signature, int length)
270   -{
271   - int retval = 0;
272   - do {
273   - if (readb(io_addr) != *signature)
274   - goto out;
275   - io_addr++;
276   - signature++;
277   - length--;
278   - } while (length);
279   - retval = 1;
280   -out:
281   - return retval;
282   -}
283   -
284 257 /* Nothing to do */
285 258  
286 259 #define dma_cache_inv(_start,_size) do { } while (0)
... ... @@ -28,5 +28,32 @@
28 28 int ioremap_page_range(unsigned long addr, unsigned long end,
29 29 unsigned long phys_addr, pgprot_t prot);
30 30  
  31 +/**
  32 + * check_signature - find BIOS signatures
  33 + * @io_addr: mmio address to check
  34 + * @signature: signature block
  35 + * @length: length of signature
  36 + *
  37 + * Perform a signature comparison with the mmio address io_addr. This
  38 + * address should have been obtained by ioremap.
  39 + * Returns 1 on a match.
  40 + */
  41 +
  42 +static inline int check_signature(const volatile void __iomem *io_addr,
  43 + const unsigned char *signature, int length)
  44 +{
  45 + int retval = 0;
  46 + do {
  47 + if (readb(io_addr) != *signature)
  48 + goto out;
  49 + io_addr++;
  50 + signature++;
  51 + length--;
  52 + } while (length);
  53 + retval = 1;
  54 +out:
  55 + return retval;
  56 +}
  57 +
31 58 #endif /* _LINUX_IO_H */