diff options
| author | Akinobu Mita <akinobu.mita@gmail.com> | 2012-03-23 18:02:03 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-23 19:58:33 -0400 |
| commit | 307b1cd7ecd7f3dc5ce3d3860957f034f0abe4df (patch) | |
| tree | dfc8eb9a5dd7c4621a3a61058f25cabf82e327cd | |
| parent | 2df5e12900d847af9113980d015939dde0d1b1d4 (diff) | |
bitops: rename for_each_set_bit_cont() in favor of analogous list.h function
This renames for_each_set_bit_cont() to for_each_set_bit_from() because
it is analogous to list_for_each_entry_from() in list.h rather than
list_for_each_entry_continue().
This doesn't remove for_each_set_bit_cont() for now.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rw-r--r-- | arch/x86/kernel/cpu/perf_event.c | 4 | ||||
| -rw-r--r-- | include/linux/bitops.h | 5 | ||||
| -rw-r--r-- | tools/perf/util/include/linux/bitops.h | 2 |
3 files changed, 7 insertions, 4 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 0a18d16cb58d..fa2900c0e398 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
| @@ -643,14 +643,14 @@ static bool __perf_sched_find_counter(struct perf_sched *sched) | |||
| 643 | /* Prefer fixed purpose counters */ | 643 | /* Prefer fixed purpose counters */ |
| 644 | if (x86_pmu.num_counters_fixed) { | 644 | if (x86_pmu.num_counters_fixed) { |
| 645 | idx = X86_PMC_IDX_FIXED; | 645 | idx = X86_PMC_IDX_FIXED; |
| 646 | for_each_set_bit_cont(idx, c->idxmsk, X86_PMC_IDX_MAX) { | 646 | for_each_set_bit_from(idx, c->idxmsk, X86_PMC_IDX_MAX) { |
| 647 | if (!__test_and_set_bit(idx, sched->state.used)) | 647 | if (!__test_and_set_bit(idx, sched->state.used)) |
| 648 | goto done; | 648 | goto done; |
| 649 | } | 649 | } |
| 650 | } | 650 | } |
| 651 | /* Grab the first unused counter starting with idx */ | 651 | /* Grab the first unused counter starting with idx */ |
| 652 | idx = sched->state.counter; | 652 | idx = sched->state.counter; |
| 653 | for_each_set_bit_cont(idx, c->idxmsk, X86_PMC_IDX_FIXED) { | 653 | for_each_set_bit_from(idx, c->idxmsk, X86_PMC_IDX_FIXED) { |
| 654 | if (!__test_and_set_bit(idx, sched->state.used)) | 654 | if (!__test_and_set_bit(idx, sched->state.used)) |
| 655 | goto done; | 655 | goto done; |
| 656 | } | 656 | } |
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 94300fe46cce..a78e358f0c17 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
| @@ -27,11 +27,14 @@ extern unsigned long __sw_hweight64(__u64 w); | |||
| 27 | (bit) = find_next_bit((addr), (size), (bit) + 1)) | 27 | (bit) = find_next_bit((addr), (size), (bit) + 1)) |
| 28 | 28 | ||
| 29 | /* same as for_each_set_bit() but use bit as value to start with */ | 29 | /* same as for_each_set_bit() but use bit as value to start with */ |
| 30 | #define for_each_set_bit_cont(bit, addr, size) \ | 30 | #define for_each_set_bit_from(bit, addr, size) \ |
| 31 | for ((bit) = find_next_bit((addr), (size), (bit)); \ | 31 | for ((bit) = find_next_bit((addr), (size), (bit)); \ |
| 32 | (bit) < (size); \ | 32 | (bit) < (size); \ |
| 33 | (bit) = find_next_bit((addr), (size), (bit) + 1)) | 33 | (bit) = find_next_bit((addr), (size), (bit) + 1)) |
| 34 | 34 | ||
| 35 | #define for_each_set_bit_cont(bit, addr, size) \ | ||
| 36 | for_each_set_bit_from(bit, addr, size) | ||
| 37 | |||
| 35 | static __inline__ int get_bitmask_order(unsigned int count) | 38 | static __inline__ int get_bitmask_order(unsigned int count) |
| 36 | { | 39 | { |
| 37 | int order; | 40 | int order; |
diff --git a/tools/perf/util/include/linux/bitops.h b/tools/perf/util/include/linux/bitops.h index 62cdee78db7b..f1584833bd22 100644 --- a/tools/perf/util/include/linux/bitops.h +++ b/tools/perf/util/include/linux/bitops.h | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | (bit) = find_next_bit((addr), (size), (bit) + 1)) | 15 | (bit) = find_next_bit((addr), (size), (bit) + 1)) |
| 16 | 16 | ||
| 17 | /* same as for_each_set_bit() but use bit as value to start with */ | 17 | /* same as for_each_set_bit() but use bit as value to start with */ |
| 18 | #define for_each_set_bit_cont(bit, addr, size) \ | 18 | #define for_each_set_bit_from(bit, addr, size) \ |
| 19 | for ((bit) = find_next_bit((addr), (size), (bit)); \ | 19 | for ((bit) = find_next_bit((addr), (size), (bit)); \ |
| 20 | (bit) < (size); \ | 20 | (bit) < (size); \ |
| 21 | (bit) = find_next_bit((addr), (size), (bit) + 1)) | 21 | (bit) = find_next_bit((addr), (size), (bit) + 1)) |
