From: Wang Nan <wangnan0@huawei.com>
To: Namhyung Kim <namhyung@kernel.org>
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:49:09 +0800 [thread overview]
Message-ID: <54476175.3070406@huawei.com> (raw)
In-Reply-To: <87wq7seh8d.fsf@sejong.aot.lge.com>
On 2014/10/22 14:44, Namhyung Kim wrote:
> 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
>
I posted a v2 patch, please refer to https://lkml.org/lkml/2014/10/22/85 .
Thanks.
>
>> + 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)
>> {
prev parent reply other threads:[~2014-10-22 7:49 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
2014-10-22 7:49 ` Wang Nan [this message]
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=54476175.3070406@huawei.com \
--to=wangnan0@huawei.com \
--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=namhyung@kernel.org \
--cc=paulus@samba.org \
/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