aboutsummaryrefslogtreecommitdiff
path: root/drivers/platform/chrome/cros_ec_proto.c
diff options
context:
space:
mode:
authorGravatar Tzung-Bi Shih <tzungbi@kernel.org> 2022-06-09 08:49:40 +0000
committerGravatar Tzung-Bi Shih <tzungbi@kernel.org> 2022-06-10 02:31:42 +0000
commite796c0c4b1ada2e038b22215d38ddc97153de053 (patch)
tree7b5236b976f7dc836c14a0f4bd52c0c8e36cb1e3 /drivers/platform/chrome/cros_ec_proto.c
parentplatform/chrome: use macros for passthru indexes (diff)
downloadlinux-e796c0c4b1ada2e038b22215d38ddc97153de053.tar.gz
linux-e796c0c4b1ada2e038b22215d38ddc97153de053.tar.bz2
linux-e796c0c4b1ada2e038b22215d38ddc97153de053.zip
platform/chrome: cros_ec_proto: assign buffer size from protocol info
`din_size` is calculated from `ec_dev->max_response`. `ec_dev->max_response` is further calculated from the protocol info. To make it clear, assign `din_size` and `dout_size` from protocol info directly. Reviewed-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> Link: https://lore.kernel.org/r/20220609084957.3684698-5-tzungbi@kernel.org
Diffstat (limited to 'drivers/platform/chrome/cros_ec_proto.c')
-rw-r--r--drivers/platform/chrome/cros_ec_proto.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index cfa3dacce4e5..4977c8deb3ec 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -449,12 +449,8 @@ int cros_ec_query_all(struct cros_ec_device *ec_dev)
"using proto v%u\n",
ec_dev->proto_version);
- ec_dev->din_size = ec_dev->max_response +
- sizeof(struct ec_host_response) +
- EC_MAX_RESPONSE_OVERHEAD;
- ec_dev->dout_size = ec_dev->max_request +
- sizeof(struct ec_host_request) +
- EC_MAX_REQUEST_OVERHEAD;
+ ec_dev->din_size = proto_info->max_response_packet_size + EC_MAX_RESPONSE_OVERHEAD;
+ ec_dev->dout_size = proto_info->max_request_packet_size + EC_MAX_REQUEST_OVERHEAD;
/*
* Check for PD