perf parse-events: Inline parse_events_update_lists
The helper function just wraps a splice and free. Making the free inline removes a comment, so then it just wraps a splice which we can make inline too. Signed-off-by: Ian Rogers <irogers@google.com> Reviewed-by: Kan Liang <kan.liang@linux.intel.com> Tested-by: Atish Patra <atishp@rivosinc.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Beeman Strong <beeman@rivosinc.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> Link: https://lore.kernel.org/r/20240416061533.921723-11-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
617824a7f0
commit
4e5484b4bf
@ -1720,19 +1720,6 @@ void parse_events__set_leader(char *name, struct list_head *list)
|
||||
leader->group_name = name;
|
||||
}
|
||||
|
||||
/* list_event is assumed to point to malloc'ed memory */
|
||||
void parse_events_update_lists(struct list_head *list_event,
|
||||
struct list_head *list_all)
|
||||
{
|
||||
/*
|
||||
* Called for single event definition. Update the
|
||||
* 'all event' list, and reinit the 'single event'
|
||||
* list, for next event definition.
|
||||
*/
|
||||
list_splice_tail(list_event, list_all);
|
||||
free(list_event);
|
||||
}
|
||||
|
||||
struct event_modifier {
|
||||
int eu;
|
||||
int ek;
|
||||
|
||||
@ -226,8 +226,6 @@ int parse_events_multi_pmu_add_or_add_pmu(struct parse_events_state *parse_state
|
||||
void *loc_);
|
||||
|
||||
void parse_events__set_leader(char *name, struct list_head *list);
|
||||
void parse_events_update_lists(struct list_head *list_event,
|
||||
struct list_head *list_all);
|
||||
void parse_events_evlist_error(struct parse_events_state *parse_state,
|
||||
int idx, const char *str);
|
||||
|
||||
|
||||
@ -125,6 +125,10 @@ static void free_list_evsel(struct list_head* list_evsel)
|
||||
}
|
||||
%%
|
||||
|
||||
/*
|
||||
* Entry points. We are either parsing events or terminals. Just terminal
|
||||
* parsing is used for parsing events in sysfs.
|
||||
*/
|
||||
start:
|
||||
PE_START_EVENTS start_events
|
||||
|
|
||||
@ -132,31 +136,36 @@ PE_START_TERMS start_terms
|
||||
|
||||
start_events: groups
|
||||
{
|
||||
/* Take the parsed events, groups.. and place into parse_state. */
|
||||
struct list_head *groups = $1;
|
||||
struct parse_events_state *parse_state = _parse_state;
|
||||
|
||||
/* frees $1 */
|
||||
parse_events_update_lists($1, &parse_state->list);
|
||||
list_splice_tail(groups, &parse_state->list);
|
||||
free(groups);
|
||||
}
|
||||
|
||||
groups:
|
||||
groups: /* A list of groups or events. */
|
||||
groups ',' group
|
||||
{
|
||||
struct list_head *list = $1;
|
||||
struct list_head *group = $3;
|
||||
/* Merge group into the list of events/groups. */
|
||||
struct list_head *groups = $1;
|
||||
struct list_head *group = $3;
|
||||
|
||||
/* frees $3 */
|
||||
parse_events_update_lists(group, list);
|
||||
$$ = list;
|
||||
list_splice_tail(group, groups);
|
||||
free(group);
|
||||
$$ = groups;
|
||||
}
|
||||
|
|
||||
groups ',' event
|
||||
{
|
||||
struct list_head *list = $1;
|
||||
/* Merge event into the list of events/groups. */
|
||||
struct list_head *groups = $1;
|
||||
struct list_head *event = $3;
|
||||
|
||||
/* frees $3 */
|
||||
parse_events_update_lists(event, list);
|
||||
$$ = list;
|
||||
|
||||
list_splice_tail(event, groups);
|
||||
free(event);
|
||||
$$ = groups;
|
||||
}
|
||||
|
|
||||
group
|
||||
@ -206,12 +215,12 @@ PE_NAME '{' events '}'
|
||||
events:
|
||||
events ',' event
|
||||
{
|
||||
struct list_head *events = $1;
|
||||
struct list_head *event = $3;
|
||||
struct list_head *list = $1;
|
||||
|
||||
/* frees $3 */
|
||||
parse_events_update_lists(event, list);
|
||||
$$ = list;
|
||||
list_splice_tail(event, events);
|
||||
free(event);
|
||||
$$ = events;
|
||||
}
|
||||
|
|
||||
event
|
||||
|
||||
Loading…
Reference in New Issue
Block a user