Skip to content

Commit 9276819

Browse files
committed
bitmap: replace _reg_op(REG_OP_ISFREE) with find_next_bit()
_reg_op(REG_OP_ISFREE) can be trivially replaced with find_next_bit(). Doing that opens room for potential small_const_nbits() optimization. CC: Andy Shevchenko <andriy.shevchenko@linux.intel.com> CC: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Yury Norov <yury.norov@gmail.com>
1 parent add00c7 commit 9276819

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/bitmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order)
840840
{
841841
unsigned int len = BIT(order);
842842

843-
if (!__reg_op(bitmap, pos, order, REG_OP_ISFREE))
843+
if (find_next_bit(bitmap, pos + len, pos) < pos + len)
844844
return -EBUSY;
845845
bitmap_set(bitmap, pos, len);
846846
return 0;

0 commit comments

Comments
 (0)