linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Enric Balletbo i Serra <enric.balletbo@collabora.com>
To: Prashant Malani <pmalani@chromium.org>, linux-kernel@vger.kernel.org
Cc: gwendal@chromium.org, Benson Leung <bleung@chromium.org>,
	Guenter Roeck <groeck@chromium.org>
Subject: Re: [PATCH 2/2] platform/chrome: cros_ec_proto: Drop cros_ec_cmd_xfer()
Date: Mon, 21 Sep 2020 10:55:42 +0200	[thread overview]
Message-ID: <115a7ae9-9285-d6c4-df85-f9395c67d86f@collabora.com> (raw)
In-Reply-To: <20200903095415.2572049-2-pmalani@chromium.org>

Hi Prashant,

On 3/9/20 11:54, Prashant Malani wrote:
> Since cros_ec_cmd_xfer_status() now returns Linux error codes and all
> other files use that command, remove the now-unused function
> cros_ec_cmd_xfer().
> 
> Signed-off-by: Prashant Malani <pmalani@chromium.org>

Applied for 5.10

Thanks,
 Enric

> ---
>  drivers/platform/chrome/cros_ec_proto.c | 44 +++++++------------------
>  1 file changed, 11 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
> index 2cb1defcdd13..0ecee8b8773d 100644
> --- a/drivers/platform/chrome/cros_ec_proto.c
> +++ b/drivers/platform/chrome/cros_ec_proto.c
> @@ -549,19 +549,22 @@ int cros_ec_query_all(struct cros_ec_device *ec_dev)
>  EXPORT_SYMBOL(cros_ec_query_all);
>  
>  /**
> - * cros_ec_cmd_xfer() - Send a command to the ChromeOS EC.
> + * cros_ec_cmd_xfer_status() - Send a command to the ChromeOS EC.
>   * @ec_dev: EC device.
>   * @msg: Message to write.
>   *
> - * Call this to send a command to the ChromeOS EC.  This should be used
> - * instead of calling the EC's cmd_xfer() callback directly.
> + * Call this to send a command to the ChromeOS EC. This should be used instead of calling the EC's
> + * cmd_xfer() callback directly. It returns success status only if both the command was transmitted
> + * successfully and the EC replied with success status.
>   *
> - * Return: 0 on success or negative error code.
> + * Return:
> + * >=0 - The number of bytes transferred
> + * <0 - Linux error code
>   */
> -static int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev,
> +int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev,
>  			    struct cros_ec_command *msg)
>  {
> -	int ret;
> +	int ret, mapped;
>  
>  	mutex_lock(&ec_dev->lock);
>  	if (ec_dev->proto_version == EC_PROTO_VERSION_UNKNOWN) {
> @@ -598,42 +601,17 @@ static int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev,
>  			return -EMSGSIZE;
>  		}
>  	}
> +
>  	ret = send_command(ec_dev, msg);
>  	mutex_unlock(&ec_dev->lock);
>  
> -	return ret;
> -}
> -
> -/**
> - * cros_ec_cmd_xfer_status() - Send a command to the ChromeOS EC.
> - * @ec_dev: EC device.
> - * @msg: Message to write.
> - *
> - * This function is identical to cros_ec_cmd_xfer, except it returns success
> - * status only if both the command was transmitted successfully and the EC
> - * replied with success status. It's not necessary to check msg->result when
> - * using this function.
> - *
> - * Return:
> - * >=0 - The number of bytes transferred
> - * <0 - Linux error code
> - */
> -int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev,
> -			    struct cros_ec_command *msg)
> -{
> -	int ret, mapped;
> -
> -	ret = cros_ec_cmd_xfer(ec_dev, msg);
> -	if (ret < 0) {
> -		dev_err(ec_dev->dev, "Command xfer error (err:%d)\n", ret);
> -		return ret;
> -	}
>  	mapped = cros_ec_map_error(msg->result);
>  	if (mapped) {
>  		dev_dbg(ec_dev->dev, "Command result (err: %d [%d])\n",
>  			msg->result, mapped);
>  		ret = mapped;
>  	}
> +
>  	return ret;
>  }
>  EXPORT_SYMBOL(cros_ec_cmd_xfer_status);
> 

  reply	other threads:[~2020-09-21  8:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03  9:54 [PATCH 1/2] platform/chrome: cros_ec_proto: Update cros_ec_cmd_xfer() call-sites Prashant Malani
2020-09-03  9:54 ` [PATCH 2/2] platform/chrome: cros_ec_proto: Drop cros_ec_cmd_xfer() Prashant Malani
2020-09-21  8:55   ` Enric Balletbo i Serra [this message]
2020-09-07 10:48 ` [PATCH 1/2] platform/chrome: cros_ec_proto: Update cros_ec_cmd_xfer() call-sites Enric Balletbo i Serra
2020-09-14 23:29   ` Prashant Malani
2020-09-18 23:38     ` Gwendal Grignou
2020-09-21  8:55       ` Enric Balletbo i Serra

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=115a7ae9-9285-d6c4-df85-f9395c67d86f@collabora.com \
    --to=enric.balletbo@collabora.com \
    --cc=bleung@chromium.org \
    --cc=groeck@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmalani@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;
as well as URLs for NNTP newsgroup(s).