Skip to contentSkip to conversation

tools include: Adopt linux/bits.h

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Oct 9, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw
Commit-ID:  ba4aa02b417f08a0bee5e7b8ed70cac788a7c854
Gitweb:     https://git.kernel.org/tip/ba4aa02b417f08a0bee5e7b8ed70cac788a7c854
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Tue, 25 Sep 2018 10:55:59 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 8 Oct 2018 14:23:43 -0300

tools include: Adopt linux/bits.h

So that we reduce the difference of tools/include/linux/bitops.h to the original kernel file, include/linux/bitops.h, trying to remove the need to define BITS_PER_LONG, to avoid clashes with asm/bitsperlong.h.

And the things removed from tools/include/linux/bitops.h are really in linux/bits.h, so that we can have a copy and then tools/perf/check_headers.sh will tell us when new stuff gets added to linux/bits.h so that we can check if it is useful and if any adjustment needs to be done to the tools/{include,arch}/ copies.

---
 tools/include/linux/bitops.h            | 7 ++-----
 {include => tools/include}/linux/bits.h | 0
 tools/perf/check-headers.sh             | 1 +
 3 files changed, 3 insertions(+), 5 deletions(-)
tools/include/linux/bitops.h +2 -5
index acc704bd3998..0b0ef3abc966 100644
@@ -3,8 +3,6 @@
 #define _TOOLS_LINUX_BITOPS_H_
 
 #include <asm/types.h>
-#include <linux/compiler.h>
-
 #ifndef __WORDSIZE
 #define __WORDSIZE (__SIZEOF_LONG__ * 8)
 #endif
@@ -12,10 +10,9 @@
 #ifndef BITS_PER_LONG
 # define BITS_PER_LONG __WORDSIZE
 #endif
+#include <linux/bits.h>
+#include <linux/compiler.h>
 
-#define BIT_MASK(nr)		(1UL << ((nr) % BITS_PER_LONG))
-#define BIT_WORD(nr)		((nr) / BITS_PER_LONG)
-#define BITS_PER_BYTE		8
 #define BITS_TO_LONGS(nr)	DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
 #define BITS_TO_U64(nr)		DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u64))
 #define BITS_TO_U32(nr)		DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u32))
tools/include/linux/bits.h renamed from include/linux/bits.h +0 -0
similarity index 100%
copy from include/linux/bits.h
copy to tools/include/linux/bits.h
tools/perf/check-headers.sh +1 -0
index 466540ee8ea7..c72cc73a6b09 100755
@@ -14,6 +14,7 @@ include/uapi/linux/sched.h
 include/uapi/linux/stat.h
 include/uapi/linux/vhost.h
 include/uapi/sound/asound.h
+include/linux/bits.h
 include/linux/hash.h
 include/uapi/linux/hw_breakpoint.h
 arch/x86/include/asm/disabled-features.h