platform/chrome: cros_ec_proto: avoid -Wflex-array-member-not-at-end warnings
authorGustavo A. R. Silva <gustavoars@kernel.org>
Tue, 26 Mar 2024 18:55:10 +0000 (12:55 -0600)
committerTzung-Bi Shih <tzungbi@kernel.org>
Wed, 24 Apr 2024 08:45:56 +0000 (16:45 +0800)
commit41f4bc61fc2e9cda6b2cf18a8efea5b39343d0a4
treeb3cc53b79f2f5ba315b0caabdfbbda32ba22c0cc
parent48e49af7108b6e0d014a08650c41470f812e44bc
platform/chrome: cros_ec_proto: avoid -Wflex-array-member-not-at-end warnings

Use the `DEFINE_RAW_FLEX()` helper for an on-stack definition of
a flexible structure where the size of the flexible-array member
is known at compile-time, and refactor the rest of the code,
accordingly.

So, with these changes, fix the following warning:
drivers/platform/chrome/cros_ec_proto_test.c:1547:40: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/platform/chrome/cros_ec_proto_test.c:1607:40: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/platform/chrome/cros_ec_proto_test.c:1645:40: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/platform/chrome/cros_ec_proto_test.c:1668:40: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Link: https://github.com/KSPP/linux/issues/202
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/ZgMaDl/of8YC445S@neat
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
drivers/platform/chrome/cros_ec_proto_test.c