mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-01 08:04:22 +08:00
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>
This commit is contained in:
parent
add00c76ee
commit
9276819a68
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user