diff options
Diffstat (limited to 'lib/find_next_bit.c')
| -rw-r--r-- | lib/find_next_bit.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/find_next_bit.c b/lib/find_next_bit.c index d3f5784807b4..24c59ded47a0 100644 --- a/lib/find_next_bit.c +++ b/lib/find_next_bit.c | |||
| @@ -20,8 +20,8 @@ | |||
| 20 | /* | 20 | /* |
| 21 | * Find the next set bit in a memory region. | 21 | * Find the next set bit in a memory region. |
| 22 | */ | 22 | */ |
| 23 | unsigned long __find_next_bit(const unsigned long *addr, | 23 | unsigned long find_next_bit(const unsigned long *addr, unsigned long size, |
| 24 | unsigned long size, unsigned long offset) | 24 | unsigned long offset) |
| 25 | { | 25 | { |
| 26 | const unsigned long *p = addr + BITOP_WORD(offset); | 26 | const unsigned long *p = addr + BITOP_WORD(offset); |
| 27 | unsigned long result = offset & ~(BITS_PER_LONG-1); | 27 | unsigned long result = offset & ~(BITS_PER_LONG-1); |
| @@ -58,14 +58,14 @@ found_first: | |||
| 58 | found_middle: | 58 | found_middle: |
| 59 | return result + __ffs(tmp); | 59 | return result + __ffs(tmp); |
| 60 | } | 60 | } |
| 61 | EXPORT_SYMBOL(__find_next_bit); | 61 | EXPORT_SYMBOL(find_next_bit); |
| 62 | 62 | ||
| 63 | /* | 63 | /* |
| 64 | * This implementation of find_{first,next}_zero_bit was stolen from | 64 | * This implementation of find_{first,next}_zero_bit was stolen from |
| 65 | * Linus' asm-alpha/bitops.h. | 65 | * Linus' asm-alpha/bitops.h. |
| 66 | */ | 66 | */ |
| 67 | unsigned long __find_next_zero_bit(const unsigned long *addr, | 67 | unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, |
| 68 | unsigned long size, unsigned long offset) | 68 | unsigned long offset) |
| 69 | { | 69 | { |
| 70 | const unsigned long *p = addr + BITOP_WORD(offset); | 70 | const unsigned long *p = addr + BITOP_WORD(offset); |
| 71 | unsigned long result = offset & ~(BITS_PER_LONG-1); | 71 | unsigned long result = offset & ~(BITS_PER_LONG-1); |
| @@ -102,15 +102,14 @@ found_first: | |||
| 102 | found_middle: | 102 | found_middle: |
| 103 | return result + ffz(tmp); | 103 | return result + ffz(tmp); |
| 104 | } | 104 | } |
| 105 | EXPORT_SYMBOL(__find_next_zero_bit); | 105 | EXPORT_SYMBOL(find_next_zero_bit); |
| 106 | #endif /* CONFIG_GENERIC_FIND_NEXT_BIT */ | 106 | #endif /* CONFIG_GENERIC_FIND_NEXT_BIT */ |
| 107 | 107 | ||
| 108 | #ifdef CONFIG_GENERIC_FIND_FIRST_BIT | 108 | #ifdef CONFIG_GENERIC_FIND_FIRST_BIT |
| 109 | /* | 109 | /* |
| 110 | * Find the first set bit in a memory region. | 110 | * Find the first set bit in a memory region. |
| 111 | */ | 111 | */ |
| 112 | unsigned long __find_first_bit(const unsigned long *addr, | 112 | unsigned long find_first_bit(const unsigned long *addr, unsigned long size) |
| 113 | unsigned long size) | ||
| 114 | { | 113 | { |
| 115 | const unsigned long *p = addr; | 114 | const unsigned long *p = addr; |
| 116 | unsigned long result = 0; | 115 | unsigned long result = 0; |
| @@ -131,13 +130,12 @@ unsigned long __find_first_bit(const unsigned long *addr, | |||
| 131 | found: | 130 | found: |
| 132 | return result + __ffs(tmp); | 131 | return result + __ffs(tmp); |
| 133 | } | 132 | } |
| 134 | EXPORT_SYMBOL(__find_first_bit); | 133 | EXPORT_SYMBOL(find_first_bit); |
| 135 | 134 | ||
| 136 | /* | 135 | /* |
| 137 | * Find the first cleared bit in a memory region. | 136 | * Find the first cleared bit in a memory region. |
| 138 | */ | 137 | */ |
| 139 | unsigned long __find_first_zero_bit(const unsigned long *addr, | 138 | unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size) |
| 140 | unsigned long size) | ||
| 141 | { | 139 | { |
| 142 | const unsigned long *p = addr; | 140 | const unsigned long *p = addr; |
| 143 | unsigned long result = 0; | 141 | unsigned long result = 0; |
| @@ -158,7 +156,7 @@ unsigned long __find_first_zero_bit(const unsigned long *addr, | |||
| 158 | found: | 156 | found: |
| 159 | return result + ffz(tmp); | 157 | return result + ffz(tmp); |
| 160 | } | 158 | } |
| 161 | EXPORT_SYMBOL(__find_first_zero_bit); | 159 | EXPORT_SYMBOL(find_first_zero_bit); |
| 162 | #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ | 160 | #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ |
| 163 | 161 | ||
| 164 | #ifdef __BIG_ENDIAN | 162 | #ifdef __BIG_ENDIAN |
