All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: bleung@chromium.org, groeck@chromium.org
Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org,
	tzungbi@kernel.org, dianders@chromium.org
Subject: [PATCH 3/4] platform/chrome: cros_ec_proto: update cros_ec_check_result() comment
Date: Wed, 18 May 2022 17:18:13 +0800	[thread overview]
Message-ID: <20220518091814.2028579-4-tzungbi@kernel.org> (raw)
In-Reply-To: <20220518091814.2028579-1-tzungbi@kernel.org>

At first glance, cros_ec_check_result() is quite like cros_ec_map_error().
They check for `ec_msg->result` and return corresponding errors.  However,
as calling from `pkt_xfer` and `cmd_xfer`, cros_ec_check_result() should
not report furthermore errors.  -EAGAIN is the only exception.

See [1][2][3] for some known userland programs' code.  The return code
from ioctl only denotes the EC communication status.  Userland programs
would further analyze the `result` in struct cros_ec_command* for
follow-up actions (e.g. [4]).

To clarify, update the function comment.

[1]: https://crrev.com/54400e93a75ef440a83d6eaac2cec066daf99cf0/util/comm-dev.c#154
[2]: https://crrev.com/fe32670a89bf59e1aff84bba9dd3295657b85e9b/cros_ec_dev.c#296
[3]: https://crrev.com/4e19eb1d89de0422ff1bbd3f7260b131c761098c/drivers/google/cros_ec_dev.c#120
[4]: https://crrev.com/54400e93a75ef440a83d6eaac2cec066daf99cf0/util/comm-dev.c#164

Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
Changes from previous version:
(https://patchwork.kernel.org/project/chrome-platform/patch/20220517082817.1591526-1-tzungbi@kernel.org/)
- Update the link of [3].

 drivers/platform/chrome/cros_ec_proto.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index 01ab58b3269b..13ced9d2dd71 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -204,9 +204,12 @@ EXPORT_SYMBOL(cros_ec_prepare_tx);
  * @msg: Message to check.
  *
  * This is used by ChromeOS EC drivers to check the ec_msg->result for
- * errors and to warn about them.
+ * EC_RES_IN_PROGRESS and to warn about them.
  *
- * Return: 0 on success or negative error code.
+ * The function should not check for furthermore error codes.  Otherwise,
+ * it would break the ABI.
+ *
+ * Return: -EAGAIN if ec_msg->result == EC_RES_IN_PROGRESS.  Otherwise, 0.
  */
 int cros_ec_check_result(struct cros_ec_device *ec_dev,
 			 struct cros_ec_command *msg)
-- 
2.36.0.550.gb090851708-goog


  parent reply	other threads:[~2022-05-18  9:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18  9:18 [PATCH 0/4] platform/chrome: cros_ec_proto: add initial Kunit tests Tzung-Bi Shih
2022-05-18  9:18 ` [PATCH 1/4] platform/chrome: cros_ec_proto: add Kunit tests for cros_ec_prepare_tx() Tzung-Bi Shih
2022-05-18 16:23   ` Guenter Roeck
2022-05-18  9:18 ` [PATCH 2/4] platform/chrome: cros_ec_proto: factor legacy out from cros_ec_prepare_tx() Tzung-Bi Shih
2022-05-18 16:26   ` Guenter Roeck
2022-05-18  9:18 ` Tzung-Bi Shih [this message]
2022-05-18 16:28   ` [PATCH 3/4] platform/chrome: cros_ec_proto: update cros_ec_check_result() comment Guenter Roeck
2022-05-18  9:18 ` [PATCH 4/4] platform/chrome: cros_ec_proto: add Kunit tests for cros_ec_check_result() Tzung-Bi Shih
2022-05-18 16:31   ` Guenter Roeck
2022-05-19  1:50 ` [PATCH 0/4] platform/chrome: cros_ec_proto: add initial Kunit tests patchwork-bot+chrome-platform
2022-05-24  0:50 ` patchwork-bot+chrome-platform
2022-06-06  4:08 ` patchwork-bot+chrome-platform

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=20220518091814.2028579-4-tzungbi@kernel.org \
    --to=tzungbi@kernel.org \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=dianders@chromium.org \
    --cc=groeck@chromium.org \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.