perf kvm stat live: Use perf_evlist__add_pollfd return fd position
authorJiri Olsa <jolsa@kernel.org>
Wed, 1 Oct 2014 16:00:28 +0000 (18:00 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 3 Oct 2014 12:39:48 +0000 (09:39 -0300)
With the interface changed in following commit:

  2171a9256862 tools lib fd array: Allow associating an integer cookie with each entry

the perf_evlist__add_pollfd function now returns the fd position in the
pollfd array.

Hence we no longer need to count the fd position, because we get it as
the return value.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Milian Wolff <mail@milianw.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1412179229-19466-4-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-kvm.c

index 663d6eda0822b2a8a1d07e2e8244e82d6f602ce0..dc7d704735bd535d33e4e05fbe62b689ab4d09f4 100644 (file)
@@ -933,10 +933,10 @@ static int kvm_events_live_report(struct perf_kvm_stat *kvm)
 
        nr_fds++;
 
-       if (perf_evlist__add_pollfd(kvm->evlist, fileno(stdin)) < 0)
+       nr_stdin = perf_evlist__add_pollfd(kvm->evlist, fileno(stdin));
+       if (nr_stdin < 0)
                goto out;
 
-       nr_stdin = nr_fds;
        nr_fds++;
        if (fd_set_nonblock(fileno(stdin)) != 0)
                goto out;