• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _ASM_GENERIC_BITOPS_FIND_H_
2 #define _ASM_GENERIC_BITOPS_FIND_H_
3 
4 #ifndef find_next_bit
5 /**
6  * find_next_bit - find the next set bit in a memory region
7  * @addr: The address to base the search on
8  * @offset: The bitnumber to start searching at
9  * @size: The bitmap size in bits
10  *
11  * Returns the bit number for the next set bit
12  * If no bits are set, returns @size.
13  */
14 extern unsigned long find_next_bit(const unsigned long *addr, unsigned long
15 		size, unsigned long offset);
16 #endif
17 
18 #ifndef find_next_zero_bit
19 /**
20  * find_next_zero_bit - find the next cleared bit in a memory region
21  * @addr: The address to base the search on
22  * @offset: The bitnumber to start searching at
23  * @size: The bitmap size in bits
24  *
25  * Returns the bit number of the next zero bit
26  * If no bits are zero, returns @size.
27  */
28 extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned
29 		long size, unsigned long offset);
30 #endif
31 
32 #ifdef CONFIG_GENERIC_FIND_FIRST_BIT
33 
34 /**
35  * find_first_bit - find the first set bit in a memory region
36  * @addr: The address to start the search at
37  * @size: The maximum number of bits to search
38  *
39  * Returns the bit number of the first set bit.
40  * If no bits are set, returns @size.
41  */
42 extern unsigned long find_first_bit(const unsigned long *addr,
43 				    unsigned long size);
44 
45 /**
46  * find_first_zero_bit - find the first cleared bit in a memory region
47  * @addr: The address to start the search at
48  * @size: The maximum number of bits to search
49  *
50  * Returns the bit number of the first cleared bit.
51  * If no bits are zero, returns @size.
52  */
53 extern unsigned long find_first_zero_bit(const unsigned long *addr,
54 					 unsigned long size);
55 #else /* CONFIG_GENERIC_FIND_FIRST_BIT */
56 
57 #define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
58 #define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
59 
60 #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */
61 
62 #endif /*_ASM_GENERIC_BITOPS_FIND_H_ */
63