Re: [PATCH v2] chrome/platform: cros_ec_proto:: Add trace event to trace EC commands

Raul Rangel
2019-04-12T19:48:00Z

On Fri, Apr 12, 2019 at 03:04:38PM -0400, Steven Rostedt wrote:
> On Fri, 12 Apr 2019 12:49:44 -0600
> Raul E Rangel <rrangel@chromium.org> wrote:
>
> > +#define ec_cmds \
> > + {EC_CMD_PROTO_VERSION, "PROTO_VERSION"}, \
> > + {EC_CMD_HELLO, "HELLO"}, \
> > + {EC_CMD_GET_VERSION, "GET_VERSION"}, \
> > + {EC_CMD_READ_TEST, "READ_TEST"}, \
> > + {EC_CMD_GET_BUILD_INFO, "GET_BUILD_INFO"}, \
> > + {EC_CMD_GET_CHIP_INFO, "GET_CHIP_INFO"}, \
> > + {EC_CMD_GET_BOARD_VERSION, "GET_BOARD_VERSION"}, \
> > + {EC_CMD_READ_MEMMAP, "READ_MEMMAP"}, \
> > + {EC_CMD_GET_CMD_VERSIONS, "GET_CMD_VERSIONS"}, \
> > + {EC_CMD_GET_COMMS_STATUS, "GET_COMMS_STATUS"}, \
> > + {EC_CMD_TEST_PROTOCOL, "TEST_PROTOCOL"}, \
> > + {EC_CMD_GET_PROTOCOL_INFO, "GET_PROTOCOL_INFO"}, \
> > + {EC_CMD_GSV_PAUSE_IN_S5, "GSV_PAUSE_IN_S5"}, \
> > + {EC_CMD_GET_FEATURES, "GET_FEATURES"}, \
>
> Usually, if I have something like this, I would do:
>
>
> #define ec_cmds \
> EC(PROTO_VERSION), \
> EC(HELLO), \
> EC(GET_VERSION), \
> EC(READ_TEST), \
> [...]
>
> Then:
>
> #define EC(a) {EC_CMD_##a, #a}
>
> and then ec_cmds ends up with the same result with much less typing and
> little risk for copy past errors.
I generally don't like doing that because it breaks my editors Goto
Definition, but I can send out a patch that uses the macro.

Thanks,
Raul
>
> -- Steve