tools: Move code originally from asm-generic/ atomic.h into tools/include/asm-generic/
tip-bot for Arnaldo Carvalho de Melo
merge botCommit-ID: cae68d4f6a0a1f8fb7c979f356e994a3c17543c1 Gitweb: http://git.kernel.org/tip/cae68d4f6a0a1f8fb7c979f356e994a3c17543c1 Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Mon, 15 Dec 2014 16:44:26 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 17 Dec 2014 11:11:52 -0300
tools: Move code originally from asm-generic/atomic.h into tools/include/asm-generic/
To match the Linux kernel source code structure from where this code came from.
Cc Adrian Hunter <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc David Ahern <[email protected]>
Cc Don Zickus <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/include/asm-generic/bitops/atomic.h | 22 ++++++++++++++++++++++ tools/perf/MANIFEST | 1 + tools/perf/Makefile.perf | 1 + tools/perf/util/include/linux/bitops.h | 16 +--------------- 4 files changed, 25 insertions(+), 15 deletions(-)
tools/include/asm-generic/bitops/atomic.h new file +22 -0
@@ -0,0 +1,22 @@ +#ifndef _TOOLS_LINUX_ASM_GENERIC_BITOPS_ATOMIC_H_ +#define _TOOLS_LINUX_ASM_GENERIC_BITOPS_ATOMIC_H_ + +#include <asm/types.h> + +static inline void set_bit (int nr,unsigned long *addr) +{ + addr[nr / __BITS_PER_LONG] |=1UL << (nr % __BITS_PER_LONG); +} + +static inline void clear_bit (int nr,unsigned long *addr) +{ + addr[nr / __BITS_PER_LONG] &= ~(1UL << (nr % __BITS_PER_LONG)); +} + +static __always_inline int test_bit(unsigned int nr, const unsigned long *addr) +{ +return ((1UL << (nr % __BITS_PER_LONG)) & + (((unsigned long *)addr)[nr / __BITS_PER_LONG])) !=0 ; +} + +#endif /* _TOOLS_LINUX_ASM_GENERIC_BITOPS_ATOMIC_H_ */
tools/perf/MANIFEST +1 -0
@@ -5,6 +5,7 @@ tools/lib/api tools/lib/symbol/kallsyms.c tools/lib/symbol/kallsyms.h tools/include/asm/bug.h +tools/include/asm-generic/bitops/atomic.h tools/include/asm-generic/bitops/__ffs.h tools/include/linux/compiler.h tools/include/linux/export.h
tools/perf/Makefile.perf +1 -0
@@ -232,6 +232,7 @@ LIB_H += ../include/linux/hash.h LIB_H += ../../include/linux/stringify.h LIB_H += util/include/linux/bitmap.h LIB_H += util/include/linux/bitops.h +LIB_H += ../include/asm-generic/bitops/atomic.h LIB_H += ../include/asm-generic/bitops/__ffs.h LIB_H += ../include/linux/compiler.h LIB_H += ../include/linux/log2.h
tools/perf/util/include/linux/bitops.h +1 -15
@@ -29,21 +29,7 @@ (bit) < (size); \ (bit) = find_next_bit((addr), (size), (bit) + 1)) -static inline void set_bit (int nr,unsigned long *addr) -{ - addr[nr /BITS_PER_LONG ] |=1UL << (nr %BITS_PER_LONG ); -} - -static inline void clear_bit (int nr,unsigned long *addr) -{ - addr[nr /BITS_PER_LONG ] &= ~(1UL << (nr %BITS_PER_LONG )); -} - -static __always_inline int test_bit(unsigned int nr, const unsigned long *addr) -{ -return ((1UL << (nr %BITS_PER_LONG )) & - (((unsigned long *)addr)[nr /BITS_PER_LONG ])) !=0 ; -} +#include <asm-generic/bitops/atomic.h> static inline unsigned long hweight_long (unsigned long w) {