From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Rob Barnes <robbarnes@google.com>
Cc: bleung@chromium.org, tomhughes@chromium.org,
chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] platform/chrome: cros_ec_proto: Fix deferred response
Date: Fri, 28 Aug 2026 05:31:00 +0000 [thread overview]
Message-ID: <apEdFK5rxLL1cXi2@google.com> (raw)
In-Reply-To: <20260827180511.2825660-1-robbarnes@google.com>
On Thu, Aug 27, 2026 at 12:05:11PM -0600, Rob Barnes wrote:
> - Send patch using git-send-email via Google Mail Relay to prevent MTA line-wrapping (Tzung-Bi).
The patch can be applied via `git am` after the fixing. However, KUnit test
emits errors after applying the patch:
$ ./tools/testing/kunit/kunit.py run \
--arch=x86_64 \
--kconfig_add CONFIG_CHROME_PLATFORMS=y \
--kconfig_add CONFIG_CROS_EC=y \
cros_ec*
> diff --git a/drivers/platform/chrome/cros_ec_proto_test.c b/drivers/platform/chrome/cros_ec_proto_test.c
...
> +static void cros_ec_proto_test_cmd_xfer_in_progress_payload_4bytes(struct kunit *test)
> +{
> + struct cros_ec_proto_test_priv *priv = test->priv;
> + struct cros_ec_device *ec_dev = &priv->ec_dev;
> + struct ec_xfer_mock *mock;
> + u8 resp_data[4] = {0x11, 0x22, 0x33, 0x44};
> + struct {
> + struct cros_ec_command msg;
> + u8 data[4];
> + } buf;
> + struct cros_ec_command *msg = &buf.msg;
> + int ret;
> +
> + memset(&buf, 0, sizeof(buf));
> + msg->version = 1;
> + msg->command = 0x1234;
> + msg->outsize = 2;
It needs to set `ec_dev->max_request` before it can send the payload. Given
the test doesn't verify the output payload, just removing the assignment of
`msg->outsize` and using default value 0 could be the simplest fix.
Otherwise:
cros_ec_proto_test: request of size 2 is too big (max: 0)
# cros_ec_proto_test_cmd_xfer_in_progress_payload_4bytes:
Expected ret == 4, but
ret == -90 (0xffffffffffffffa6)
> + msg->insize = sizeof(buf.data);
Similar here, it needs to set `ec_dev->max_response` before it can receive
payload (cros_ec_cmd_xfer() clamps it). Otherwise:
# cros_ec_proto_test_cmd_xfer_in_progress_payload_4bytes:
Expected msg->insize == sizeof(buf.data), but
msg->insize == 0 (0x0)
sizeof(buf.data) == 4 (0x4)
> + ret = cros_ec_cmd_xfer(ec_dev, msg);
> + KUNIT_EXPECT_EQ(test, ret, 4);
> + KUNIT_EXPECT_EQ(test, msg->result, EC_RES_SUCCESS);
> + KUNIT_EXPECT_EQ(test, msg->command, 0x1234);
> + KUNIT_EXPECT_EQ(test, msg->outsize, 2);
Following the above suggestion, this needs to be dropped.
> +static void cros_ec_proto_test_cmd_xfer_in_progress_payload_gt4bytes(struct kunit *test)
> +{
> + struct cros_ec_proto_test_priv *priv = test->priv;
> + struct cros_ec_device *ec_dev = &priv->ec_dev;
> + struct ec_xfer_mock *mock;
> + u8 resp_data[16];
> + struct {
> + struct cros_ec_command msg;
> + u8 data[16];
> + } buf;
> + struct cros_ec_command *msg = &buf.msg;
> + int ret, i;
> +
> + for (i = 0; i < sizeof(resp_data); ++i)
> + resp_data[i] = (u8)(i + 1);
> +
> + memset(&buf, 0, sizeof(buf));
> + msg->version = 0;
> + msg->command = 0x5678;
> + msg->insize = sizeof(buf.data);
> +
> + ec_dev->pkt_xfer = cros_kunit_ec_pkt_xfer_mock;
Same here:
ec_dev->max_response = sizeof(buf.data);
prev parent reply other threads:[~2026-08-28 5:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 18:05 Rob Barnes
2026-08-28 5:31 ` Tzung-Bi Shih [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=apEdFK5rxLL1cXi2@google.com \
--to=tzungbi@kernel.org \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=robbarnes@google.com \
--cc=tomhughes@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®