From: Ian Rogers Date: Wed, 20 May 2026 19:05:28 +0000 (-0700) Subject: perf lock: Constify trace_lock_handler variables X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9890b403d49eb6caf2d58224ade744aa06646260;p=thirdparty%2Fkernel%2Fstable.git perf lock: Constify trace_lock_handler variables Constify the static trace_lock_handler structures. Since the trace lock handler callbacks and definitions do not change at runtime, declare them const to enforce read-only memory placement and improve safety. Signed-off-by: Ian Rogers Acked-by: Namhyung Kim Cc: Adrian Hunter Cc: Albert Ou Cc: Alexander Shishkin Cc: Alexandre Ghiti Cc: Andi Kleen Cc: Andrew Jones Cc: Anup Patel Cc: Athira Rajeev Cc: Blake Jones Cc: Chen Ni Cc: Chun-Tse Shao Cc: Dapeng Mi Cc: Derek Foreman Cc: Dmitriy Vyukov Cc: Dr. David Alan Gilbert Cc: Howard Chu Cc: Hrishikesh Suresh Cc: Ingo Molnar Cc: James Clark Cc: Jiri Olsa Cc: Krzysztof Ɓopatowski Cc: Leo Yan Cc: Palmer Dabbelt Cc: Paul Walmsley Cc: Peter Zijlstra Cc: Quan Zhou Cc: Ravi Bangoria Cc: Swapnil Sapkal Cc: Thomas Falcon Cc: Tianyou Li Cc: Yujie Liu Cc: tanze Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index b6533483ba64..89a40d385b27 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c @@ -1179,7 +1179,7 @@ end: /* 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) {