Commit 330f40a0 authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

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: default avatarIan Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230406235256.2768773-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 222de5e5
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment