All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf tools: Fix variable name's inconsistency in hists__for_each macro
@ 2019-12-19  8:08 fujita.yuya
  2019-12-19  8:51 ` Jiri Olsa
  0 siblings, 1 reply; 4+ messages in thread
From: fujita.yuya @ 2019-12-19  8:08 UTC (permalink / raw)
  To: 'Peter Zijlstra', 'Ingo Molnar',
	'Arnaldo Carvalho de Melo', 'Jiri Olsa'
  Cc: fujita.yuya, 'linux-kernel@vger.kernel.org'

From: Yuya Fujita <fujita.yuya@fujitsu.com>

Variable names are inconsistent in hists__for_each macro.
Due to this inconsistency, the macro replaces its second argument with "fmt" 
regardless of its original name.
So far it works because only "fmt" is passed to the second argument.
However, this behavior is not expected and should be fixed.

Fixes: f0786af536bb ("perf hists: Introduce hists__for_each_format macro")
Fixes: aa6f50af822a ("perf hists: Introduce hists__for_each_sort_list macro")
Signed-off-by: Yuya Fujita <fujita.yuya@fujitsu.com>
---
 tools/perf/util/hist.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 4528690..0aa63ae 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -339,10 +339,10 @@ static inline void perf_hpp__prepend_sort_field(struct perf_hpp_fmt *format)
 	list_for_each_entry_safe(format, tmp, &(_list)->sorts, sort_list)
 
 #define hists__for_each_format(hists, format) \
-	perf_hpp_list__for_each_format((hists)->hpp_list, fmt)
+	perf_hpp_list__for_each_format((hists)->hpp_list, format)
 
 #define hists__for_each_sort_list(hists, format) \
-	perf_hpp_list__for_each_sort_list((hists)->hpp_list, fmt)
+	perf_hpp_list__for_each_sort_list((hists)->hpp_list, format)
 
 extern struct perf_hpp_fmt perf_hpp__format[];
 
-- 
1.7.1

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

* Re: [PATCH] perf tools: Fix variable name's inconsistency in hists__for_each macro
  2019-12-19  8:08 [PATCH] perf tools: Fix variable name's inconsistency in hists__for_each macro fujita.yuya
@ 2019-12-19  8:51 ` Jiri Olsa
  2019-12-19 16:54   ` 'Arnaldo Carvalho de Melo'
  0 siblings, 1 reply; 4+ messages in thread
From: Jiri Olsa @ 2019-12-19  8:51 UTC (permalink / raw)
  To: fujita.yuya
  Cc: 'Peter Zijlstra', 'Ingo Molnar',
	'Arnaldo Carvalho de Melo', 'Jiri Olsa',
	'linux-kernel@vger.kernel.org'

On Thu, Dec 19, 2019 at 08:08:32AM +0000, fujita.yuya@fujitsu.com wrote:
> From: Yuya Fujita <fujita.yuya@fujitsu.com>
> 
> Variable names are inconsistent in hists__for_each macro.
> Due to this inconsistency, the macro replaces its second argument with "fmt" 
> regardless of its original name.
> So far it works because only "fmt" is passed to the second argument.

hum, I think it works because all the instances that use these macros
have 'fmt' variable passed in

> However, this behavior is not expected and should be fixed.
> 
> Fixes: f0786af536bb ("perf hists: Introduce hists__for_each_format macro")
> Fixes: aa6f50af822a ("perf hists: Introduce hists__for_each_sort_list macro")

nice ;-)

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

> Signed-off-by: Yuya Fujita <fujita.yuya@fujitsu.com>
> ---
>  tools/perf/util/hist.h |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
> index 4528690..0aa63ae 100644
> --- a/tools/perf/util/hist.h
> +++ b/tools/perf/util/hist.h
> @@ -339,10 +339,10 @@ static inline void perf_hpp__prepend_sort_field(struct perf_hpp_fmt *format)
>  	list_for_each_entry_safe(format, tmp, &(_list)->sorts, sort_list)
>  
>  #define hists__for_each_format(hists, format) \
> -	perf_hpp_list__for_each_format((hists)->hpp_list, fmt)
> +	perf_hpp_list__for_each_format((hists)->hpp_list, format)
>  
>  #define hists__for_each_sort_list(hists, format) \
> -	perf_hpp_list__for_each_sort_list((hists)->hpp_list, fmt)
> +	perf_hpp_list__for_each_sort_list((hists)->hpp_list, format)
>  
>  extern struct perf_hpp_fmt perf_hpp__format[];
>  
> -- 
> 1.7.1
> 


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

* Re: [PATCH] perf tools: Fix variable name's inconsistency in hists__for_each macro
  2019-12-19  8:51 ` Jiri Olsa
@ 2019-12-19 16:54   ` 'Arnaldo Carvalho de Melo'
  2019-12-19 21:45     ` Jiri Olsa
  0 siblings, 1 reply; 4+ messages in thread
From: 'Arnaldo Carvalho de Melo' @ 2019-12-19 16:54 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: fujita.yuya, 'Peter Zijlstra', 'Ingo Molnar',
	'Jiri Olsa', 'linux-kernel@vger.kernel.org'

Em Thu, Dec 19, 2019 at 09:51:06AM +0100, Jiri Olsa escreveu:
> On Thu, Dec 19, 2019 at 08:08:32AM +0000, fujita.yuya@fujitsu.com wrote:
> > From: Yuya Fujita <fujita.yuya@fujitsu.com>
> > 
> > Variable names are inconsistent in hists__for_each macro.
> > Due to this inconsistency, the macro replaces its second argument with "fmt" 
> > regardless of its original name.
> > So far it works because only "fmt" is passed to the second argument.
> 
> hum, I think it works because all the instances that use these macros
> have 'fmt' variable passed in

Exactly, that is what he said :-)

Nice catch!
 
> > However, this behavior is not expected and should be fixed.
> > 
> > Fixes: f0786af536bb ("perf hists: Introduce hists__for_each_format macro")
> > Fixes: aa6f50af822a ("perf hists: Introduce hists__for_each_sort_list macro")
> 
> nice ;-)
> 
> Acked-by: Jiri Olsa <jolsa@kernel.org>

Applied.
 
> thanks,
> jirka
> 
> > Signed-off-by: Yuya Fujita <fujita.yuya@fujitsu.com>
> > ---
> >  tools/perf/util/hist.h |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
> > index 4528690..0aa63ae 100644
> > --- a/tools/perf/util/hist.h
> > +++ b/tools/perf/util/hist.h
> > @@ -339,10 +339,10 @@ static inline void perf_hpp__prepend_sort_field(struct perf_hpp_fmt *format)
> >  	list_for_each_entry_safe(format, tmp, &(_list)->sorts, sort_list)
> >  
> >  #define hists__for_each_format(hists, format) \
> > -	perf_hpp_list__for_each_format((hists)->hpp_list, fmt)
> > +	perf_hpp_list__for_each_format((hists)->hpp_list, format)
> >  
> >  #define hists__for_each_sort_list(hists, format) \
> > -	perf_hpp_list__for_each_sort_list((hists)->hpp_list, fmt)
> > +	perf_hpp_list__for_each_sort_list((hists)->hpp_list, format)
> >  
> >  extern struct perf_hpp_fmt perf_hpp__format[];
> >  
> > -- 
> > 1.7.1
> > 

-- 

- Arnaldo

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

* Re: [PATCH] perf tools: Fix variable name's inconsistency in hists__for_each macro
  2019-12-19 16:54   ` 'Arnaldo Carvalho de Melo'
@ 2019-12-19 21:45     ` Jiri Olsa
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Olsa @ 2019-12-19 21:45 UTC (permalink / raw)
  To: 'Arnaldo Carvalho de Melo'
  Cc: fujita.yuya, 'Peter Zijlstra', 'Ingo Molnar',
	'Jiri Olsa', 'linux-kernel@vger.kernel.org'

On Thu, Dec 19, 2019 at 01:54:24PM -0300, 'Arnaldo Carvalho de Melo' wrote:
> Em Thu, Dec 19, 2019 at 09:51:06AM +0100, Jiri Olsa escreveu:
> > On Thu, Dec 19, 2019 at 08:08:32AM +0000, fujita.yuya@fujitsu.com wrote:
> > > From: Yuya Fujita <fujita.yuya@fujitsu.com>
> > > 
> > > Variable names are inconsistent in hists__for_each macro.
> > > Due to this inconsistency, the macro replaces its second argument with "fmt" 
> > > regardless of its original name.
> > > So far it works because only "fmt" is passed to the second argument.
> > 
> > hum, I think it works because all the instances that use these macros
> > have 'fmt' variable passed in
> 
> Exactly, that is what he said :-)

ugh, I read too fast, sry

jirka

> 
> Nice catch!
>  
> > > However, this behavior is not expected and should be fixed.
> > > 
> > > Fixes: f0786af536bb ("perf hists: Introduce hists__for_each_format macro")
> > > Fixes: aa6f50af822a ("perf hists: Introduce hists__for_each_sort_list macro")
> > 
> > nice ;-)
> > 
> > Acked-by: Jiri Olsa <jolsa@kernel.org>
> 
> Applied.
>  
> > thanks,
> > jirka
> > 
> > > Signed-off-by: Yuya Fujita <fujita.yuya@fujitsu.com>
> > > ---
> > >  tools/perf/util/hist.h |    4 ++--
> > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
> > > index 4528690..0aa63ae 100644
> > > --- a/tools/perf/util/hist.h
> > > +++ b/tools/perf/util/hist.h
> > > @@ -339,10 +339,10 @@ static inline void perf_hpp__prepend_sort_field(struct perf_hpp_fmt *format)
> > >  	list_for_each_entry_safe(format, tmp, &(_list)->sorts, sort_list)
> > >  
> > >  #define hists__for_each_format(hists, format) \
> > > -	perf_hpp_list__for_each_format((hists)->hpp_list, fmt)
> > > +	perf_hpp_list__for_each_format((hists)->hpp_list, format)
> > >  
> > >  #define hists__for_each_sort_list(hists, format) \
> > > -	perf_hpp_list__for_each_sort_list((hists)->hpp_list, fmt)
> > > +	perf_hpp_list__for_each_sort_list((hists)->hpp_list, format)
> > >  
> > >  extern struct perf_hpp_fmt perf_hpp__format[];
> > >  
> > > -- 
> > > 1.7.1
> > > 
> 
> -- 
> 
> - Arnaldo
> 


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

end of thread, other threads:[~2019-12-19 21:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-19  8:08 [PATCH] perf tools: Fix variable name's inconsistency in hists__for_each macro fujita.yuya
2019-12-19  8:51 ` Jiri Olsa
2019-12-19 16:54   ` 'Arnaldo Carvalho de Melo'
2019-12-19 21:45     ` Jiri Olsa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.