From: Gwendal Grignou <gwendal@chromium.org>
To: Prashant Malani <pmalani@chromium.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
Jonathan Cameron <jic23@kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Benson Leung <bleung@chromium.org>,
Enric Balletbo i Serra <enric.balletbo@collabora.com>,
Guenter Roeck <groeck@chromium.org>,
Lee Jones <lee.jones@linaro.org>,
Fabien Lahoudere <fabien.lahoudere@collabora.com>,
"open list:IIO SUBSYSTEM AND DRIVERS" <linux-iio@vger.kernel.org>
Subject: Re: [PATCH v2 10/17] iio: cros_ec: Use cros_ec_cmd()
Date: Wed, 5 Feb 2020 11:42:14 -0800 [thread overview]
Message-ID: <CAPUE2uvJuNYc=MnGZfwT=hUzEJoRAoST-aT=xKfrTOZQ=5wgwQ@mail.gmail.com> (raw)
In-Reply-To: <20200205190028.183069-11-pmalani@chromium.org>
On Wed, Feb 5, 2020 at 11:13 AM Prashant Malani <pmalani@chromium.org> wrote:
>
> Replace cros_ec_cmd_xfer_status() with cros_ec_cmd()
> which does the message buffer setup and cleanup.
>
> For one other usage, replace the cros_ec_cmd_xfer_status() call with a
> call to cros_ec_cmd_xfer(), in preparation for the removal of the former
> function.
>
> Signed-off-by: Prashant Malani <pmalani@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
> ---
>
> Changes in v2:
> - Updated to use new function name and parameter list.
> - Used C99 element setting to initialize param struct.
> - For second usage, replaced cros_ec_cmd_xfer_status() with
> cros_ec_cmd_xfer() which is functionally similar.
>
> .../cros_ec_sensors/cros_ec_sensors_core.c | 25 +++++++------------
> 1 file changed, 9 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
> index d3a3626c7cd834..94e22e7d927631 100644
> --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
> +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
> @@ -30,24 +30,15 @@ static int cros_ec_get_host_cmd_version_mask(struct cros_ec_device *ec_dev,
> u16 cmd_offset, u16 cmd, u32 *mask)
> {
> int ret;
> - struct {
> - struct cros_ec_command msg;
> - union {
> - struct ec_params_get_cmd_versions params;
> - struct ec_response_get_cmd_versions resp;
> - };
> - } __packed buf = {
> - .msg = {
> - .command = EC_CMD_GET_CMD_VERSIONS + cmd_offset,
> - .insize = sizeof(struct ec_response_get_cmd_versions),
> - .outsize = sizeof(struct ec_params_get_cmd_versions)
> - },
> - .params = {.cmd = cmd}
> + struct ec_params_get_cmd_versions params = {
> + .cmd = cmd,
> };
> + struct ec_response_get_cmd_versions resp = {0};
>
> - ret = cros_ec_cmd_xfer_status(ec_dev, &buf.msg);
> + ret = cros_ec_cmd(ec_dev, 0, EC_CMD_GET_CMD_VERSIONS + cmd_offset,
> + ¶ms, sizeof(params), &resp, sizeof(resp), NULL);
> if (ret >= 0)
> - *mask = buf.resp.version_mask;
> + *mask = resp.version_mask;
> return ret;
> }
>
> @@ -171,9 +162,11 @@ int cros_ec_motion_send_host_cmd(struct cros_ec_sensors_core_state *state,
>
> memcpy(state->msg->data, &state->param, sizeof(state->param));
>
> - ret = cros_ec_cmd_xfer_status(state->ec, state->msg);
> + ret = cros_ec_cmd_xfer(state->ec, state->msg);
> if (ret < 0)
> return ret;
> + else if (state->msg->result != EC_RES_SUCCESS)
> + return -EPROTO;
>
> if (ret &&
> state->resp != (struct ec_response_motion_sense *)state->msg->data)
> --
> 2.25.0.341.g760bfbb309-goog
>
next prev parent reply other threads:[~2020-02-05 19:42 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200205190028.183069-1-pmalani@chromium.org>
2020-02-05 18:59 ` [PATCH v2 02/17] platform/chrome: chardev: Use cros_ec_cmd() Prashant Malani
2020-02-05 18:59 ` [PATCH v2 03/17] platform/chrome: proto: " Prashant Malani
2020-02-05 19:00 ` [PATCH v2 04/17] platform/chrome: usbpd_logger: " Prashant Malani
2020-02-05 19:00 ` [PATCH v2 05/17] platform/chrome: sensorhub: " Prashant Malani
2020-02-05 19:00 ` [PATCH v2 06/17] platform/chrome: debugfs: " Prashant Malani
2020-02-05 19:00 ` [PATCH v2 07/17] platform/chrome: sysfs: " Prashant Malani
2020-02-05 19:00 ` [PATCH v2 08/17] extcon: cros_ec: " Prashant Malani
2020-02-05 19:00 ` [PATCH v2 09/17] hid: google-hammer: " Prashant Malani
2020-02-05 19:00 ` [PATCH v2 10/17] iio: cros_ec: " Prashant Malani
2020-02-05 19:42 ` Gwendal Grignou [this message]
2020-02-06 12:17 ` Jonathan Cameron
2020-02-06 13:45 ` Enric Balletbo i Serra
2020-02-06 18:49 ` Prashant Malani
2020-02-07 18:47 ` Gwendal Grignou
2020-02-10 11:03 ` Enric Balletbo i Serra
2020-02-10 20:14 ` Prashant Malani
2020-02-18 18:30 ` Prashant Malani
2020-02-20 16:07 ` Enric Balletbo i Serra
2020-02-25 1:26 ` Prashant Malani
2020-02-05 19:00 ` [PATCH v2 11/17] ASoC: cros_ec_codec: " Prashant Malani
2020-02-06 11:53 ` Mark Brown
2020-02-05 19:00 ` [PATCH v2 12/17] power: supply: cros: " Prashant Malani
2020-02-24 17:13 ` Sebastian Reichel
2020-02-05 19:00 ` [PATCH v2 13/17] pwm: cros-ec: Remove cros_ec_cmd_xfer_status() Prashant Malani
2020-02-05 19:00 ` [PATCH v2 14/17] rtc: cros-ec: Use cros_ec_cmd() Prashant Malani
2020-02-05 20:04 ` Alexandre Belloni
2020-02-05 19:00 ` [PATCH v2 15/17] media: cros-ec-cec: " Prashant Malani
2020-06-24 12:04 ` Hans Verkuil
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='CAPUE2uvJuNYc=MnGZfwT=hUzEJoRAoST-aT=xKfrTOZQ=5wgwQ@mail.gmail.com' \
--to=gwendal@chromium.org \
--cc=bleung@chromium.org \
--cc=enric.balletbo@collabora.com \
--cc=fabien.lahoudere@collabora.com \
--cc=groeck@chromium.org \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=lee.jones@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmalani@chromium.org \
--cc=pmeerw@pmeerw.net \
/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;
as well as URLs for NNTP newsgroup(s).