Re: [PATCH v2 1/2] ARM: perf: Preparatory work for Scorpion PMU support

From: Stephen Boyd
Date: Fri Feb 20 2015 - 15:37:45 EST


On 02/20, Will Deacon wrote:
> On Fri, Feb 13, 2015 at 06:24:08PM +0000, Stephen Boyd wrote:
> > Do some things to make the Krait PMU support code generic enough
> > to be used by the Scorpion PMU support code.
> >
> > * Rename the venum register functions to be venum instead of krait
> > specific because the same registers exist on Scorpion
> >
> > * Add a krait_decode_event() function to decode our Krait specific
> > event encoding that's the same on Scorpion (modulo an extra region).
> >
> > * Drop krait from krait_clear_pmresrn_group() so it can be used
> > by Scorpion code
> >
> > Signed-off-by: Stephen Boyd <sboyd@xxxxxxxxxxxxxx>
> > ---
> > arch/arm/kernel/perf_event_v7.c | 87 ++++++++++++++++++++++-------------------
> > 1 file changed, 46 insertions(+), 41 deletions(-)
>
> [...]
>
> > +static void krait_decode_event(u32 event, unsigned int *region,
> > + unsigned int *group, unsigned int *code, bool *venum, bool *cpu)
> > +{
> > + if (region)
> > + *region = (event >> 12) & 0xf;
> > + if (group)
> > + *group = (event >> 0) & 0xf;
> > + if (code)
> > + *code = (event >> 4) & 0xff;
> > + if (venum)
> > + *venum = !!(event & VENUM_EVENT);
> > + if (cpu)
> > + *cpu = !!(event & KRAIT_EVENT);
> > +}
>
> Maybe worth sticking these fields in a struct? Failing that, just using
> macros for each one and using them in-line isn't so bad.
>

Ok let's see how a macro goes. Is there any advantage either way?

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/