All of lore.kernel.org
 help / color / mirror / Atom feed
From: Prashant Malani <pmalani@chromium.org>
To: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: linux-kernel@vger.kernel.org,
	Collabora Kernel ML <kernel@collabora.com>,
	groeck@chromium.org, bleung@chromium.org, dtor@chromium.org,
	gwendal@chromium.org
Subject: Re: [PATCH 4/8] platform/chrome: cros_ec_chardev: Use cros_ec_cmd_xfer_status helper
Date: Tue, 25 Feb 2020 11:55:19 -0800	[thread overview]
Message-ID: <20200225195519.GC11971@google.com> (raw)
In-Reply-To: <20200220155859.906647-5-enric.balletbo@collabora.com>

Hi Enric,

On Thu, Feb 20, 2020 at 04:58:55PM +0100, Enric Balletbo i Serra wrote:
> This patch makes use of cros_ec_cmd_xfer_status() instead of
> cros_ec_cmd_xfer(). In this case the change is trivial and the only
> reason to do it is because we want to make cros_ec_cmd_xfer() a private
> function for the EC protocol and let people only use the
> cros_ec_cmd_xfer_status() to return Linux standard error codes.
> 
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
> 
>  drivers/platform/chrome/cros_ec_chardev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/chrome/cros_ec_chardev.c b/drivers/platform/chrome/cros_ec_chardev.c
> index c65e70bc168d..b51ab24055f3 100644
> --- a/drivers/platform/chrome/cros_ec_chardev.c
> +++ b/drivers/platform/chrome/cros_ec_chardev.c
> @@ -301,7 +301,7 @@ static long cros_ec_chardev_ioctl_xcmd(struct cros_ec_dev *ec, void __user *arg)
>  	}
>  
>  	s_cmd->command += ec->cmd_offset;
> -	ret = cros_ec_cmd_xfer(ec->ec_dev, s_cmd);
> +	ret = cros_ec_cmd_xfer_status(ec->ec_dev, s_cmd);

One issue I see here is that if we were to later convert
cros_ec_cmd_xfer_status() to cros_ec_cmd(), we would lose the
s_cmd->result value, since I was hoping to avoid returning msg->result
via a pointer parameter. I don't know if userspace actually uses that, but I
am assuming it does.

So, should cros_ec_cmd() keep the *result pointer like so ?:

int cros_ec_cmd(struct cros_ec_device *ec, u32 version, u32 command,
               void *outdata, u32 outsize, void *indata, u32 insize, u32 *result);

This way, we can manually re-populate s_cmd->result with |*result|.

Or, should we drop msg->result while returning s_cmd to userspace? I am
guessing the answer is no, but thought I'd check with you first.

Best regards,


>  	/* Only copy data to userland if data was received. */
>  	if (ret < 0)
>  		goto exit;
> -- 
> 2.25.0
> 

  reply	other threads:[~2020-02-25 19:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20 15:58 [PATCH 0/8] Migrate all cros_ec_cmd_xfer() calls to cros_ec_cmd_xfer_status() Enric Balletbo i Serra
2020-02-20 15:58 ` [PATCH 1/8] platform/chrome: cros_ec_proto: Report command not supported Enric Balletbo i Serra
2020-02-20 15:58 ` [PATCH 2/8] Input: cros_ec_keyb: Use cros_ec_cmd_xfer_status helper Enric Balletbo i Serra
2020-03-02 10:08   ` Enric Balletbo i Serra
2020-02-20 15:58 ` [PATCH 3/8] platform/chrome: cros_ec_vbc: " Enric Balletbo i Serra
2020-02-20 15:58 ` [PATCH 4/8] platform/chrome: cros_ec_chardev: " Enric Balletbo i Serra
2020-02-25 19:55   ` Prashant Malani [this message]
2020-02-26 14:59     ` Enric Balletbo i Serra
2020-02-26 17:32       ` Prashant Malani
2020-02-20 15:58 ` [PATCH 5/8] platform/chrome: cros_ec_sysfs: " Enric Balletbo i Serra
2020-02-20 15:58 ` [PATCH 6/8] platform/chrome: cros_ec_lightbar: " Enric Balletbo i Serra
2020-02-20 15:58 ` [PATCH 7/8] platform/chrome: cros_ec: " Enric Balletbo i Serra
2020-02-20 15:58 ` [PATCH 8/8] platform/chrome: cros_ec_proto: Do not export cros_ec_cmd_xfer() Enric Balletbo i Serra
2020-02-26  1:12 ` [PATCH 0/8] Migrate all cros_ec_cmd_xfer() calls to cros_ec_cmd_xfer_status() Prashant Malani

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=20200225195519.GC11971@google.com \
    --to=pmalani@chromium.org \
    --cc=bleung@chromium.org \
    --cc=dtor@chromium.org \
    --cc=enric.balletbo@collabora.com \
    --cc=groeck@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=kernel@collabora.com \
    --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.