diff options
author | David S. Miller <davem@davemloft.net> | 2010-05-19 02:01:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-05-19 02:01:55 -0400 |
commit | 2ec8c6bb5d8f3a62a79f463525054bae1e3d4487 (patch) | |
tree | fa7f8400ac685fb52e96f64997c7c682fc2aa021 /tools/perf/util/include | |
parent | 7b39f90fabcf9e2af0cd79d0a60440d821e22b56 (diff) | |
parent | 537b60d17894b7c19a6060feae40299d7109d6e7 (diff) |
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Conflicts:
include/linux/mod_devicetable.h
scripts/mod/file2alias.c
Diffstat (limited to 'tools/perf/util/include')
-rw-r--r-- | tools/perf/util/include/asm/bitops.h | 18 | ||||
-rw-r--r-- | tools/perf/util/include/asm/hweight.h | 8 | ||||
-rw-r--r-- | tools/perf/util/include/dwarf-regs.h | 8 | ||||
-rw-r--r-- | tools/perf/util/include/linux/bitmap.h | 38 | ||||
-rw-r--r-- | tools/perf/util/include/linux/bitops.h | 20 | ||||
-rw-r--r-- | tools/perf/util/include/linux/compiler.h | 2 | ||||
-rw-r--r-- | tools/perf/util/include/linux/kernel.h | 11 |
7 files changed, 70 insertions, 35 deletions
diff --git a/tools/perf/util/include/asm/bitops.h b/tools/perf/util/include/asm/bitops.h deleted file mode 100644 index 58e9817ffae0..000000000000 --- a/tools/perf/util/include/asm/bitops.h +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | #ifndef _PERF_ASM_BITOPS_H_ | ||
2 | #define _PERF_ASM_BITOPS_H_ | ||
3 | |||
4 | #include <sys/types.h> | ||
5 | #include "../../types.h" | ||
6 | #include <linux/compiler.h> | ||
7 | |||
8 | /* CHECKME: Not sure both always match */ | ||
9 | #define BITS_PER_LONG __WORDSIZE | ||
10 | |||
11 | #include "../../../../include/asm-generic/bitops/__fls.h" | ||
12 | #include "../../../../include/asm-generic/bitops/fls.h" | ||
13 | #include "../../../../include/asm-generic/bitops/fls64.h" | ||
14 | #include "../../../../include/asm-generic/bitops/__ffs.h" | ||
15 | #include "../../../../include/asm-generic/bitops/ffz.h" | ||
16 | #include "../../../../include/asm-generic/bitops/hweight.h" | ||
17 | |||
18 | #endif | ||
diff --git a/tools/perf/util/include/asm/hweight.h b/tools/perf/util/include/asm/hweight.h new file mode 100644 index 000000000000..36cf26d434a5 --- /dev/null +++ b/tools/perf/util/include/asm/hweight.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef PERF_HWEIGHT_H | ||
2 | #define PERF_HWEIGHT_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | unsigned int hweight32(unsigned int w); | ||
6 | unsigned long hweight64(__u64 w); | ||
7 | |||
8 | #endif /* PERF_HWEIGHT_H */ | ||
diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h new file mode 100644 index 000000000000..cf6727e99c44 --- /dev/null +++ b/tools/perf/util/include/dwarf-regs.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _PERF_DWARF_REGS_H_ | ||
2 | #define _PERF_DWARF_REGS_H_ | ||
3 | |||
4 | #ifdef DWARF_SUPPORT | ||
5 | const char *get_arch_regstr(unsigned int n); | ||
6 | #endif | ||
7 | |||
8 | #endif | ||
diff --git a/tools/perf/util/include/linux/bitmap.h b/tools/perf/util/include/linux/bitmap.h index 94507639a8c4..eda4416efa0a 100644 --- a/tools/perf/util/include/linux/bitmap.h +++ b/tools/perf/util/include/linux/bitmap.h | |||
@@ -1,3 +1,35 @@ | |||
1 | #include "../../../../include/linux/bitmap.h" | 1 | #ifndef _PERF_BITOPS_H |
2 | #include "../../../../include/asm-generic/bitops/find.h" | 2 | #define _PERF_BITOPS_H |
3 | #include <linux/errno.h> | 3 | |
4 | #include <string.h> | ||
5 | #include <linux/bitops.h> | ||
6 | |||
7 | int __bitmap_weight(const unsigned long *bitmap, int bits); | ||
8 | |||
9 | #define BITMAP_LAST_WORD_MASK(nbits) \ | ||
10 | ( \ | ||
11 | ((nbits) % BITS_PER_LONG) ? \ | ||
12 | (1UL<<((nbits) % BITS_PER_LONG))-1 : ~0UL \ | ||
13 | ) | ||
14 | |||
15 | #define small_const_nbits(nbits) \ | ||
16 | (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG) | ||
17 | |||
18 | static inline void bitmap_zero(unsigned long *dst, int nbits) | ||
19 | { | ||
20 | if (small_const_nbits(nbits)) | ||
21 | *dst = 0UL; | ||
22 | else { | ||
23 | int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); | ||
24 | memset(dst, 0, len); | ||
25 | } | ||
26 | } | ||
27 | |||
28 | static inline int bitmap_weight(const unsigned long *src, int nbits) | ||
29 | { | ||
30 | if (small_const_nbits(nbits)) | ||
31 | return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits)); | ||
32 | return __bitmap_weight(src, nbits); | ||
33 | } | ||
34 | |||
35 | #endif /* _PERF_BITOPS_H */ | ||
diff --git a/tools/perf/util/include/linux/bitops.h b/tools/perf/util/include/linux/bitops.h index 8d63116e9435..bb4ac2e05385 100644 --- a/tools/perf/util/include/linux/bitops.h +++ b/tools/perf/util/include/linux/bitops.h | |||
@@ -1,13 +1,12 @@ | |||
1 | #ifndef _PERF_LINUX_BITOPS_H_ | 1 | #ifndef _PERF_LINUX_BITOPS_H_ |
2 | #define _PERF_LINUX_BITOPS_H_ | 2 | #define _PERF_LINUX_BITOPS_H_ |
3 | 3 | ||
4 | #define __KERNEL__ | 4 | #include <linux/kernel.h> |
5 | #include <asm/hweight.h> | ||
5 | 6 | ||
6 | #define CONFIG_GENERIC_FIND_NEXT_BIT | 7 | #define BITS_PER_LONG __WORDSIZE |
7 | #define CONFIG_GENERIC_FIND_FIRST_BIT | 8 | #define BITS_PER_BYTE 8 |
8 | #include "../../../../include/linux/bitops.h" | 9 | #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) |
9 | |||
10 | #undef __KERNEL__ | ||
11 | 10 | ||
12 | static inline void set_bit(int nr, unsigned long *addr) | 11 | static inline void set_bit(int nr, unsigned long *addr) |
13 | { | 12 | { |
@@ -20,10 +19,9 @@ static __always_inline int test_bit(unsigned int nr, const unsigned long *addr) | |||
20 | (((unsigned long *)addr)[nr / BITS_PER_LONG])) != 0; | 19 | (((unsigned long *)addr)[nr / BITS_PER_LONG])) != 0; |
21 | } | 20 | } |
22 | 21 | ||
23 | unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, unsigned | 22 | static inline unsigned long hweight_long(unsigned long w) |
24 | long size, unsigned long offset); | 23 | { |
25 | 24 | return sizeof(w) == 4 ? hweight32(w) : hweight64(w); | |
26 | unsigned long generic_find_next_le_bit(const unsigned long *addr, unsigned | 25 | } |
27 | long size, unsigned long offset); | ||
28 | 26 | ||
29 | #endif | 27 | #endif |
diff --git a/tools/perf/util/include/linux/compiler.h b/tools/perf/util/include/linux/compiler.h index dfb0713ed47f..791f9dd27ebf 100644 --- a/tools/perf/util/include/linux/compiler.h +++ b/tools/perf/util/include/linux/compiler.h | |||
@@ -7,4 +7,6 @@ | |||
7 | #define __user | 7 | #define __user |
8 | #define __attribute_const__ | 8 | #define __attribute_const__ |
9 | 9 | ||
10 | #define __used __attribute__((__unused__)) | ||
11 | |||
10 | #endif | 12 | #endif |
diff --git a/tools/perf/util/include/linux/kernel.h b/tools/perf/util/include/linux/kernel.h index f2611655ab51..1eb804fd3fbf 100644 --- a/tools/perf/util/include/linux/kernel.h +++ b/tools/perf/util/include/linux/kernel.h | |||
@@ -28,6 +28,8 @@ | |||
28 | (type *)((char *)__mptr - offsetof(type, member)); }) | 28 | (type *)((char *)__mptr - offsetof(type, member)); }) |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) | ||
32 | |||
31 | #ifndef max | 33 | #ifndef max |
32 | #define max(x, y) ({ \ | 34 | #define max(x, y) ({ \ |
33 | typeof(x) _max1 = (x); \ | 35 | typeof(x) _max1 = (x); \ |
@@ -85,16 +87,19 @@ simple_strtoul(const char *nptr, char **endptr, int base) | |||
85 | return strtoul(nptr, endptr, base); | 87 | return strtoul(nptr, endptr, base); |
86 | } | 88 | } |
87 | 89 | ||
90 | int eprintf(int level, | ||
91 | const char *fmt, ...) __attribute__((format(printf, 2, 3))); | ||
92 | |||
88 | #ifndef pr_fmt | 93 | #ifndef pr_fmt |
89 | #define pr_fmt(fmt) fmt | 94 | #define pr_fmt(fmt) fmt |
90 | #endif | 95 | #endif |
91 | 96 | ||
92 | #define pr_err(fmt, ...) \ | 97 | #define pr_err(fmt, ...) \ |
93 | do { fprintf(stderr, pr_fmt(fmt), ##__VA_ARGS__); } while (0) | 98 | eprintf(0, pr_fmt(fmt), ##__VA_ARGS__) |
94 | #define pr_warning(fmt, ...) \ | 99 | #define pr_warning(fmt, ...) \ |
95 | do { fprintf(stderr, pr_fmt(fmt), ##__VA_ARGS__); } while (0) | 100 | eprintf(0, pr_fmt(fmt), ##__VA_ARGS__) |
96 | #define pr_info(fmt, ...) \ | 101 | #define pr_info(fmt, ...) \ |
97 | do { fprintf(stderr, pr_fmt(fmt), ##__VA_ARGS__); } while (0) | 102 | eprintf(0, pr_fmt(fmt), ##__VA_ARGS__) |
98 | #define pr_debug(fmt, ...) \ | 103 | #define pr_debug(fmt, ...) \ |
99 | eprintf(1, pr_fmt(fmt), ##__VA_ARGS__) | 104 | eprintf(1, pr_fmt(fmt), ##__VA_ARGS__) |
100 | #define pr_debugN(n, fmt, ...) \ | 105 | #define pr_debugN(n, fmt, ...) \ |