FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bitops: add #ifndef for each of find bitops · fabgithub/linux@19de85e · GitHub

Repository navigation

Commit 19de85e

Browse files
authored andcommitted
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>
1 parent a2812e1 commit 19de85e

5 files changed

Lines changed: 29 additions & 0 deletions

File tree

‎include/asm-generic/bitops/find.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef _ASM_GENERIC_BITOPS_FIND_H_
22
#define _ASM_GENERIC_BITOPS_FIND_H_
33

4+
#ifndef find_next_bit
45
/**
56
* find_next_bit - find the next set bit in a memory region
67
* @addr: The address to base the search on
@@ -9,7 +10,9 @@
910
*/
1011
extern unsigned long find_next_bit(const unsigned long *addr, unsigned long
1112
size, unsigned long offset);
13+
#endif
1214

15+
#ifndef find_next_zero_bit
1316
/**
1417
* find_next_zero_bit - find the next cleared bit in a memory region
1518
* @addr: The address to base the search on
@@ -18,6 +21,7 @@ extern unsigned long find_next_bit(const unsigned long *addr, unsigned long
1821
*/
1922
extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned
2023
long size, unsigned long offset);
24+
#endif
2125

2226
#ifdef CONFIG_GENERIC_FIND_FIRST_BIT
2327

‎include/asm-generic/bitops/le.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,20 @@ static inline unsigned long find_first_zero_bit_le(const void *addr,
3030

3131
#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
3232

33+
#ifndef find_next_zero_bit_le
3334
extern unsigned long find_next_zero_bit_le(const void *addr,
3435
unsigned long size, unsigned long offset);
36+
#endif
37+
38+
#ifndef find_next_bit_le
3539
extern unsigned long find_next_bit_le(const void *addr,
3640
unsigned long size, unsigned long offset);
41+
#endif
3742

43+
#ifndef find_first_zero_bit_le
3844
#define find_first_zero_bit_le(addr, size) \
3945
find_next_zero_bit_le((addr), (size), 0)
46+
#endif
4047

4148
#else
4249
#error "Please fix <asm/byteorder.h>"

‎include/linux/bitops.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ static inline unsigned long __ffs64(u64 word)
149149
#ifdef __KERNEL__
150150

151151
#ifdef CONFIG_GENERIC_FIND_LAST_BIT
152+
#ifndef find_last_bit
152153
/**
153154
* find_last_bit - find the last set bit in a memory region
154155
* @addr: The address to start the search at
@@ -158,6 +159,7 @@ static inline unsigned long __ffs64(u64 word)
158159
*/
159160
extern unsigned long find_last_bit(const unsigned long *addr,
160161
unsigned long size);
162+
#endif
161163
#endif /* CONFIG_GENERIC_FIND_LAST_BIT */
162164

163165
#endif /* __KERNEL__ */

‎lib/find_last_bit.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include <asm/types.h>
1616
#include <asm/byteorder.h>
1717

18+
#ifndef find_last_bit
19+
1820
unsigned long find_last_bit(const unsigned long *addr, unsigned long size)
1921
{
2022
unsigned long words;
@@ -43,3 +45,5 @@ unsigned long find_last_bit(const unsigned long *addr, unsigned long size)
4345
return size;
4446
}
4547
EXPORT_SYMBOL(find_last_bit);
48+
49+
#endif

‎lib/find_next_bit.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
1818

1919
#ifdef CONFIG_GENERIC_FIND_NEXT_BIT
20+
#ifndef find_next_bit
2021
/*
2122
* Find the next set bit in a memory region.
2223
*/
@@ -59,7 +60,9 @@ unsigned long find_next_bit(const unsigned long *addr, unsigned long size,
5960
return result + __ffs(tmp);
6061
}
6162
EXPORT_SYMBOL(find_next_bit);
63+
#endif
6264

65+
#ifndef find_next_zero_bit
6366
/*
6467
* This implementation of find_{first,next}_zero_bit was stolen from
6568
* Linus' asm-alpha/bitops.h.
@@ -103,9 +106,11 @@ unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
103106
return result + ffz(tmp);
104107
}
105108
EXPORT_SYMBOL(find_next_zero_bit);
109+
#endif
106110
#endif /* CONFIG_GENERIC_FIND_NEXT_BIT */
107111

108112
#ifdef CONFIG_GENERIC_FIND_FIRST_BIT
113+
#ifndef find_first_bit
109114
/*
110115
* Find the first set bit in a memory region.
111116
*/
@@ -131,7 +136,9 @@ unsigned long find_first_bit(const unsigned long *addr, unsigned long size)
131136
return result + __ffs(tmp);
132137
}
133138
EXPORT_SYMBOL(find_first_bit);
139+
#endif
134140

141+
#ifndef find_first_zero_bit
135142
/*
136143
* Find the first cleared bit in a memory region.
137144
*/
@@ -157,6 +164,7 @@ unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size)
157164
return result + ffz(tmp);
158165
}
159166
EXPORT_SYMBOL(find_first_zero_bit);
167+
#endif
160168
#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */
161169

162170
#ifdef __BIG_ENDIAN
@@ -186,6 +194,7 @@ static inline unsigned long ext2_swab(const unsigned long y)
186194
#endif
187195
}
188196

197+
#ifndef find_next_zero_bit_le
189198
unsigned long find_next_zero_bit_le(const void *addr, unsigned
190199
long size, unsigned long offset)
191200
{
@@ -229,7 +238,9 @@ unsigned long find_next_zero_bit_le(const void *addr, unsigned
229238
return result + ffz(ext2_swab(tmp));
230239
}
231240
EXPORT_SYMBOL(find_next_zero_bit_le);
241+
#endif
232242

243+
#ifndef find_next_bit_le
233244
unsigned long find_next_bit_le(const void *addr, unsigned
234245
long size, unsigned long offset)
235246
{
@@ -274,6 +285,7 @@ unsigned long find_next_bit_le(const void *addr, unsigned
274285
return result + __ffs(ext2_swab(tmp));
275286
}
276287
EXPORT_SYMBOL(find_next_bit_le);
288+
#endif
277289

278290
#endif /* CONFIG_GENERIC_FIND_BIT_LE */
279291
#endif /* __BIG_ENDIAN */

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL