lkml.org 
[lkml]   [2022]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/6] bitmap: replace _reg_op(REG_OP_ALLOC) with bitmap_set()
Date
_reg_op(REG_OP_ALLOC) duplicates bitmap_set(). Drop it.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
lib/bitmap.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/bitmap.c b/lib/bitmap.c
index 1c81413c51f8..28630b57b2ab 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -1317,7 +1317,7 @@ int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order)
for (pos = 0 ; (end = pos + (1U << order)) <= bits; pos = end) {
if (!__reg_op(bitmap, pos, order, REG_OP_ISFREE))
continue;
- __reg_op(bitmap, pos, order, REG_OP_ALLOC);
+ bitmap_set(bitmap, pos, pos + BIT(order));
return pos;
}
return -ENOMEM;
@@ -1356,7 +1356,8 @@ int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order)
{
if (!__reg_op(bitmap, pos, order, REG_OP_ISFREE))
return -EBUSY;
- return __reg_op(bitmap, pos, order, REG_OP_ALLOC);
+ bitmap_set(bitmap, pos, pos + BIT(order));
+ return 0;
}
EXPORT_SYMBOL(bitmap_allocate_region);

--
2.34.1
\
 
 \ /
  Last update: 2022-10-28 03:49    [W:0.105 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site