[PATCH v3 10/25] perf lock: Constify trace_lock_handler variables

Ian Rogers
2026-03-20T08:09:01Z

Structs don't change and so constify.

Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/builtin-lock.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index 78fb39d06e7c..735e6bb234ae 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -1179,7 +1179,7 @@ static int report_lock_contention_end_event(struct perf_sample *sample)

/* lock oriented handlers */
/* TODO: handlers for CPU oriented, thread oriented */
-static struct trace_lock_handler report_lock_ops = {
+static const struct trace_lock_handler report_lock_ops = {
.acquire_event = report_lock_acquire_event,
.acquired_event = report_lock_acquired_event,
.contended_event = report_lock_contended_event,
@@ -1188,13 +1188,13 @@ static struct trace_lock_handler report_lock_ops = {
.contention_end_event = report_lock_contention_end_event,
};

-static struct trace_lock_handler contention_lock_ops = {
+static const struct trace_lock_handler contention_lock_ops = {
.contention_begin_event = report_lock_contention_begin_event,
.contention_end_event = report_lock_contention_end_event,
};

-static struct trace_lock_handler *trace_handler;
+static const struct trace_lock_handler *trace_handler;

static int evsel__process_lock_acquire(struct perf_sample *sample)
{
--
2.53.0.959.g497ff81fa9-goog