]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf evsel: Refactor evsel__set_config_if_unset() arguments
authorJames Clark <james.clark@linaro.org>
Wed, 14 Jan 2026 15:57:14 +0000 (15:57 +0000)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 15 Jan 2026 02:13:56 +0000 (23:13 -0300)
Make the evsel argument first to match the other evsel__* functions
and remove the redundant pmu argument, which can be accessed via evsel.

Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/arch/arm/util/cs-etm.c
tools/perf/arch/arm64/util/arm-spe.c
tools/perf/arch/x86/util/intel-pt.c
tools/perf/util/evsel.h
tools/perf/util/pmu.c

index ea891d12f8f40beebf8dee1d3db71cad701f5666..c28208361d918a56597d1cbf957ede16fb73fd17 100644 (file)
@@ -441,10 +441,8 @@ static int cs_etm_recording_options(struct auxtrace_record *itr,
         * when a context switch happened.
         */
        if (!perf_cpu_map__is_any_cpu_or_is_empty(cpus)) {
-               evsel__set_config_if_unset(cs_etm_pmu, cs_etm_evsel,
-                                          "timestamp", 1);
-               evsel__set_config_if_unset(cs_etm_pmu, cs_etm_evsel,
-                                          "contextid", 1);
+               evsel__set_config_if_unset(cs_etm_evsel, "timestamp", 1);
+               evsel__set_config_if_unset(cs_etm_evsel, "contextid", 1);
        }
 
        /*
@@ -453,8 +451,7 @@ static int cs_etm_recording_options(struct auxtrace_record *itr,
         * timestamp tracing.
         */
        if (opts->sample_time_set)
-               evsel__set_config_if_unset(cs_etm_pmu, cs_etm_evsel,
-                                          "timestamp", 1);
+               evsel__set_config_if_unset(cs_etm_evsel, "timestamp", 1);
 
        /* Add dummy event to keep tracking */
        err = parse_event(evlist, "dummy:u");
index d5ec1408d0aec7e0d39a2cae7ad73694950ab67b..51014f8bff97a8d434eb706de6c8f92d83915e28 100644 (file)
@@ -274,7 +274,7 @@ static void arm_spe_setup_evsel(struct evsel *evsel, struct perf_cpu_map *cpus)
         */
        if (!perf_cpu_map__is_any_cpu_or_is_empty(cpus)) {
                evsel__set_sample_bit(evsel, CPU);
-               evsel__set_config_if_unset(evsel->pmu, evsel, "ts_enable", 1);
+               evsel__set_config_if_unset(evsel, "ts_enable", 1);
        }
 
        /*
index b394ad9cc635b8a00dd7e342bbf9086193f2a92c..c131a727774fc190627444bbecf78993c9cffb1f 100644 (file)
@@ -664,8 +664,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
                return 0;
 
        if (opts->auxtrace_sample_mode)
-               evsel__set_config_if_unset(intel_pt_pmu, intel_pt_evsel,
-                                          "psb_period", 0);
+               evsel__set_config_if_unset(intel_pt_evsel, "psb_period", 0);
 
        err = intel_pt_validate_config(intel_pt_pmu, intel_pt_evsel);
        if (err)
index a08130ff2e47a887b19f6c47bfa9f51e0c40d226..2cf87bc67df7b4ed22d0fd796f9aff80b17afffa 100644 (file)
@@ -575,8 +575,8 @@ void evsel__uniquify_counter(struct evsel *counter);
        ((((src) >> (pos)) & ((1ull << (size)) - 1)) << (63 - ((pos) + (size) - 1)))
 
 u64 evsel__bitfield_swap_branch_flags(u64 value);
-void evsel__set_config_if_unset(struct perf_pmu *pmu, struct evsel *evsel,
-                               const char *config_name, u64 val);
+void evsel__set_config_if_unset(struct evsel *evsel, const char *config_name,
+                               u64 val);
 
 bool evsel__is_offcpu_event(struct evsel *evsel);
 
index 956ea273c2c7805c0cb504fb7dcf996f79f5588d..e87c12946d71a352edb980684c4c7133a7d08eb8 100644 (file)
@@ -1382,8 +1382,8 @@ bool evsel__is_aux_event(const struct evsel *evsel)
  * something to true, pass 1 for val rather than a pre shifted value.
  */
 #define field_prep(_mask, _val) (((_val) << (ffsll(_mask) - 1)) & (_mask))
-void evsel__set_config_if_unset(struct perf_pmu *pmu, struct evsel *evsel,
-                               const char *config_name, u64 val)
+void evsel__set_config_if_unset(struct evsel *evsel, const char *config_name,
+                               u64 val)
 {
        u64 user_bits = 0, bits;
        struct evsel_config_term *term = evsel__get_config_term(evsel, CFG_CHG);
@@ -1391,7 +1391,7 @@ void evsel__set_config_if_unset(struct perf_pmu *pmu, struct evsel *evsel,
        if (term)
                user_bits = term->val.cfg_chg;
 
-       bits = perf_pmu__format_bits(pmu, config_name);
+       bits = perf_pmu__format_bits(evsel->pmu, config_name);
 
        /* Do nothing if the user changed the value */
        if (bits & user_bits)