From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Ben Walsh <ben@jubnut.com>
Cc: "Benson Leung" <bleung@chromium.org>,
"Guenter Roeck" <groeck@chromium.org>,
"Dustin L. Howett" <dustin@howett.net>,
"Kieran Levin" <ktl@frame.work>,
"Thomas Weißschuh" <linux@weissschuh.net>,
"Mario Limonciello" <mario.limonciello@amd.com>,
chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/6] platform/chrome: cros_ec_lpc: MEC access can return error code
Date: Mon, 20 May 2024 17:45:49 +0800 [thread overview]
Message-ID: <ZksbzQeR6cDsQz0B@google.com> (raw)
In-Reply-To: <20240515055631.5775-2-ben@jubnut.com>
On Wed, May 15, 2024 at 06:56:26AM +0100, Ben Walsh wrote:
> diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
[...]
> @@ -116,14 +118,19 @@ static u8 cros_ec_lpc_write_bytes(unsigned int offset, unsigned int length,
> * An instance of the read function of struct lpc_driver_ops, used for the
> * MEC variant of LPC EC.
> */
> -static u8 cros_ec_lpc_mec_read_bytes(unsigned int offset, unsigned int length,
> - u8 *dest)
> +static int cros_ec_lpc_mec_read_bytes(unsigned int offset, unsigned int length,
> + u8 *dest)
> {
> - int in_range = cros_ec_lpc_mec_in_range(offset, length);
> + int in_range;
>
> - if (in_range < 0)
> + if (length == 0)
> return 0;
>
> + in_range = cros_ec_lpc_mec_in_range(offset, length);
> +
> + if (in_range < 0)
> + return in_range;
> +
> return in_range ?
> cros_ec_lpc_io_bytes_mec(MEC_IO_READ,
> offset - EC_HOST_CMD_REGION0,
The `in_range` change looks irrelevant to the patch. Or it should rather be
an independent patch if it fixes something.
> @@ -135,14 +142,19 @@ static u8 cros_ec_lpc_mec_read_bytes(unsigned int offset, unsigned int length,
> * An instance of the write function of struct lpc_driver_ops, used for the
> * MEC variant of LPC EC.
> */
> -static u8 cros_ec_lpc_mec_write_bytes(unsigned int offset, unsigned int length,
> - const u8 *msg)
> +static int cros_ec_lpc_mec_write_bytes(unsigned int offset, unsigned int length,
> + const u8 *msg)
> {
> - int in_range = cros_ec_lpc_mec_in_range(offset, length);
> + int in_range;
>
> - if (in_range < 0)
> + if (length == 0)
> return 0;
>
> + in_range = cros_ec_lpc_mec_in_range(offset, length);
> +
> + if (in_range < 0)
> + return in_range;
> +
> return in_range ?
> cros_ec_lpc_io_bytes_mec(MEC_IO_WRITE,
> offset - EC_HOST_CMD_REGION0,
Same as above.
> @@ -179,28 +194,41 @@ static int cros_ec_pkt_xfer_lpc(struct cros_ec_device *ec,
[...]
> /* Check result */
> - msg->result = cros_ec_lpc_ops.read(EC_LPC_ADDR_HOST_DATA, 1, &sum);
> + ret = cros_ec_lpc_ops.read(EC_LPC_ADDR_HOST_DATA, 1, &sum);
> + if (ret < 0)
> + goto done;
> + msg->result = sum;
Even though they are equivalent, `msg->result = ret` looks more intuitive.
> @@ -255,32 +286,47 @@ static int cros_ec_cmd_xfer_lpc(struct cros_ec_device *ec,
[...]
> /* Check result */
> - msg->result = cros_ec_lpc_ops.read(EC_LPC_ADDR_HOST_DATA, 1, &sum);
> + ret = cros_ec_lpc_ops.read(EC_LPC_ADDR_HOST_DATA, 1, &sum);
> + if (ret < 0)
> + goto done;
> + msg->result = sum;
Same as above.
next prev parent reply other threads:[~2024-05-20 9:45 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-15 5:56 [PATCH 0/6] Fix MEC concurrency problems for Framework Laptop Ben Walsh
2024-05-15 5:56 ` [PATCH 1/6] platform/chrome: cros_ec_lpc: MEC access can return error code Ben Walsh
2024-05-20 9:45 ` Tzung-Bi Shih [this message]
2024-05-15 5:56 ` [PATCH 2/6] platform/chrome: cros_ec_lpc: MEC access can use an AML mutex Ben Walsh
2024-05-20 9:46 ` Tzung-Bi Shih
2024-05-15 5:56 ` [PATCH 3/6] platform/chrome: cros_ec_lpc: Pass driver_data in static variable Ben Walsh
2024-05-20 9:46 ` Tzung-Bi Shih
2024-05-15 5:56 ` [PATCH 4/6] platform/chrome: cros_ec_lpc: Add a new quirk for AML mutex Ben Walsh
2024-05-15 5:56 ` [PATCH 5/6] platform/chrome: cros_ec_lpc: Correct ACPI name for Framework Laptop Ben Walsh
2024-05-20 9:47 ` Tzung-Bi Shih
2024-05-23 18:42 ` Ben Walsh
2024-05-24 2:26 ` Tzung-Bi Shih
2024-05-24 18:35 ` Ben Walsh
2024-05-24 18:39 ` Dustin Howett
2024-05-24 18:45 ` Ben Walsh
2024-05-26 1:26 ` Tzung-Bi Shih
2024-05-27 18:06 ` Ben Walsh
2024-05-28 3:08 ` Tzung-Bi Shih
2024-05-15 5:56 ` [PATCH 6/6] platform/chrome: cros_ec_lpc: Add AML mutex " Ben Walsh
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=ZksbzQeR6cDsQz0B@google.com \
--to=tzungbi@kernel.org \
--cc=ben@jubnut.com \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=dustin@howett.net \
--cc=groeck@chromium.org \
--cc=ktl@frame.work \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=mario.limonciello@amd.com \
/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