Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@mvista.com>
To: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org,
	a.p.zijlstra@chello.nl, paulus@samba.org, mingo@elte.hu,
	acme@redhat.com, jamie.iles@picochip.com, will.deacon@arm.com
Subject: Re: [PATCH v4 7/9] MIPS/perf-events: allow modules to get pmu number of counters
Date: Sat, 15 May 2010 20:17:06 +0400	[thread overview]
Message-ID: <4BEEC902.2080006@mvista.com> (raw)
In-Reply-To: <1273937815-4781-8-git-send-email-dengcheng.zhu@gmail.com>

Hello.

Deng-Cheng Zhu wrote:

> Oprofile module needs a function to get the number of pmu counters in its
> high level interfaces.
>
> Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
> ---
>  arch/mips/include/asm/pmu.h   |    1 +
>  arch/mips/kernel/perf_event.c |   11 +++++++++++
>  2 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/arch/mips/include/asm/pmu.h b/arch/mips/include/asm/pmu.h
> index 16d4fcd..023a915 100644
> --- a/arch/mips/include/asm/pmu.h
> +++ b/arch/mips/include/asm/pmu.h
> @@ -114,5 +114,6 @@ enum mips_pmu_id {
>  extern const char *mips_pmu_names[];
>  
>  extern enum mips_pmu_id mipspmu_get_pmu_id(void);
> +extern int mipspmu_get_max_events(void);
>  
>  #endif /* __MIPS_PMU_H__ */
> diff --git a/arch/mips/kernel/perf_event.c b/arch/mips/kernel/perf_event.c
> index 67d301d..6f95220 100644
> --- a/arch/mips/kernel/perf_event.c
> +++ b/arch/mips/kernel/perf_event.c
> @@ -145,6 +145,17 @@ enum mips_pmu_id mipspmu_get_pmu_id(void)
>  }
>  EXPORT_SYMBOL_GPL(mipspmu_get_pmu_id);
>  
> +int mipspmu_get_max_events(void)
> +{
> +	int max_events = 0;
> +
> +	if (mipspmu)
> +		max_events = mipspmu->num_counters;
> +
> +	return max_events;
>   

   Why not simply:

    return mispmu ? mipspmu->num_counters : 0;

WBR, Sergei

  reply	other threads:[~2010-05-15 16:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-15 15:36 [PATCH v4 0/9] MIPS performance event support v4 Deng-Cheng Zhu
2010-05-15 15:36 ` [PATCH v4 1/9] MIPS/Oprofile: extract PMU defines/helper functions for sharing Deng-Cheng Zhu
2010-05-15 15:36 ` [PATCH v4 2/9] MIPS: use generic atomic64 in non-64bit kernels Deng-Cheng Zhu
2010-05-15 15:36 ` [PATCH v4 3/9] MIPS: add support for software performance events Deng-Cheng Zhu
2010-05-15 15:36 ` [PATCH v4 4/9] MIPS: add support for hardware " Deng-Cheng Zhu
2010-05-15 15:36 ` [PATCH v4 5/9] MIPS: move mipsxx pmu helper functions to perf events Deng-Cheng Zhu
2010-05-15 15:36 ` [PATCH v4 6/9] MIPS/perf-events: replace pmu names with numeric IDs Deng-Cheng Zhu
2010-05-15 15:36 ` [PATCH v4 7/9] MIPS/perf-events: allow modules to get pmu number of counters Deng-Cheng Zhu
2010-05-15 16:17   ` Sergei Shtylyov [this message]
2010-05-17  3:58     ` Deng-Cheng Zhu
2010-05-17  3:58       ` Deng-Cheng Zhu
2010-05-15 15:36 ` [PATCH v4 8/9] MIPS/Oprofile: use perf-events framework as backend Deng-Cheng Zhu
2010-05-15 15:36 ` [PATCH v4 9/9] MIPS/Oprofile: remove old files and update Kconfig/Makefile Deng-Cheng Zhu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BEEC902.2080006@mvista.com \
    --to=sshtylyov@mvista.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=dengcheng.zhu@gmail.com \
    --cc=jamie.iles@picochip.com \
    --cc=linux-mips@linux-mips.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=ralf@linux-mips.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox