Skip to content

Commit

Permalink
perf pmu: Const-ify perf_pmu__config_terms
Browse files Browse the repository at this point in the history
Add const to related APIs, this is so they can be used to default
initialize a perf_event_attr from a const pmu.

Signed-off-by: Ian Rogers <[email protected]>
Reviewed-by: Adrian Hunter <[email protected]>
Cc: Ravi Bangoria <[email protected]>
Cc: James Clark <[email protected]>
Cc: Suzuki K Poulose <[email protected]>
Cc: Yang Jihong <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Leo Yan <[email protected]>
Cc: Mike Leach <[email protected]>
Cc: Jing Zhang <[email protected]>
Cc: Kajol Jain <[email protected]>
Cc: Thomas Richter <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: John Garry <[email protected]>
Cc: [email protected]
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Namhyung Kim <[email protected]>
  • Loading branch information
captain5050 authored and namhyung committed Oct 17, 2023
1 parent 3a42f4c commit 63883cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions tools/perf/util/pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static void __perf_pmu_format__load(struct perf_pmu_format *format, FILE *file)
format->loaded = true;
}

static void perf_pmu_format__load(struct perf_pmu *pmu, struct perf_pmu_format *format)
static void perf_pmu_format__load(const struct perf_pmu *pmu, struct perf_pmu_format *format)
{
char path[PATH_MAX];
FILE *file = NULL;
Expand Down Expand Up @@ -1131,7 +1131,7 @@ void evsel__set_config_if_unset(struct perf_pmu *pmu, struct evsel *evsel,
}

static struct perf_pmu_format *
pmu_find_format(struct list_head *formats, const char *name)
pmu_find_format(const struct list_head *formats, const char *name)
{
struct perf_pmu_format *format;

Expand Down Expand Up @@ -1229,7 +1229,7 @@ static int pmu_resolve_param_term(struct parse_events_term *term,
return -1;
}

static char *pmu_formats_string(struct list_head *formats)
static char *pmu_formats_string(const struct list_head *formats)
{
struct perf_pmu_format *format;
char *str = NULL;
Expand All @@ -1255,7 +1255,7 @@ static char *pmu_formats_string(struct list_head *formats)
* Setup one of config[12] attr members based on the
* user input data - term parameter.
*/
static int pmu_config_term(struct perf_pmu *pmu,
static int pmu_config_term(const struct perf_pmu *pmu,
struct perf_event_attr *attr,
struct parse_events_term *term,
struct parse_events_terms *head_terms,
Expand Down Expand Up @@ -1378,7 +1378,7 @@ static int pmu_config_term(struct perf_pmu *pmu,
return 0;
}

int perf_pmu__config_terms(struct perf_pmu *pmu,
int perf_pmu__config_terms(const struct perf_pmu *pmu,
struct perf_event_attr *attr,
struct parse_events_terms *terms,
bool zero, struct parse_events_error *err)
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/pmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ void pmu_add_sys_aliases(struct perf_pmu *pmu);
int perf_pmu__config(struct perf_pmu *pmu, struct perf_event_attr *attr,
struct parse_events_terms *head_terms,
struct parse_events_error *error);
int perf_pmu__config_terms(struct perf_pmu *pmu,
int perf_pmu__config_terms(const struct perf_pmu *pmu,
struct perf_event_attr *attr,
struct parse_events_terms *terms,
bool zero, struct parse_events_error *error);
Expand Down

0 comments on commit 63883cb

Please sign in to comment.