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,
	"Alexander Lobakin" <alexandr.lobakin@intel.com>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"David Gow" <davidgow@google.com>,
	"Eric Dumazet" <edumazet@google.com>,
	"Isabella Basso" <isabbasso@riseup.net>,
	"Kees Cook" <keescook@chromium.org>,
	"Keith Busch" <kbusch@kernel.org>,
	"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
	"Marco Elver" <elver@google.com>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Toke Høiland-Jørgensen" <toke@redhat.com>,
	"Valentin Schneider" <vschneid@redhat.com>
Cc: Yury Norov <yury.norov@gmail.com>
Subject: [PATCH v3 1/6] lib/bitmap: don't call __bitmap_weight() in kernel code
Date: Sat, 17 Sep 2022 20:07:11 -0700	[thread overview]
Message-ID: <20220918030716.1252285-2-yury.norov@gmail.com> (raw)
In-Reply-To: <20220918030716.1252285-1-yury.norov@gmail.com>

__bitmap_weight() is not to be used directly in the kernel code because
it's a helper for bitmap_weight(). Switch everything to bitmap_weight().

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

diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c
index 5d44ceac855b..e92bbd754365 100644
--- a/fs/ntfs3/bitmap.c
+++ b/fs/ntfs3/bitmap.c
@@ -560,7 +560,7 @@ static int wnd_rescan(struct wnd_bitmap *wnd)
 
 		buf = (ulong *)bh->b_data;
 
-		used = __bitmap_weight(buf, wbits);
+		used = bitmap_weight(buf, wbits);
 		if (used < wbits) {
 			frb = wbits - used;
 			wnd->free_bits[iw] = frb;
@@ -1364,7 +1364,7 @@ int wnd_extend(struct wnd_bitmap *wnd, size_t new_bits)
 		buf = (ulong *)bh->b_data;
 
 		__bitmap_clear(buf, b0, blocksize * 8 - b0);
-		frb = wbits - __bitmap_weight(buf, wbits);
+		frb = wbits - bitmap_weight(buf, wbits);
 		wnd->total_zeroes += frb - wnd->free_bits[iw];
 		wnd->free_bits[iw] = frb;
 
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 488e6c3e5acc..d56e275db73e 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -953,7 +953,7 @@ static int bitmap_pos_to_ord(const unsigned long *buf, unsigned int pos, unsigne
 	if (pos >= nbits || !test_bit(pos, buf))
 		return -1;
 
-	return __bitmap_weight(buf, pos);
+	return bitmap_weight(buf, pos);
 }
 
 /**
-- 
2.34.1


  reply	other threads:[~2022-09-18  3:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-18  3:07 [PATCH v3 0/5] lib/find: add find_nth_bit() Yury Norov
2022-09-18  3:07 ` Yury Norov [this message]
2022-09-18  3:07 ` [PATCH v3 2/6] lib/bitmap: add bitmap_weight_and() Yury Norov
2022-09-18  3:07 ` [PATCH v3 3/6] lib: add find_nth{,_and,_andnot}_bit() Yury Norov
2022-09-18  3:07 ` [PATCH v3 4/6] lib/bitmap: add tests for find_nth_bit() Yury Norov
2022-09-18  3:07 ` [PATCH v3 5/6] lib/bitmap: remove bitmap_ord_to_pos Yury Norov
2022-09-18  3:07 ` [PATCH v3 6/6] cpumask: add cpumask_nth_{,and,andnot} Yury Norov
2022-09-23 16:18 ` [PATCH v3 0/5] lib/find: add find_nth_bit() Yury Norov
2022-09-26 19:17   ` 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=20220918030716.1252285-2-yury.norov@gmail.com \
    --to=yury.norov@gmail.com \
    --cc=alexandr.lobakin@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=davidgow@google.com \
    --cc=edumazet@google.com \
    --cc=elver@google.com \
    --cc=isabbasso@riseup.net \
    --cc=kbusch@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mark.rutland@arm.com \
    --cc=memxor@gmail.com \
    --cc=rostedt@goodmis.org \
    --cc=toke@redhat.com \
    --cc=vschneid@redhat.com \
    /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®