diff options
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 2 | ||||
-rw-r--r-- | tools/perf/util/evsel.h | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 089fd3713783..a440e03cd8c2 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c @@ -1855,7 +1855,7 @@ browse_hists: if (pos->node.prev == &evlist->entries) pos = perf_evlist__last(evlist); else - pos = list_entry(pos->node.prev, struct perf_evsel, node); + pos = perf_evsel__prev(pos); goto browse_hists; case K_ESC: if (!ui_browser__dialog_yesno(&menu->b, diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index f5029653dcd7..1ea7c92e6e33 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -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); } +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 * |