2020-07-08 06:37:08

by Xu Wang

[permalink] [raw]
Subject: [PATCH] kernel: perf_event: use for_each_set_bit() to simplify the code

Using for_each_set_bit() to simplify the code.

Signed-off-by: Xu Wang <[email protected]>
---
arch/xtensa/kernel/perf_event.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/xtensa/kernel/perf_event.c b/arch/xtensa/kernel/perf_event.c
index 9bae79f70301..99fcd63ce597 100644
--- a/arch/xtensa/kernel/perf_event.c
+++ b/arch/xtensa/kernel/perf_event.c
@@ -362,9 +362,7 @@ irqreturn_t xtensa_pmu_irq_handler(int irq, void *dev_id)
struct xtensa_pmu_events *ev = this_cpu_ptr(&xtensa_pmu_events);
unsigned i;

- for (i = find_first_bit(ev->used_mask, XCHAL_NUM_PERF_COUNTERS);
- i < XCHAL_NUM_PERF_COUNTERS;
- i = find_next_bit(ev->used_mask, XCHAL_NUM_PERF_COUNTERS, i + 1)) {
+ for_each_set_bit(i, ev->used_mask, XCHAL_NUM_PERF_COUNTERS) {
uint32_t v = get_er(XTENSA_PMU_PMSTAT(i));
struct perf_event *event = ev->event[i];
struct hw_perf_event *hwc = &event->hw;
--
2.17.1


2020-07-08 07:29:22

by Max Filippov

[permalink] [raw]
Subject: Re: [PATCH] kernel: perf_event: use for_each_set_bit() to simplify the code

On Tue, Jul 7, 2020 at 11:59 PM Xu Wang <[email protected]> wrote:
>
> Using for_each_set_bit() to simplify the code.
>
> Signed-off-by: Xu Wang <[email protected]>
> ---
> arch/xtensa/kernel/perf_event.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)

Thanks! Applied to my xtensa tree with a slightly edited commit message.

--
Thanks.
-- Max