diff options
author | Yury Norov | 2023-09-24 19:38:15 -0700 |
---|---|---|
committer | Yury Norov | 2023-10-14 20:25:22 -0700 |
commit | 9276819a68b52cf2577f77985041faf527cf477c (patch) | |
tree | 32b47f510cc4c21acfd629749063a3cd518887c6 /lib | |
parent | add00c76ee4dafbc35b170bea144358fd62daebb (diff) |
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bitmap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c index babed4dcb467..e4d761a69fe8 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -840,7 +840,7 @@ int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order) { unsigned int len = BIT(order); - if (!__reg_op(bitmap, pos, order, REG_OP_ISFREE)) + if (find_next_bit(bitmap, pos + len, pos) < pos + len) return -EBUSY; bitmap_set(bitmap, pos, len); return 0; |