Commit-ID:  83c2e4f3968d6871eed295f2f5675d3d70b01afa
Gitweb:     http://git.kernel.org/tip/83c2e4f3968d6871eed295f2f5675d3d70b01afa
Author:     Jiri Olsa <jo...@kernel.org>
AuthorDate: Mon, 12 Dec 2016 11:35:40 +0100
Committer:  Arnaldo Carvalho de Melo <a...@redhat.com>
CommitDate: Thu, 15 Dec 2016 16:25:45 -0300

perf evsel: Use variable instead of repeating lengthy FD macro

It's more readable and will ease up following patches.

Signed-off-by: Jiri Olsa <jo...@kernel.org>
Cc: David Ahern <dsah...@gmail.com>
Cc: Namhyung Kim <namhy...@kernel.org>
Cc: Peter Zijlstra <a.p.zijls...@chello.nl>
Link: 
http://lkml.kernel.org/r/1481538943-21874-3-git-send-email-jo...@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <a...@redhat.com>
---
 tools/perf/util/evsel.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index b2365a63..fd61ebd 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1474,7 +1474,7 @@ retry_sample_id:
        for (cpu = 0; cpu < cpus->nr; cpu++) {
 
                for (thread = 0; thread < nthreads; thread++) {
-                       int group_fd;
+                       int fd, group_fd;
 
                        if (!evsel->cgrp && !evsel->system_wide)
                                pid = thread_map__pid(threads, thread);
@@ -1484,21 +1484,22 @@ retry_open:
                        pr_debug2("sys_perf_event_open: pid %d  cpu %d  
group_fd %d  flags %#lx",
                                  pid, cpus->map[cpu], group_fd, flags);
 
-                       FD(evsel, cpu, thread) = 
sys_perf_event_open(&evsel->attr,
-                                                                    pid,
-                                                                    
cpus->map[cpu],
-                                                                    group_fd, 
flags);
-                       if (FD(evsel, cpu, thread) < 0) {
+                       fd = sys_perf_event_open(&evsel->attr, pid, 
cpus->map[cpu],
+                                                group_fd, flags);
+
+                       FD(evsel, cpu, thread) = fd;
+
+                       if (fd < 0) {
                                err = -errno;
                                pr_debug2("\nsys_perf_event_open failed, error 
%d\n",
                                          err);
                                goto try_fallback;
                        }
 
-                       pr_debug2(" = %d\n", FD(evsel, cpu, thread));
+                       pr_debug2(" = %d\n", fd);
 
                        if (evsel->bpf_fd >= 0) {
-                               int evt_fd = FD(evsel, cpu, thread);
+                               int evt_fd = fd;
                                int bpf_fd = evsel->bpf_fd;
 
                                err = ioctl(evt_fd,

Reply via email to