From 330f40a0d951d7f23995ccbfeea9be7282942e93 Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Thu, 6 Apr 2023 16:52:54 -0700 Subject: [PATCH] perf pmu: Fewer const casts struct pmu_event has const char*s, only unit needs to be non-const for the sake of passing as an out argument to strtod(). Reduce the const casts from 4 down to 1. Signed-off-by: Ian Rogers Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Ingo Molnar Cc: James Clark Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Ravi Bangoria Cc: Rob Herring Cc: Sean Christopherson Cc: Suzuki Poulouse Link: https://lore.kernel.org/r/20230406235256.2768773-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/pmu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 9eedbfc9e863a..d033343f75f93 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -352,16 +352,16 @@ static int __perf_pmu__new_alias(struct list_head *list, int dirfd, char *name, struct perf_pmu_alias *alias; int ret; char newval[256]; - char *long_desc = NULL, *topic = NULL, *unit = NULL, *pmu_name = NULL; + const char *long_desc = NULL, *topic = NULL, *unit = NULL, *pmu_name = NULL; bool deprecated = false, perpkg = false; if (pe) { - long_desc = (char *)pe->long_desc; - topic = (char *)pe->topic; - unit = (char *)pe->unit; + long_desc = pe->long_desc; + topic = pe->topic; + unit = pe->unit; perpkg = pe->perpkg; deprecated = pe->deprecated; - pmu_name = (char *)pe->pmu; + pmu_name = pe->pmu; } alias = malloc(sizeof(*alias)); @@ -419,7 +419,7 @@ static int __perf_pmu__new_alias(struct list_head *list, int dirfd, char *name, desc ? strdup(desc) : NULL; alias->topic = topic ? strdup(topic) : NULL; if (unit) { - if (perf_pmu__convert_scale(unit, &unit, &alias->scale) < 0) + if (perf_pmu__convert_scale(unit, (char **)&unit, &alias->scale) < 0) return -1; snprintf(alias->unit, sizeof(alias->unit), "%s", unit); } -- 2.30.2