mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yury Norov <yury.norov@gmail.com>
To: linux-kernel@vger.kernel.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Yury Norov <yury.norov@gmail.com>
Subject: [PATCH 2/6] bitmap: replace _reg_op(REG_OP_ALLOC) with bitmap_set()
Date: Thu, 27 Oct 2022 18:48:30 -0700	[thread overview]
Message-ID: <20221028014834.572819-3-yury.norov@gmail.com> (raw)
In-Reply-To: <20221028014834.572819-1-yury.norov@gmail.com>

_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


  parent reply	other threads:[~2022-10-28  1:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28  1:48 [PATCH 0/6] bitmap: remove _reg_op() Yury Norov
2022-10-28  1:48 ` [PATCH 1/6] bitmap: add bitmap_empty_from() Yury Norov
2022-10-28  1:48 ` Yury Norov [this message]
2022-11-11  6:54   ` [PATCH 2/6] bitmap: replace _reg_op(REG_OP_ALLOC) with bitmap_set() kernel test robot
2022-10-28  1:48 ` [PATCH 3/6] bitmap: replace _reg_op(REG_OP_RELEASE) with bitmap_clear() Yury Norov
2022-10-28  1:48 ` [PATCH 4/6] bitmap: replace _reg_op(REG_OP_ISFREE) with bitmap_empty_from() Yury Norov
2022-10-28  1:48 ` [PATCH 5/6] bitmap: fix opencoded bitmap_allocate_region() Yury Norov
2022-10-28  1:48 ` [PATCH 6/6] bitmap: drop _reg_op() Yury Norov
2022-11-03  2:09 ` [PATCH 0/6] bitmap: remove _reg_op() Yury Norov
2023-07-27  2:02 [PATCH 0/6] bitmap: cleanup bitmap_*_region() implementation Yury Norov
2023-07-27  2:02 ` [PATCH 2/6] bitmap: replace _reg_op(REG_OP_ALLOC) with bitmap_set() Yury Norov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221028014834.572819-3-yury.norov@gmail.com \
    --to=yury.norov@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®