mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
libperf evsel: Factor perf_evsel__exit out of perf_evsel__delete
This allows the perf_evsel__exit to be called when the struct perf_evsel is embedded inside another struct, such as struct evsel in perf. Reviewed-by: Thomas Falcon <thomas.falcon@intel.com> Signed-off-by: Ian Rogers <irogers@google.com> Tested-by: James Clark <james.clark@linaro.org> Link: https://lore.kernel.org/r/20250719030517.1990983-8-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
@@ -40,7 +40,7 @@ struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr)
|
||||
return evsel;
|
||||
}
|
||||
|
||||
void perf_evsel__delete(struct perf_evsel *evsel)
|
||||
void perf_evsel__exit(struct perf_evsel *evsel)
|
||||
{
|
||||
assert(evsel->fd == NULL); /* If not fds were not closed. */
|
||||
assert(evsel->mmap == NULL); /* If not munmap wasn't called. */
|
||||
@@ -48,6 +48,11 @@ void perf_evsel__delete(struct perf_evsel *evsel)
|
||||
perf_cpu_map__put(evsel->cpus);
|
||||
perf_cpu_map__put(evsel->pmu_cpus);
|
||||
perf_thread_map__put(evsel->threads);
|
||||
}
|
||||
|
||||
void perf_evsel__delete(struct perf_evsel *evsel)
|
||||
{
|
||||
perf_evsel__exit(evsel);
|
||||
free(evsel);
|
||||
}
|
||||
|
||||
|
||||
@@ -133,6 +133,7 @@ struct perf_evsel {
|
||||
|
||||
void perf_evsel__init(struct perf_evsel *evsel, struct perf_event_attr *attr,
|
||||
int idx);
|
||||
void perf_evsel__exit(struct perf_evsel *evsel);
|
||||
int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads);
|
||||
void perf_evsel__close_fd(struct perf_evsel *evsel);
|
||||
void perf_evsel__free_fd(struct perf_evsel *evsel);
|
||||
|
||||
Reference in New Issue
Block a user