On Fri, Mar 28, 2025 at 07:50:11AM -0600, Gustavo A. R. Silva wrote:
> +union cros_ec_sleep_data {
> +     struct ec_params_host_sleep_event req0;
> +     struct ec_params_host_sleep_event_v1 req1;
> +     struct ec_response_host_sleep_event_v1 resp1;
> +} __packed;

The __packed modifier seems redundant.

>  static int cros_ec_sleep_event(struct cros_ec_device *ec_dev, u8 sleep_event)
>  {
>       int ret;
> -     struct {
> -             struct cros_ec_command msg;
> -             union {
> -                     struct ec_params_host_sleep_event req0;
> -                     struct ec_params_host_sleep_event_v1 req1;
> -                     struct ec_response_host_sleep_event_v1 resp1;
> -             } u;
> -     } __packed buf;
> +     DEFINE_RAW_FLEX(struct cros_ec_command, msg, data,
> +                     sizeof(union cros_ec_sleep_data));

Is it possible to use something similar to:

MAX(MAX(sizeof(A), sizeof(B)),
    sizeof(C))

so that the union doesn't need to be defined?

Reply via email to