aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2011-05-26 19:26:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-26 20:12:38 -0400
commit19de85ef574c3a2182e3ccad9581805052f14946 (patch)
tree98212bc122ac55807e562fd1ae6d0c5f0f2564d0 /lib
parenta2812e178321132811a53f7be40fe7e9bbffd9e0 (diff)
bitops: add #ifndef for each of find bitops
The style that we normally use in asm-generic is to test the macro itself for existence, so in asm-generic, do: #ifndef find_next_zero_bit_le extern unsigned long find_next_zero_bit_le(const void *addr, unsigned long size, unsigned long offset); #endif and in the architectures, write static inline unsigned long find_next_zero_bit_le(const void *addr, unsigned long size, unsigned long offset) #define find_next_zero_bit_le find_next_zero_bit_le This adds the #ifndef for each of the find bitops in the generic header and source files. Suggested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Greg Ungerer <gerg@uclinux.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/find_last_bit.c4
-rw-r--r--lib/find_next_bit.c12
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/find_last_bit.c b/lib/find_last_bit.c
index 5d202e36bdd8..d903959ad695 100644
--- a/lib/find_last_bit.c
+++ b/lib/find_last_bit.c
@@ -15,6 +15,8 @@
15#include <asm/types.h> 15#include <asm/types.h>
16#include <asm/byteorder.h> 16#include <asm/byteorder.h>
17 17
18#ifndef find_last_bit
19
18unsigned long find_last_bit(const unsigned long *addr, unsigned long size) 20unsigned long find_last_bit(const unsigned long *addr, unsigned long size)
19{ 21{
20 unsigned long words; 22 unsigned long words;
@@ -43,3 +45,5 @@ found:
43 return size; 45 return size;
44} 46}
45EXPORT_SYMBOL(find_last_bit); 47EXPORT_SYMBOL(find_last_bit);
48
49#endif
diff --git a/lib/find_next_bit.c b/lib/find_next_bit.c
index b0a8767282bf..c02d09f37d58 100644
--- a/lib/find_next_bit.c
+++ b/lib/find_next_bit.c
@@ -17,6 +17,7 @@
17#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG) 17#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
18 18
19#ifdef CONFIG_GENERIC_FIND_NEXT_BIT 19#ifdef CONFIG_GENERIC_FIND_NEXT_BIT
20#ifndef find_next_bit
20/* 21/*
21 * Find the next set bit in a memory region. 22 * Find the next set bit in a memory region.
22 */ 23 */
@@ -59,7 +60,9 @@ found_middle:
59 return result + __ffs(tmp); 60 return result + __ffs(tmp);
60} 61}
61EXPORT_SYMBOL(find_next_bit); 62EXPORT_SYMBOL(find_next_bit);
63#endif
62 64
65#ifndef find_next_zero_bit
63/* 66/*
64 * This implementation of find_{first,next}_zero_bit was stolen from 67 * This implementation of find_{first,next}_zero_bit was stolen from
65 * Linus' asm-alpha/bitops.h. 68 * Linus' asm-alpha/bitops.h.
@@ -103,9 +106,11 @@ found_middle:
103 return result + ffz(tmp); 106 return result + ffz(tmp);
104} 107}
105EXPORT_SYMBOL(find_next_zero_bit); 108EXPORT_SYMBOL(find_next_zero_bit);
109#endif
106#endif /* CONFIG_GENERIC_FIND_NEXT_BIT */ 110#endif /* CONFIG_GENERIC_FIND_NEXT_BIT */
107 111
108#ifdef CONFIG_GENERIC_FIND_FIRST_BIT 112#ifdef CONFIG_GENERIC_FIND_FIRST_BIT
113#ifndef find_first_bit
109/* 114/*
110 * Find the first set bit in a memory region. 115 * Find the first set bit in a memory region.
111 */ 116 */
@@ -131,7 +136,9 @@ found:
131 return result + __ffs(tmp); 136 return result + __ffs(tmp);
132} 137}
133EXPORT_SYMBOL(find_first_bit); 138EXPORT_SYMBOL(find_first_bit);
139#endif
134 140
141#ifndef find_first_zero_bit
135/* 142/*
136 * Find the first cleared bit in a memory region. 143 * Find the first cleared bit in a memory region.
137 */ 144 */
@@ -157,6 +164,7 @@ found:
157 return result + ffz(tmp); 164 return result + ffz(tmp);
158} 165}
159EXPORT_SYMBOL(find_first_zero_bit); 166EXPORT_SYMBOL(find_first_zero_bit);
167#endif
160#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ 168#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */
161 169
162#ifdef __BIG_ENDIAN 170#ifdef __BIG_ENDIAN
@@ -186,6 +194,7 @@ static inline unsigned long ext2_swab(const unsigned long y)
186#endif 194#endif
187} 195}
188 196
197#ifndef find_next_zero_bit_le
189unsigned long find_next_zero_bit_le(const void *addr, unsigned 198unsigned long find_next_zero_bit_le(const void *addr, unsigned
190 long size, unsigned long offset) 199 long size, unsigned long offset)
191{ 200{
@@ -229,7 +238,9 @@ found_middle_swap:
229 return result + ffz(ext2_swab(tmp)); 238 return result + ffz(ext2_swab(tmp));
230} 239}
231EXPORT_SYMBOL(find_next_zero_bit_le); 240EXPORT_SYMBOL(find_next_zero_bit_le);
241#endif
232 242
243#ifndef find_next_bit_le
233unsigned long find_next_bit_le(const void *addr, unsigned 244unsigned long find_next_bit_le(const void *addr, unsigned
234 long size, unsigned long offset) 245 long size, unsigned long offset)
235{ 246{
@@ -274,6 +285,7 @@ found_middle_swap:
274 return result + __ffs(ext2_swab(tmp)); 285 return result + __ffs(ext2_swab(tmp));
275} 286}
276EXPORT_SYMBOL(find_next_bit_le); 287EXPORT_SYMBOL(find_next_bit_le);
288#endif
277 289
278#endif /* CONFIG_GENERIC_FIND_BIT_LE */ 290#endif /* CONFIG_GENERIC_FIND_BIT_LE */
279#endif /* __BIG_ENDIAN */ 291#endif /* __BIG_ENDIAN */