Update the Chrome OS character device driver to use the newly introduced
cros_ec_cmd() function instead of cros_ec_cmd_xfer_status(), thus
avoiding message buffer set up work which is already done by the new
function.
Signed-off-by: Prashant Malani <[email protected]>
---
Changes in v2:
- Updated to use newer function name and parameter list.
drivers/platform/chrome/cros_ec_chardev.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/drivers/platform/chrome/cros_ec_chardev.c b/drivers/platform/chrome/cros_ec_chardev.c
index c65e70bc168d8c..f92fe4139c4367 100644
--- a/drivers/platform/chrome/cros_ec_chardev.c
+++ b/drivers/platform/chrome/cros_ec_chardev.c
@@ -57,25 +57,20 @@ static int ec_get_version(struct cros_ec_dev *ec, char *str, int maxlen)
"unknown", "read-only", "read-write", "invalid",
};
struct ec_response_get_version *resp;
- struct cros_ec_command *msg;
int ret;
- msg = kzalloc(sizeof(*msg) + sizeof(*resp), GFP_KERNEL);
- if (!msg)
+ resp = kzalloc(sizeof(*resp), GFP_KERNEL);
+ if (!resp)
return -ENOMEM;
- msg->command = EC_CMD_GET_VERSION + ec->cmd_offset;
- msg->insize = sizeof(*resp);
-
- ret = cros_ec_cmd_xfer_status(ec->ec_dev, msg);
+ ret = cros_ec_cmd(ec->ec_dev, 0, ec->cmd_offset + EC_CMD_GET_VERSION,
+ NULL, 0, resp, sizeof(*resp), NULL);
if (ret < 0) {
snprintf(str, maxlen,
- "Unknown EC version, returned error: %d\n",
- msg->result);
+ "Unknown EC version, returned error: %d\n", ret);
goto exit;
}
- resp = (struct ec_response_get_version *)msg->data;
if (resp->current_image >= ARRAY_SIZE(current_image_name))
resp->current_image = 3; /* invalid */
@@ -85,7 +80,7 @@ static int ec_get_version(struct cros_ec_dev *ec, char *str, int maxlen)
ret = 0;
exit:
- kfree(msg);
+ kfree(resp);
return ret;
}
--
2.25.0.341.g760bfbb309-goog