diff options
author | Mark Rutland <mark.rutland@arm.com> | 2018-05-10 06:35:15 -0400 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2018-05-21 13:07:05 -0400 |
commit | 0788f1e97324d8378e860dc2560699ddc6f3aef9 (patch) | |
tree | e74a421c69c90cf2c1753907a74620bee799ee71 | |
parent | 5c591304e710339a75a9f0f9f3f085aa4109e55d (diff) |
arm_pmu: simplify arm_pmu::handle_irq
The arm_pmu::handle_irq() callback has the same prototype as a generic
IRQ handler, taking the IRQ number and a void pointer argument which it
must convert to an arm_pmu pointer.
This means that all arm_pmu::handle_irq() take an IRQ number they never
use, and all must explicitly cast the void pointer to an arm_pmu
pointer.
Instead, let's change arm_pmu::handle_irq to take an arm_pmu pointer,
allowing these casts to be removed. The redundant IRQ number parameter
is also removed.
Suggested-by: Hoeun Ryu <hoeun.ryu@lge.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r-- | arch/arm/kernel/perf_event_v6.c | 4 | ||||
-rw-r--r-- | arch/arm/kernel/perf_event_v7.c | 3 | ||||
-rw-r--r-- | arch/arm/kernel/perf_event_xscale.c | 6 | ||||
-rw-r--r-- | arch/arm64/kernel/perf_event.c | 3 | ||||
-rw-r--r-- | drivers/perf/arm_pmu.c | 2 | ||||
-rw-r--r-- | include/linux/perf/arm_pmu.h | 2 |
6 files changed, 7 insertions, 13 deletions
diff --git a/arch/arm/kernel/perf_event_v6.c b/arch/arm/kernel/perf_event_v6.c index 1d7061a38922..be42c4f66a40 100644 --- a/arch/arm/kernel/perf_event_v6.c +++ b/arch/arm/kernel/perf_event_v6.c | |||
@@ -303,12 +303,10 @@ static void armv6pmu_enable_event(struct perf_event *event) | |||
303 | } | 303 | } |
304 | 304 | ||
305 | static irqreturn_t | 305 | static irqreturn_t |
306 | armv6pmu_handle_irq(int irq_num, | 306 | armv6pmu_handle_irq(struct arm_pmu *cpu_pmu) |
307 | void *dev) | ||
308 | { | 307 | { |
309 | unsigned long pmcr = armv6_pmcr_read(); | 308 | unsigned long pmcr = armv6_pmcr_read(); |
310 | struct perf_sample_data data; | 309 | struct perf_sample_data data; |
311 | struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev; | ||
312 | struct pmu_hw_events *cpuc = this_cpu_ptr(cpu_pmu->hw_events); | 310 | struct pmu_hw_events *cpuc = this_cpu_ptr(cpu_pmu->hw_events); |
313 | struct pt_regs *regs; | 311 | struct pt_regs *regs; |
314 | int idx; | 312 | int idx; |
diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c index 870b66c1e4ef..57f01e059f39 100644 --- a/arch/arm/kernel/perf_event_v7.c +++ b/arch/arm/kernel/perf_event_v7.c | |||
@@ -946,11 +946,10 @@ static void armv7pmu_disable_event(struct perf_event *event) | |||
946 | raw_spin_unlock_irqrestore(&events->pmu_lock, flags); | 946 | raw_spin_unlock_irqrestore(&events->pmu_lock, flags); |
947 | } | 947 | } |
948 | 948 | ||
949 | static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev) | 949 | static irqreturn_t armv7pmu_handle_irq(struct arm_pmu *cpu_pmu) |
950 | { | 950 | { |
951 | u32 pmnc; | 951 | u32 pmnc; |
952 | struct perf_sample_data data; | 952 | struct perf_sample_data data; |
953 | struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev; | ||
954 | struct pmu_hw_events *cpuc = this_cpu_ptr(cpu_pmu->hw_events); | 953 | struct pmu_hw_events *cpuc = this_cpu_ptr(cpu_pmu->hw_events); |
955 | struct pt_regs *regs; | 954 | struct pt_regs *regs; |
956 | int idx; | 955 | int idx; |
diff --git a/arch/arm/kernel/perf_event_xscale.c b/arch/arm/kernel/perf_event_xscale.c index fcf218da660e..88d1a76f5367 100644 --- a/arch/arm/kernel/perf_event_xscale.c +++ b/arch/arm/kernel/perf_event_xscale.c | |||
@@ -142,11 +142,10 @@ xscale1_pmnc_counter_has_overflowed(unsigned long pmnc, | |||
142 | } | 142 | } |
143 | 143 | ||
144 | static irqreturn_t | 144 | static irqreturn_t |
145 | xscale1pmu_handle_irq(int irq_num, void *dev) | 145 | xscale1pmu_handle_irq(struct arm_pmu *cpu_pmu) |
146 | { | 146 | { |
147 | unsigned long pmnc; | 147 | unsigned long pmnc; |
148 | struct perf_sample_data data; | 148 | struct perf_sample_data data; |
149 | struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev; | ||
150 | struct pmu_hw_events *cpuc = this_cpu_ptr(cpu_pmu->hw_events); | 149 | struct pmu_hw_events *cpuc = this_cpu_ptr(cpu_pmu->hw_events); |
151 | struct pt_regs *regs; | 150 | struct pt_regs *regs; |
152 | int idx; | 151 | int idx; |
@@ -489,11 +488,10 @@ xscale2_pmnc_counter_has_overflowed(unsigned long of_flags, | |||
489 | } | 488 | } |
490 | 489 | ||
491 | static irqreturn_t | 490 | static irqreturn_t |
492 | xscale2pmu_handle_irq(int irq_num, void *dev) | 491 | xscale2pmu_handle_irq(struct arm_pmu *cpu_pmu) |
493 | { | 492 | { |
494 | unsigned long pmnc, of_flags; | 493 | unsigned long pmnc, of_flags; |
495 | struct perf_sample_data data; | 494 | struct perf_sample_data data; |
496 | struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev; | ||
497 | struct pmu_hw_events *cpuc = this_cpu_ptr(cpu_pmu->hw_events); | 495 | struct pmu_hw_events *cpuc = this_cpu_ptr(cpu_pmu->hw_events); |
498 | struct pt_regs *regs; | 496 | struct pt_regs *regs; |
499 | int idx; | 497 | int idx; |
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index 85a251b6dfa8..33147aacdafd 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c | |||
@@ -670,11 +670,10 @@ static void armv8pmu_disable_event(struct perf_event *event) | |||
670 | raw_spin_unlock_irqrestore(&events->pmu_lock, flags); | 670 | raw_spin_unlock_irqrestore(&events->pmu_lock, flags); |
671 | } | 671 | } |
672 | 672 | ||
673 | static irqreturn_t armv8pmu_handle_irq(int irq_num, void *dev) | 673 | static irqreturn_t armv8pmu_handle_irq(struct arm_pmu *cpu_pmu) |
674 | { | 674 | { |
675 | u32 pmovsr; | 675 | u32 pmovsr; |
676 | struct perf_sample_data data; | 676 | struct perf_sample_data data; |
677 | struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev; | ||
678 | struct pmu_hw_events *cpuc = this_cpu_ptr(cpu_pmu->hw_events); | 677 | struct pmu_hw_events *cpuc = this_cpu_ptr(cpu_pmu->hw_events); |
679 | struct pt_regs *regs; | 678 | struct pt_regs *regs; |
680 | int idx; | 679 | int idx; |
diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c index 1a0d340b65cf..a6347d487635 100644 --- a/drivers/perf/arm_pmu.c +++ b/drivers/perf/arm_pmu.c | |||
@@ -339,7 +339,7 @@ static irqreturn_t armpmu_dispatch_irq(int irq, void *dev) | |||
339 | return IRQ_NONE; | 339 | return IRQ_NONE; |
340 | 340 | ||
341 | start_clock = sched_clock(); | 341 | start_clock = sched_clock(); |
342 | ret = armpmu->handle_irq(irq, armpmu); | 342 | ret = armpmu->handle_irq(armpmu); |
343 | finish_clock = sched_clock(); | 343 | finish_clock = sched_clock(); |
344 | 344 | ||
345 | perf_sample_event_took(finish_clock - start_clock); | 345 | perf_sample_event_took(finish_clock - start_clock); |
diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h index 40036a57d072..ad5444491975 100644 --- a/include/linux/perf/arm_pmu.h +++ b/include/linux/perf/arm_pmu.h | |||
@@ -78,7 +78,7 @@ struct arm_pmu { | |||
78 | struct pmu pmu; | 78 | struct pmu pmu; |
79 | cpumask_t supported_cpus; | 79 | cpumask_t supported_cpus; |
80 | char *name; | 80 | char *name; |
81 | irqreturn_t (*handle_irq)(int irq_num, void *dev); | 81 | irqreturn_t (*handle_irq)(struct arm_pmu *pmu); |
82 | void (*enable)(struct perf_event *event); | 82 | void (*enable)(struct perf_event *event); |
83 | void (*disable)(struct perf_event *event); | 83 | void (*disable)(struct perf_event *event); |
84 | int (*get_event_idx)(struct pmu_hw_events *hw_events, | 84 | int (*get_event_idx)(struct pmu_hw_events *hw_events, |