Skip to contentSkip to conversation

MIPS: perf: Fix build with CONFIG_CPU_BMIPS5000 enabled

PATCH Superseded Florian Fainelli 2 participants 2 messages Mar 26, 2019 – Mar 28, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: perf: Fix build with CONFIG_CPU_BMIPS5000 enabled

The 'event' variable may be unused in case only CONFIG_CPU_BMIPS5000 being enabled:

arch/mips/kernel/perf_event_mipsxx.c: In function 'mipsxx_pmu_enable_event':
arch/mips/kernel/perf_event_mipsxx.c:326:21: error: unused variable 'event' [-Werror=unused-variable]

  struct perf_event *event = container_of(evt, struct perf_event, hw);
                     ^~~~~
Fixes 84002c88599d ("MIPS: perf: Fix perf with MT counting other threads")
---
 arch/mips/kernel/perf_event_mipsxx.c | 2 ++
 1 file changed, 2 insertions(+)
arch/mips/kernel/perf_event_mipsxx.c +2 -0
index 413863508f6f..739b7ff9fdab 100644
@@ -323,7 +323,9 @@ static int mipsxx_pmu_alloc_counter(struct cpu_hw_events *cpuc,
 
 static void mipsxx_pmu_enable_event(struct hw_perf_event *evt, int idx)
 {
+#ifndef CONFIG_CPU_BMIPS5000
 	struct perf_event *event = container_of(evt, struct perf_event, hw);
+#endif
 	struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
 #ifdef CONFIG_MIPS_MT_SMP
 	unsigned int range = evt->event_base >> 24;
Signature · 1 line
2.17.1
#1 lore raw

Hi Florian,

Quoted 7 lines · Florian Fainelli

The 'event' variable may be unused in case only CONFIG_CPU_BMIPS5000 being enabled:

arch/mips/kernel/perf_event_mipsxx.c: In function 'mipsxx_pmu_enable_event':
arch/mips/kernel/perf_event_mipsxx.c:326:21: error: unused variable 'event' [-Werror=unused-variable]

  struct perf_event *event = container_of(evt, struct perf_event, hw);
                     ^~~~~

Ah - nice catch :)

Could we fix it by replacing the existing #ifdef with an

  if (IS_ENABLED(CONFIG_CPU_BMIPS5000)) {

instead? The same could be done for the CONFIG_MIPS_MT_SMP #ifdefs too.

I think that would leave us with more readable code.

Thanks,
Paul

Quoted 23 lines
Fixes 84002c88599d ("MIPS: perf: Fix perf with MT counting other threads")
---
 arch/mips/kernel/perf_event_mipsxx.c | 2 ++
 1 file changed, 2 insertions(+)
arch/mips/kernel/perf_event_mipsxx.c +2 -0
index 413863508f6f..739b7ff9fdab 100644
@@ -323,7 +323,9 @@ static int mipsxx_pmu_alloc_counter(struct cpu_hw_events *cpuc,
 
 static void mipsxx_pmu_enable_event(struct hw_perf_event *evt, int idx)
 {
+#ifndef CONFIG_CPU_BMIPS5000
 	struct perf_event *event = container_of(evt, struct perf_event, hw);
+#endif
 	struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
 #ifdef CONFIG_MIPS_MT_SMP
 	unsigned int range = evt->event_base >> 24;
Signature · 1 line
2.17.1