linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH fixes] MIPS: perf: Fix build with CONFIG_CPU_BMIPS5000 enabled
@ 2019-03-26 17:03 Florian Fainelli
  2019-03-28 18:42 ` Paul Burton
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2019-03-26 17:03 UTC (permalink / raw)
  To: linux-mips
  Cc: Florian Fainelli, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Ralf Baechle, Paul Burton, James Hogan,
	open list:PERFORMANCE EVENTS SUBSYSTEM, open list:MIPS

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")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 arch/mips/kernel/perf_event_mipsxx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c
index 413863508f6f..739b7ff9fdab 100644
--- a/arch/mips/kernel/perf_event_mipsxx.c
+++ b/arch/mips/kernel/perf_event_mipsxx.c
@@ -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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH fixes] MIPS: perf: Fix build with CONFIG_CPU_BMIPS5000 enabled
  2019-03-26 17:03 [PATCH fixes] MIPS: perf: Fix build with CONFIG_CPU_BMIPS5000 enabled Florian Fainelli
@ 2019-03-28 18:42 ` Paul Burton
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Burton @ 2019-03-28 18:42 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: linux-mips, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Ralf Baechle, James Hogan,
	open list:PERFORMANCE EVENTS SUBSYSTEM, open list:MIPS

Hi Florian,

On Tue, Mar 26, 2019 at 10:03:34AM -0700, Florian Fainelli wrote:
> 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

> Fixes: 84002c88599d ("MIPS: perf: Fix perf with MT counting other threads")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  arch/mips/kernel/perf_event_mipsxx.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c
> index 413863508f6f..739b7ff9fdab 100644
> --- a/arch/mips/kernel/perf_event_mipsxx.c
> +++ b/arch/mips/kernel/perf_event_mipsxx.c
> @@ -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;
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-28 18:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-26 17:03 [PATCH fixes] MIPS: perf: Fix build with CONFIG_CPU_BMIPS5000 enabled Florian Fainelli
2019-03-28 18:42 ` Paul Burton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).