@@ -28,8 +28,10 @@ bfdev_find_first_bit(const unsigned long *addr, unsigned int bits)
2828{
2929 unsigned long value ;
3030
31- if (!bfdev_const_small_nbits (bits ))
32- return bfdev_comp_find_first_bit (addr , bits , 0UL , bfdev_false );
31+ if (!bfdev_const_small_nbits (bits )) {
32+ return bfdev_comp_find_first_bit (addr , bits ,
33+ BFDEV_ULONG_MIN , bfdev_false );
34+ }
3335
3436 value = * addr & BFDEV_BIT_LOW_MASK (bits );
3537 if (value == BFDEV_ULONG_MIN )
@@ -45,8 +47,10 @@ bfdev_find_last_bit(const unsigned long *addr, unsigned int bits)
4547{
4648 unsigned long value ;
4749
48- if (!bfdev_const_small_nbits (bits ))
49- return bfdev_comp_find_last_bit (addr , bits , 0UL , bfdev_false );
50+ if (!bfdev_const_small_nbits (bits )) {
51+ return bfdev_comp_find_last_bit (addr , bits ,
52+ BFDEV_ULONG_MIN , bfdev_false );
53+ }
5054
5155 value = * addr & BFDEV_BIT_LOW_MASK (bits );
5256 if (value == BFDEV_ULONG_MIN )
@@ -70,8 +74,10 @@ bfdev_find_first_zero(const unsigned long *addr, unsigned int bits)
7074{
7175 unsigned long value ;
7276
73- if (!bfdev_const_small_nbits (bits ))
74- return bfdev_comp_find_first_bit (addr , bits , ~0UL , bfdev_false );
77+ if (!bfdev_const_small_nbits (bits )) {
78+ return bfdev_comp_find_first_bit (addr , bits ,
79+ BFDEV_ULONG_MAX , bfdev_false );
80+ }
7581
7682 value = * addr | BFDEV_BIT_HIGH_MASK (bits );
7783 if (value == BFDEV_ULONG_MAX )
@@ -87,8 +93,10 @@ bfdev_find_last_zero(const unsigned long *addr, unsigned int bits)
8793{
8894 unsigned long value ;
8995
90- if (!bfdev_const_small_nbits (bits ))
91- return bfdev_comp_find_last_bit (addr , bits , ~0UL , bfdev_false );
96+ if (!bfdev_const_small_nbits (bits )) {
97+ return bfdev_comp_find_last_bit (addr , bits ,
98+ BFDEV_ULONG_MAX , bfdev_false );
99+ }
92100
93101 value = * addr | BFDEV_BIT_HIGH_MASK (bits );
94102 if (value == BFDEV_ULONG_MAX )
@@ -116,7 +124,7 @@ bfdev_find_next_bit(const unsigned long *addr,
116124
117125 if (!bfdev_const_small_nbits (bits )) {
118126 return bfdev_comp_find_next_bit (addr , BFDEV_NULL ,
119- bits , offset , 0UL , bfdev_false );
127+ bits , offset , BFDEV_ULONG_MIN , bfdev_false );
120128 }
121129
122130 if (bfdev_unlikely (offset >= bits ))
@@ -139,7 +147,7 @@ bfdev_find_prev_bit(const unsigned long *addr,
139147
140148 if (!bfdev_const_small_nbits (bits )) {
141149 return bfdev_comp_find_prev_bit (addr , BFDEV_NULL ,
142- bits , offset , 0UL , bfdev_false );
150+ bits , offset , BFDEV_ULONG_MIN , bfdev_false );
143151 }
144152
145153 if (bfdev_unlikely (offset >= bits ))
@@ -154,7 +162,7 @@ bfdev_find_prev_bit(const unsigned long *addr,
154162#endif
155163
156164/**
157- * bfdev_find_next_bit () - find next zero in a region.
165+ * bfdev_find_next_zero () - find next zero in a region.
158166 * @block: the block to find.
159167 * @bits: number of bits in the block.
160168 * @offset: the bitnumber to start searching at.
@@ -171,7 +179,7 @@ bfdev_find_next_zero(const unsigned long *addr,
171179
172180 if (!bfdev_const_small_nbits (bits )) {
173181 return bfdev_comp_find_next_bit (addr , BFDEV_NULL ,
174- bits , offset , ~ 0UL , bfdev_false );
182+ bits , offset , BFDEV_ULONG_MAX , bfdev_false );
175183 }
176184
177185 if (bfdev_unlikely (offset >= bits ))
@@ -194,7 +202,7 @@ bfdev_find_prev_zero(const unsigned long *addr,
194202
195203 if (!bfdev_const_small_nbits (bits )) {
196204 return bfdev_comp_find_prev_bit (addr , BFDEV_NULL ,
197- bits , offset , ~ 0UL , bfdev_false );
205+ bits , offset , BFDEV_ULONG_MAX , bfdev_false );
198206 }
199207
200208 if (bfdev_unlikely (offset >= bits ))
@@ -230,7 +238,7 @@ bfdev_find_next_and_bit(const unsigned long *addr1, const unsigned long *addr2,
230238
231239 if (!bfdev_const_small_nbits (bits )) {
232240 return bfdev_comp_find_next_bit (addr1 , addr2 ,
233- bits , offset , 0UL , bfdev_false );
241+ bits , offset , BFDEV_ULONG_MIN , bfdev_false );
234242 }
235243
236244 value = * addr1 & * addr2 & BFDEV_BIT_RANGE (bits - 1 , offset );
@@ -250,7 +258,7 @@ bfdev_find_prev_and_bit(const unsigned long *addr1, const unsigned long *addr2,
250258
251259 if (!bfdev_const_small_nbits (bits )) {
252260 return bfdev_comp_find_prev_bit (addr1 , addr2 ,
253- bits , offset , 0UL , bfdev_false );
261+ bits , offset , BFDEV_ULONG_MIN , bfdev_false );
254262 }
255263
256264 if (bfdev_unlikely (offset >= bits ))
0 commit comments