Skip to content

Commit d4d2dc1

Browse files
GustavoARSilvasre
authored andcommitted
power: supply: cros_charge-control: 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/power/supply/cros_charge-control.c:57: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/aBEwnKtUOTYzS7C3@kspp Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 18672fe commit d4d2dc1

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

drivers/power/supply/cros_charge-control.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,29 +47,20 @@ struct cros_chctl_priv {
4747
static int cros_chctl_send_charge_control_cmd(struct cros_ec_device *cros_ec,
4848
u8 cmd_version, struct ec_params_charge_control *req)
4949
{
50+
int ret;
5051
static const u8 outsizes[] = {
5152
[1] = offsetof(struct ec_params_charge_control, cmd),
5253
[2] = sizeof(struct ec_params_charge_control),
5354
[3] = sizeof(struct ec_params_charge_control),
5455
};
5556

56-
struct {
57-
struct cros_ec_command msg;
58-
union {
59-
struct ec_params_charge_control req;
60-
struct ec_response_charge_control resp;
61-
} __packed data;
62-
} __packed buf = {
63-
.msg = {
64-
.command = EC_CMD_CHARGE_CONTROL,
65-
.version = cmd_version,
66-
.insize = 0,
67-
.outsize = outsizes[cmd_version],
68-
},
69-
.data.req = *req,
70-
};
57+
ret = cros_ec_cmd(cros_ec, cmd_version, EC_CMD_CHARGE_CONTROL, req,
58+
outsizes[cmd_version], NULL, 0);
59+
60+
if (ret < 0)
61+
return ret;
7162

72-
return cros_ec_cmd_xfer_status(cros_ec, &buf.msg);
63+
return 0;
7364
}
7465

7566
static int cros_chctl_configure_ec(struct cros_chctl_priv *priv)

0 commit comments

Comments
 (0)