perf evsel: Introduce perf_evsel__prev() method

Just one use so far, on the hists browser, for completeness since there
we use perf_evlist__{first,last} and perf_evsel__next() for handling the
TAB and UNTAB keys.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-d09l4lejp5427enuf3igpckw@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 9a354cdc
...@@ -1855,7 +1855,7 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu, ...@@ -1855,7 +1855,7 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu,
if (pos->node.prev == &evlist->entries) if (pos->node.prev == &evlist->entries)
pos = perf_evlist__last(evlist); pos = perf_evlist__last(evlist);
else else
pos = list_entry(pos->node.prev, struct perf_evsel, node); pos = perf_evsel__prev(pos);
goto browse_hists; goto browse_hists;
case K_ESC: case K_ESC:
if (!ui_browser__dialog_yesno(&menu->b, if (!ui_browser__dialog_yesno(&menu->b,
......
...@@ -279,6 +279,11 @@ static inline struct perf_evsel *perf_evsel__next(struct perf_evsel *evsel) ...@@ -279,6 +279,11 @@ static inline struct perf_evsel *perf_evsel__next(struct perf_evsel *evsel)
return list_entry(evsel->node.next, struct perf_evsel, node); return list_entry(evsel->node.next, struct perf_evsel, node);
} }
static inline struct perf_evsel *perf_evsel__prev(struct perf_evsel *evsel)
{
return list_entry(evsel->node.prev, struct perf_evsel, node);
}
/** /**
* perf_evsel__is_group_leader - Return whether given evsel is a leader event * perf_evsel__is_group_leader - Return whether given evsel is a leader event
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment