blob: 998d4d544f182ee305ae779ec0bf5e4f8f2ef43e [file] [log] [blame]
Akinobu Mitac7f612c2006-03-26 01:39:11 -08001#ifndef _ASM_GENERIC_BITOPS_FIND_H_
2#define _ASM_GENERIC_BITOPS_FIND_H_
3
Akinobu Mita19de85e2011-05-26 16:26:09 -07004#ifndef find_next_bit
Akinobu Mitad852a6a2010-09-29 18:08:51 +09005/**
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
Cody P Schaferec778ed2013-11-12 15:09:48 -080010 *
11 * Returns the bit number for the next set bit
12 * If no bits are set, returns @size.
Akinobu Mitad852a6a2010-09-29 18:08:51 +090013 */
Akinobu Mitac7f612c2006-03-26 01:39:11 -080014extern unsigned long find_next_bit(const unsigned long *addr, unsigned long
15 size, unsigned long offset);
Akinobu Mita19de85e2011-05-26 16:26:09 -070016#endif
Akinobu Mitac7f612c2006-03-26 01:39:11 -080017
Akinobu Mita19de85e2011-05-26 16:26:09 -070018#ifndef find_next_zero_bit
Akinobu Mitad852a6a2010-09-29 18:08:51 +090019/**
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
Cody P Schaferec778ed2013-11-12 15:09:48 -080024 *
25 * Returns the bit number of the next zero bit
26 * If no bits are zero, returns @size.
Akinobu Mitad852a6a2010-09-29 18:08:51 +090027 */
Akinobu Mitac7f612c2006-03-26 01:39:11 -080028extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned
29 long size, unsigned long offset);
Akinobu Mita19de85e2011-05-26 16:26:09 -070030#endif
Akinobu Mitac7f612c2006-03-26 01:39:11 -080031
Akinobu Mita708ff2a2010-09-29 18:08:50 +090032#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
Cody P Schaferec778ed2013-11-12 15:09:48 -080037 * @size: The maximum number of bits to search
Akinobu Mita708ff2a2010-09-29 18:08:50 +090038 *
39 * Returns the bit number of the first set bit.
Cody P Schaferec778ed2013-11-12 15:09:48 -080040 * If no bits are set, returns @size.
Akinobu Mita708ff2a2010-09-29 18:08:50 +090041 */
42extern 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
Cody P Schaferec778ed2013-11-12 15:09:48 -080048 * @size: The maximum number of bits to search
Akinobu Mita708ff2a2010-09-29 18:08:50 +090049 *
50 * Returns the bit number of the first cleared bit.
Cody P Schaferec778ed2013-11-12 15:09:48 -080051 * If no bits are zero, returns @size.
Akinobu Mita708ff2a2010-09-29 18:08:50 +090052 */
53extern unsigned long find_first_zero_bit(const unsigned long *addr,
54 unsigned long size);
55#else /* CONFIG_GENERIC_FIND_FIRST_BIT */
56
Akinobu Mitac7f612c2006-03-26 01:39:11 -080057#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
Akinobu Mita708ff2a2010-09-29 18:08:50 +090060#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */
61
Akinobu Mitac7f612c2006-03-26 01:39:11 -080062#endif /*_ASM_GENERIC_BITOPS_FIND_H_ */