aboutsummaryrefslogtreecommitdiffstats
path: root/lib/find_next_bit.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/find_next_bit.c')
-rw-r--r--lib/find_next_bit.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/find_next_bit.c b/lib/find_next_bit.c
index b0a8767282bf..4bd75a73ba00 100644
--- a/lib/find_next_bit.c
+++ b/lib/find_next_bit.c
@@ -16,7 +16,7 @@
16 16
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#ifndef find_next_bit
20/* 20/*
21 * Find the next set bit in a memory region. 21 * Find the next set bit in a memory region.
22 */ 22 */
@@ -59,7 +59,9 @@ found_middle:
59 return result + __ffs(tmp); 59 return result + __ffs(tmp);
60} 60}
61EXPORT_SYMBOL(find_next_bit); 61EXPORT_SYMBOL(find_next_bit);
62#endif
62 63
64#ifndef find_next_zero_bit
63/* 65/*
64 * This implementation of find_{first,next}_zero_bit was stolen from 66 * This implementation of find_{first,next}_zero_bit was stolen from
65 * Linus' asm-alpha/bitops.h. 67 * Linus' asm-alpha/bitops.h.
@@ -103,9 +105,9 @@ found_middle:
103 return result + ffz(tmp); 105 return result + ffz(tmp);
104} 106}
105EXPORT_SYMBOL(find_next_zero_bit); 107EXPORT_SYMBOL(find_next_zero_bit);
106#endif /* CONFIG_GENERIC_FIND_NEXT_BIT */ 108#endif
107 109
108#ifdef CONFIG_GENERIC_FIND_FIRST_BIT 110#ifndef find_first_bit
109/* 111/*
110 * Find the first set bit in a memory region. 112 * Find the first set bit in a memory region.
111 */ 113 */
@@ -131,7 +133,9 @@ found:
131 return result + __ffs(tmp); 133 return result + __ffs(tmp);
132} 134}
133EXPORT_SYMBOL(find_first_bit); 135EXPORT_SYMBOL(find_first_bit);
136#endif
134 137
138#ifndef find_first_zero_bit
135/* 139/*
136 * Find the first cleared bit in a memory region. 140 * Find the first cleared bit in a memory region.
137 */ 141 */
@@ -157,10 +161,9 @@ found:
157 return result + ffz(tmp); 161 return result + ffz(tmp);
158} 162}
159EXPORT_SYMBOL(find_first_zero_bit); 163EXPORT_SYMBOL(find_first_zero_bit);
160#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ 164#endif
161 165
162#ifdef __BIG_ENDIAN 166#ifdef __BIG_ENDIAN
163#ifdef CONFIG_GENERIC_FIND_BIT_LE
164 167
165/* include/linux/byteorder does not support "unsigned long" type */ 168/* include/linux/byteorder does not support "unsigned long" type */
166static inline unsigned long ext2_swabp(const unsigned long * x) 169static inline unsigned long ext2_swabp(const unsigned long * x)
@@ -186,6 +189,7 @@ static inline unsigned long ext2_swab(const unsigned long y)
186#endif 189#endif
187} 190}
188 191
192#ifndef find_next_zero_bit_le
189unsigned long find_next_zero_bit_le(const void *addr, unsigned 193unsigned long find_next_zero_bit_le(const void *addr, unsigned
190 long size, unsigned long offset) 194 long size, unsigned long offset)
191{ 195{
@@ -229,7 +233,9 @@ found_middle_swap:
229 return result + ffz(ext2_swab(tmp)); 233 return result + ffz(ext2_swab(tmp));
230} 234}
231EXPORT_SYMBOL(find_next_zero_bit_le); 235EXPORT_SYMBOL(find_next_zero_bit_le);
236#endif
232 237
238#ifndef find_next_bit_le
233unsigned long find_next_bit_le(const void *addr, unsigned 239unsigned long find_next_bit_le(const void *addr, unsigned
234 long size, unsigned long offset) 240 long size, unsigned long offset)
235{ 241{
@@ -274,6 +280,6 @@ found_middle_swap:
274 return result + __ffs(ext2_swab(tmp)); 280 return result + __ffs(ext2_swab(tmp));
275} 281}
276EXPORT_SYMBOL(find_next_bit_le); 282EXPORT_SYMBOL(find_next_bit_le);
283#endif
277 284
278#endif /* CONFIG_GENERIC_FIND_BIT_LE */
279#endif /* __BIG_ENDIAN */ 285#endif /* __BIG_ENDIAN */