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