perf pmu: Avoid passing format list to perf_pmu__format_type
authorIan Rogers <irogers@google.com>
Wed, 23 Aug 2023 08:08:09 +0000 (01:08 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 23 Aug 2023 11:50:08 +0000 (08:50 -0300)
Pass the pmu so the format list can be better abstracted and later
lazily loaded.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Gaosheng Cui <cuigaosheng1@huawei.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230823080828.1460376-7-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/parse-events.c
tools/perf/util/pmu.c
tools/perf/util/pmu.h

index 00a8ec94f5b28d9d29fef0ddc25ea1f3bc67970c..8ede27089766cc64246fe9c4b1f3a26463f2c70d 100644 (file)
@@ -1159,7 +1159,7 @@ static int get_config_chgs(struct perf_pmu *pmu, struct list_head *head_config,
        list_for_each_entry(term, head_config, list) {
                switch (term->type_term) {
                case PARSE_EVENTS__TERM_TYPE_USER:
-                       type = perf_pmu__format_type(&pmu->format, term->config);
+                       type = perf_pmu__format_type(pmu, term->config);
                        if (type != PERF_PMU_FORMAT_VALUE_CONFIG)
                                continue;
                        bits |= perf_pmu__format_bits(&pmu->format, term->config);
index 89573a8eaf0b823bcb15322dddc090f116c479c5..96189afe54b07663926e240cc4c7daba4816f691 100644 (file)
@@ -1038,9 +1038,9 @@ __u64 perf_pmu__format_bits(struct list_head *formats, const char *name)
        return bits;
 }
 
-int perf_pmu__format_type(struct list_head *formats, const char *name)
+int perf_pmu__format_type(struct perf_pmu *pmu, const char *name)
 {
-       struct perf_pmu_format *format = pmu_find_format(formats, name);
+       struct perf_pmu_format *format = pmu_find_format(&pmu->format, name);
 
        if (!format)
                return -1;
index eb26c8bc079f7b7f75f626db595ddd09045e8232..1ea78d2fa5319ce850c5bd0bc409d02f327cebbf 100644 (file)
@@ -222,7 +222,7 @@ int perf_pmu__config_terms(struct perf_pmu *pmu,
                           struct list_head *head_terms,
                           bool zero, struct parse_events_error *error);
 __u64 perf_pmu__format_bits(struct list_head *formats, const char *name);
-int perf_pmu__format_type(struct list_head *formats, const char *name);
+int perf_pmu__format_type(struct perf_pmu *pmu, const char *name);
 int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms,
                          struct perf_pmu_info *info);
 struct list_head *perf_pmu__alias(struct perf_pmu *pmu,