platform/chrome: cros_ec_proto: Mark outdata as const
authorStephen Boyd <swboyd@chromium.org>
Tue, 3 Oct 2023 00:34:28 +0000 (17:34 -0700)
committerTzung-Bi Shih <tzungbi@kernel.org>
Wed, 4 Oct 2023 03:40:54 +0000 (11:40 +0800)
The 'outdata' is copied to the data buffer in cros_ec_cmd() before being
sent over to the EC. Mark the argument as const so that callers can pass
const pointers to this function and so that callers know the data won't
be modified.

Cc: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Acked-by: Prashant Malani <pmalani@chromium.org>
Link: https://lore.kernel.org/r/20231003003429.1378109-5-swboyd@chromium.org
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
drivers/platform/chrome/cros_ec_proto.c
include/linux/platform_data/cros_ec_proto.h

index 475a6dd72db6bb2fdad1a4ce1d6cee3231acef86..945b1b15a04cae8356fc974d7e8800d50c836e37 100644 (file)
@@ -1004,7 +1004,7 @@ EXPORT_SYMBOL_GPL(cros_ec_get_sensor_count);
 int cros_ec_cmd(struct cros_ec_device *ec_dev,
                unsigned int version,
                int command,
-               void *outdata,
+               const void *outdata,
                size_t outsize,
                void *indata,
                size_t insize)
index 4f9f756bc17ceb30c59df9aabed86adee7046dcb..8865e350c12a5f687f1f7dd0f09d96fb8fb22db3 100644 (file)
@@ -258,7 +258,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 cros_ec_cmd(struct cros_ec_device *ec_dev, unsigned int version, int command, const void *outdata,
                    size_t outsize, void *indata, size_t insize);
 
 /**