Re: [PATCH -next 4/5] perf: Remove unused macros __PERF_EVENT_FIELD

From: Arnaldo Carvalho de Melo
Date: Mon Sep 26 2022 - 15:48:42 EST


Em Mon, Sep 26, 2022 at 11:14:39AM +0800, Chen Zhongjin escreveu:
> Unused macros reported by [-Wunused-macros].
>
> This macros were introduced as __PERF_COUNTER_FIELD and used for
> reading the bit in config.
>
> 'cdd6c482c9ff ("perf: Do the big rename: Performance Counters -> Performance Events")'
> Changes it to __PERF_EVENT_FIELD but at this commit there is already
> nowhere else using these macros, also no macros called
> PERF_EVENT_##name##_MASK/SHIFT.
>
> Now we are not reading type or id from config. These macros are
> useless and incomplete.
>
> So removing them for code cleaning.

Thanks, applied.

- Arnaldo


> Signed-off-by: Chen Zhongjin <chenzhongjin@xxxxxxxxxx>
> ---
> tools/perf/util/parse-events.c | 8 --------
> 1 file changed, 8 deletions(-)
>
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index f05e15acd33f..3ed914882b96 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -149,14 +149,6 @@ struct event_symbol event_symbols_sw[PERF_COUNT_SW_MAX] = {
> },
> };
>
> -#define __PERF_EVENT_FIELD(config, name) \
> - ((config & PERF_EVENT_##name##_MASK) >> PERF_EVENT_##name##_SHIFT)
> -
> -#define PERF_EVENT_RAW(config) __PERF_EVENT_FIELD(config, RAW)
> -#define PERF_EVENT_CONFIG(config) __PERF_EVENT_FIELD(config, CONFIG)
> -#define PERF_EVENT_TYPE(config) __PERF_EVENT_FIELD(config, TYPE)
> -#define PERF_EVENT_ID(config) __PERF_EVENT_FIELD(config, EVENT)
> -
> const char *event_type(int type)
> {
> switch (type) {
> --
> 2.17.1

--

- Arnaldo