Skip to content

Commit b2661df

Browse files
GustavoARSilvalag-linaro
authored andcommitted
leds: leds-cros_ec: Avoid -Wflex-array-member-not-at-end warning
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally. Replace an on-stack definition of a flexible structure with a call to utility function cros_ec_cmd(). So, with these changes, fix the following warning: drivers/leds/leds-cros_ec.c:70:40: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: "Gustavo A. R. Silva" <[email protected]> Acked-by: Thomas Weißschuh <[email protected]> Link: https://lore.kernel.org/r/Z-rKcgFjsyKvd58q@kspp Signed-off-by: Lee Jones <[email protected]>
1 parent ca72d5e commit b2661df

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

drivers/leds/leds-cros_ec.c

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,31 +60,18 @@ static inline struct cros_ec_led_priv *cros_ec_led_cdev_to_priv(struct led_class
6060
union cros_ec_led_cmd_data {
6161
struct ec_params_led_control req;
6262
struct ec_response_led_control resp;
63-
} __packed;
63+
};
6464

6565
static int cros_ec_led_send_cmd(struct cros_ec_device *cros_ec,
6666
union cros_ec_led_cmd_data *arg)
6767
{
6868
int ret;
69-
struct {
70-
struct cros_ec_command msg;
71-
union cros_ec_led_cmd_data data;
72-
} __packed buf = {
73-
.msg = {
74-
.version = 1,
75-
.command = EC_CMD_LED_CONTROL,
76-
.insize = sizeof(arg->resp),
77-
.outsize = sizeof(arg->req),
78-
},
79-
.data.req = arg->req
80-
};
81-
82-
ret = cros_ec_cmd_xfer_status(cros_ec, &buf.msg);
69+
70+
ret = cros_ec_cmd(cros_ec, 1, EC_CMD_LED_CONTROL, &arg->req,
71+
sizeof(arg->req), &arg->resp, sizeof(arg->resp));
8372
if (ret < 0)
8473
return ret;
8574

86-
arg->resp = buf.data.resp;
87-
8875
return 0;
8976
}
9077

0 commit comments

Comments
 (0)