Commit 30f29bae authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo
Browse files

perf tool: Constify tool pointers



The tool pointer (to a struct largely of function pointers) is passed
around but is unchanged except at initialization. Change parameter and
variable types to be const to lower the possibilities of what could
happen with a tool.

Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Tested-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Tested-by: default avatarLeo Yan <leo.yan@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ilkka Koskinen <ilkka@os.amperecomputing.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Jonathan Cameron <jonathan.cameron@huawei.com>
Cc: Kan Liang <kan.liang@linux.intel.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: Nick Desaulniers <ndesaulniers@google.com>
Cc: Nick Terrell <terrelln@fb.com>
Cc: Oliver Upton <oliver.upton@linux.dev>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <song@kernel.org>
Cc: Sun Haiyong <sunhaiyong@loongson.cn>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Yanteng Si <siyanteng@loongson.cn>
Cc: Yicong Yang <yangyicong@hisilicon.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20240812204720.631678-4-irogers@google.com


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 1816dc4b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
#if defined(__x86_64__)

struct perf_event__synthesize_extra_kmaps_cb_args {
	struct perf_tool *tool;
	const struct perf_tool *tool;
	perf_event__handler_t process;
	struct machine *machine;
	union perf_event *event;
@@ -65,7 +65,7 @@ static int perf_event__synthesize_extra_kmaps_cb(struct map *map, void *data)
	return 0;
}

int perf_event__synthesize_extra_kmaps(struct perf_tool *tool,
int perf_event__synthesize_extra_kmaps(const struct perf_tool *tool,
				       perf_event__handler_t process,
				       struct machine *machine)
{
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ static const char *const bench_usage[] = {

static atomic_t event_count;

static int process_synthesized_event(struct perf_tool *tool __maybe_unused,
static int process_synthesized_event(const struct perf_tool *tool __maybe_unused,
				     union perf_event *event __maybe_unused,
				     struct perf_sample *sample __maybe_unused,
				     struct machine *machine __maybe_unused)
+1 −1
Original line number Diff line number Diff line
@@ -279,7 +279,7 @@ static int evsel__add_sample(struct evsel *evsel, struct perf_sample *sample,
	return ret;
}

static int process_sample_event(struct perf_tool *tool,
static int process_sample_event(const struct perf_tool *tool,
				union perf_event *event,
				struct perf_sample *sample,
				struct evsel *evsel,
+1 −1
Original line number Diff line number Diff line
@@ -273,7 +273,7 @@ static void compute_stats(struct c2c_hist_entry *c2c_he,
		update_stats(&cstats->load, weight);
}

static int process_sample_event(struct perf_tool *tool __maybe_unused,
static int process_sample_event(const struct perf_tool *tool __maybe_unused,
				union perf_event *event,
				struct perf_sample *sample,
				struct evsel *evsel,
+1 −1
Original line number Diff line number Diff line
@@ -388,7 +388,7 @@ struct hist_entry_ops block_hist_ops = {
	.free   = block_hist_free,
};

static int diff__process_sample_event(struct perf_tool *tool,
static int diff__process_sample_event(const struct perf_tool *tool,
				      union perf_event *event,
				      struct perf_sample *sample,
				      struct evsel *evsel,
Loading