diff mbox series

[3/3] platform/chrome: cros_ec_proto: Update size arg types

Message ID 20220606201825.763788-4-pmalani@chromium.org (mailing list archive)
State Accepted
Commit f87e15fbf6d8cdb51f953338d41a4a52ad1aca14
Headers show
Series platform/chrome: cros_ec_command() improvements | expand

Commit Message

Prashant Malani June 6, 2022, 8:18 p.m. UTC
cros_ec_cmd() takes 2 size arguments. Update them to be of the more
appropriate type size_t.

Suggested-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Prashant Malani <pmalani@chromium.org>
---
 drivers/platform/chrome/cros_ec_proto.c     | 4 ++--
 include/linux/platform_data/cros_ec_proto.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Stephen Boyd June 6, 2022, 11:34 p.m. UTC | #1
Quoting Prashant Malani (2022-06-06 13:18:05)
> cros_ec_cmd() takes 2 size arguments. Update them to be of the more
> appropriate type size_t.
>
> Suggested-by: Stephen Boyd <swboyd@chromium.org>
> Signed-off-by: Prashant Malani <pmalani@chromium.org>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>

> diff --git a/include/linux/platform_data/cros_ec_proto.h b/include/linux/platform_data/cros_ec_proto.h
> index 816da4eef3e5..85e29300f63d 100644
> --- a/include/linux/platform_data/cros_ec_proto.h
> +++ b/include/linux/platform_data/cros_ec_proto.h
> @@ -232,7 +232,7 @@ bool cros_ec_check_features(struct cros_ec_dev *ec, int feature);
>  int cros_ec_get_sensor_count(struct cros_ec_dev *ec);
>
>  int cros_ec_cmd(struct cros_ec_device *ec_dev, unsigned int version, int command, void *outdata,
> -                   int outsize, void *indata, int insize);
> +                   size_t outsize, void *indata, size_t insize);

We should also mark 'outdata' as const in another patch because it's
being copied out and I assume unmodified by the callee. It's nice to
tell the caller that their data will be sent unmodified.
Guenter Roeck June 7, 2022, 2:41 p.m. UTC | #2
On Mon, Jun 6, 2022 at 1:20 PM Prashant Malani <pmalani@chromium.org> wrote:
>
> cros_ec_cmd() takes 2 size arguments. Update them to be of the more
> appropriate type size_t.
>
> Suggested-by: Stephen Boyd <swboyd@chromium.org>
> Signed-off-by: Prashant Malani <pmalani@chromium.org>

Reviewed-by: Guenter Roeck <groeck@chromium.org>

> ---
>  drivers/platform/chrome/cros_ec_proto.c     | 4 ++--
>  include/linux/platform_data/cros_ec_proto.h | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
> index b6bea183ee28..cefabfe45551 100644
> --- a/drivers/platform/chrome/cros_ec_proto.c
> +++ b/drivers/platform/chrome/cros_ec_proto.c
> @@ -958,9 +958,9 @@ int cros_ec_cmd(struct cros_ec_device *ec_dev,
>                 unsigned int version,
>                 int command,
>                 void *outdata,
> -               int outsize,
> +               size_t outsize,
>                 void *indata,
> -               int insize)
> +               size_t insize)
>  {
>         struct cros_ec_command *msg;
>         int ret;
> diff --git a/include/linux/platform_data/cros_ec_proto.h b/include/linux/platform_data/cros_ec_proto.h
> index 816da4eef3e5..85e29300f63d 100644
> --- a/include/linux/platform_data/cros_ec_proto.h
> +++ b/include/linux/platform_data/cros_ec_proto.h
> @@ -232,7 +232,7 @@ bool cros_ec_check_features(struct cros_ec_dev *ec, int feature);
>  int cros_ec_get_sensor_count(struct cros_ec_dev *ec);
>
>  int cros_ec_cmd(struct cros_ec_device *ec_dev, unsigned int version, int command, void *outdata,
> -                   int outsize, void *indata, int insize);
> +                   size_t outsize, void *indata, size_t insize);
>
>  /**
>   * cros_ec_get_time_ns() - Return time in ns.
> --
> 2.36.1.255.ge46751e96f-goog
>
diff mbox series

Patch

diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index b6bea183ee28..cefabfe45551 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -958,9 +958,9 @@  int cros_ec_cmd(struct cros_ec_device *ec_dev,
 		unsigned int version,
 		int command,
 		void *outdata,
-		int outsize,
+		size_t outsize,
 		void *indata,
-		int insize)
+		size_t insize)
 {
 	struct cros_ec_command *msg;
 	int ret;
diff --git a/include/linux/platform_data/cros_ec_proto.h b/include/linux/platform_data/cros_ec_proto.h
index 816da4eef3e5..85e29300f63d 100644
--- a/include/linux/platform_data/cros_ec_proto.h
+++ b/include/linux/platform_data/cros_ec_proto.h
@@ -232,7 +232,7 @@  bool cros_ec_check_features(struct cros_ec_dev *ec, int feature);
 int cros_ec_get_sensor_count(struct cros_ec_dev *ec);
 
 int cros_ec_cmd(struct cros_ec_device *ec_dev, unsigned int version, int command, void *outdata,
-		    int outsize, void *indata, int insize);
+		    size_t outsize, void *indata, size_t insize);
 
 /**
  * cros_ec_get_time_ns() - Return time in ns.