public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Wang Nan <wangnan0@huawei.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Jiri Olsa <jolsa@redhat.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Namhyung Kim <namhyung.kim@lge.com>,
	Waiman Long <Waiman.Long@hp.com>, <linux-kernel@vger.kernel.org>,
	Li Zefan <lizefan@huawei.com>
Subject: Re: [PATCH] perf tools: makes CPUINFO_PROC to array for different kernel version
Date: Wed, 22 Oct 2014 15:44:18 +0900	[thread overview]
Message-ID: <87wq7seh8d.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <1413428923-80073-1-git-send-email-wangnan0@huawei.com> (Wang Nan's message of "Thu, 16 Oct 2014 11:08:43 +0800")

Hi Wang,

On Thu, 16 Oct 2014 11:08:43 +0800, Wang Nan wrote:
> After kerne 3.7 (commit b4b8f770eb10a1bccaf8aa0ec1956e2dd7ed1e0a),
> /proc/cpuinfo replcae 'Processor' to 'model name'. This patch makes
> CPUINFO_PROC to an array and provides two choices for ARM, make it
> compatible for different kernel version.
>
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> -static int write_cpudesc(int fd, struct perf_header *h __maybe_unused,
> -		       struct perf_evlist *evlist __maybe_unused)
> +static int __write_cpudesc(int fd, struct perf_header *h __maybe_unused,
> +		       struct perf_evlist *evlist __maybe_unused, const char *cpuinfo_proc)

You don't need to pass @h and @evlist if they're not used.


>  {
> -#ifndef CPUINFO_PROC
> -#define CPUINFO_PROC NULL
> -#endif
>  	FILE *file;
>  	char *buf = NULL;
>  	char *s, *p;
> -	const char *search = CPUINFO_PROC;
> +	const char *search = cpuinfo_proc;
>  	size_t len = 0;
>  	int ret = -1;
>  
> @@ -640,6 +637,23 @@ done:
>  	return ret;
>  }
>  
> +static int write_cpudesc(int fd, struct perf_header *h __maybe_unused,
> +		       struct perf_evlist *evlist __maybe_unused)
> +{
> +#ifndef CPUINFO_PROC
> +#define CPUINFO_PROC {"model name", }
> +#endif
> +	const char *cpuinfo_procs[] = CPUINFO_PROC;
> +	unsigned int i;

Please put a blank line between declaration and the function body.

Other than that, looks good to me.

Thanks,
Namhyung


> +	for (i = 0; i < ARRAY_SIZE(cpuinfo_procs); i++) {
> +		int ret;
> +		ret = __write_cpudesc(fd, h, evlist, cpuinfo_procs[i]);
> +		if (ret >= 0)
> +			return ret;
> +	}
> +	return -1;
> +}
> +
>  static int write_nrcpus(int fd, struct perf_header *h __maybe_unused,
>  			struct perf_evlist *evlist __maybe_unused)
>  {

  reply	other threads:[~2014-10-22  6:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-16  3:08 [PATCH] perf tools: makes CPUINFO_PROC to array for different kernel version Wang Nan
2014-10-22  6:44 ` Namhyung Kim [this message]
2014-10-22  7:49   ` Wang Nan

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=87wq7seh8d.fsf@sejong.aot.lge.com \
    --to=namhyung@kernel.org \
    --cc=Waiman.Long@hp.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=mingo@redhat.com \
    --cc=namhyung.kim@lge.com \
    --cc=paulus@samba.org \
    --cc=wangnan0@huawei.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