public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jia He <hejianet@gmail.com>
To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Michal Nazarewicz <mina86@mina86.com>,
	Yury Norov <yury.norov@gmail.com>, Tejun Heo <tj@kernel.org>,
	Martin Kepplinger <martink@posteo.de>,
	George Spelvin <linux@horizon.com>,
	Ingo Molnar <mingo@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Jia He <hejianet@gmail.com>
Subject: [PATCH 1/3] linux/bitmap: Move 2 mask macro to bitops.h
Date: Thu, 19 Nov 2015 10:31:52 +0800	[thread overview]
Message-ID: <1447900314-5727-2-git-send-email-hejianet@gmail.com> (raw)
In-Reply-To: <1447900314-5727-1-git-send-email-hejianet@gmail.com>

This patch moves the mask macro to bitops.h and then the new introduced
api in find_bit.c can use it.

Signed-off-by: Jia He <hejianet@gmail.com>
---
 include/linux/bitmap.h | 3 ---
 include/linux/bitops.h | 4 ++++
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 9653fdb..15524f6 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -172,9 +172,6 @@ extern unsigned int bitmap_ord_to_pos(const unsigned long *bitmap, unsigned int
 extern int bitmap_print_to_pagebuf(bool list, char *buf,
 				   const unsigned long *maskp, int nmaskbits);
 
-#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1)))
-#define BITMAP_LAST_WORD_MASK(nbits) (~0UL >> (-(nbits) & (BITS_PER_LONG - 1)))
-
 #define small_const_nbits(nbits) \
 	(__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
 
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 2b8ed12..b881028 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -24,6 +24,10 @@
 #define GENMASK_ULL(h, l) \
 	(((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
 
+/* For bitmap ops*/
+#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1)))
+#define BITMAP_LAST_WORD_MASK(nbits) (~0UL >> (-(nbits) & (BITS_PER_LONG - 1)))
+
 extern unsigned int __sw_hweight8(unsigned int w);
 extern unsigned int __sw_hweight16(unsigned int w);
 extern unsigned int __sw_hweight32(unsigned int w);
-- 
2.5.0


  reply	other threads:[~2015-11-19  2:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-19  2:31 [PATCH 0/3] Improve bitmap_empty and bitmap_full Jia He
2015-11-19  2:31 ` Jia He [this message]
2015-11-22 19:17   ` [PATCH 1/3] linux/bitmap: Move 2 mask macro to bitops.h Andy Shevchenko
2015-11-19  2:31 ` [PATCH 2/3] lib: Introduce 2 find bit api: all_is_bit_{one,zero} Jia He
2015-11-20  8:52   ` Geert Uytterhoeven
2015-11-20 13:57   ` Michal Nazarewicz
2015-11-19  2:31 ` [PATCH 3/3] linux/bitmap: Replace find_fisrt_{zero_}bit with the new lightweight api Jia He
2015-11-19  2:53   ` kbuild test robot
2015-11-19  3:24     ` hejianet

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=1447900314-5727-2-git-send-email-hejianet@gmail.com \
    --to=hejianet@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=dvlasenk@redhat.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@horizon.com \
    --cc=linux@rasmusvillemoes.dk \
    --cc=martink@posteo.de \
    --cc=mina86@mina86.com \
    --cc=mingo@kernel.org \
    --cc=tj@kernel.org \
    --cc=yury.norov@gmail.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