^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef _TOOLS_LINUX_ASM_GENERIC_BITOPS_FIND_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define _TOOLS_LINUX_ASM_GENERIC_BITOPS_FIND_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #ifndef find_next_bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * find_next_bit - find the next set bit in a memory region
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * @addr: The address to base the search on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * @offset: The bitnumber to start searching at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * @size: The bitmap size in bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * Returns the bit number for the next set bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * If no bits are set, returns @size.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) extern unsigned long find_next_bit(const unsigned long *addr, unsigned long
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) size, unsigned long offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #ifndef find_next_and_bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * find_next_and_bit - find the next set bit in both memory regions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * @addr1: The first address to base the search on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * @addr2: The second address to base the search on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * @offset: The bitnumber to start searching at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * @size: The bitmap size in bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * Returns the bit number for the next set bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * If no bits are set, returns @size.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) extern unsigned long find_next_and_bit(const unsigned long *addr1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) const unsigned long *addr2, unsigned long size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) unsigned long offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #ifndef find_next_zero_bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * find_next_zero_bit - find the next cleared bit in a memory region
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * @addr: The address to base the search on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * @offset: The bitnumber to start searching at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * @size: The bitmap size in bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * Returns the bit number of the next zero bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) * If no bits are zero, returns @size.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) unsigned long offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #ifndef find_first_bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) * find_first_bit - find the first set bit in a memory region
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) * @addr: The address to start the search at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) * @size: The maximum number of bits to search
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) * Returns the bit number of the first set bit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * If no bits are set, returns @size.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) extern unsigned long find_first_bit(const unsigned long *addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) unsigned long size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #endif /* find_first_bit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #ifndef find_first_zero_bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) * find_first_zero_bit - find the first cleared bit in a memory region
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) * @addr: The address to start the search at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) * @size: The maximum number of bits to search
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) * Returns the bit number of the first cleared bit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * If no bits are zero, returns @size.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) #endif /*_TOOLS_LINUX_ASM_GENERIC_BITOPS_FIND_H_ */