[PATCH 03/17] platform/chrome: proto: Use send_cmd_msg

From: Prashant Malani
Date: Thu Jan 30 2020 - 15:33:00 EST


Replace the use of cros_ec_cmd_xfer_status() with the new function
cros_ec_send_cmd_msg().

Signed-off-by: Prashant Malani <pmalani@xxxxxxxxxxxx>
---
drivers/platform/chrome/cros_ec_proto.c | 20 +++++---------------
1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index 53f3bfac71d90e..efd1c0b6a830c8 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -808,31 +808,21 @@ EXPORT_SYMBOL(cros_ec_get_host_event);
*/
int cros_ec_check_features(struct cros_ec_dev *ec, int feature)
{
- struct cros_ec_command *msg;
int ret;

if (ec->features[0] == -1U && ec->features[1] == -1U) {
/* features bitmap not read yet */
- msg = kzalloc(sizeof(*msg) + sizeof(ec->features), GFP_KERNEL);
- if (!msg)
- return -ENOMEM;
-
- msg->command = EC_CMD_GET_FEATURES + ec->cmd_offset;
- msg->insize = sizeof(ec->features);
-
- ret = cros_ec_cmd_xfer_status(ec->ec_dev, msg);
+ ret = cros_ec_send_cmd_msg(ec->ec_dev, 0,
+ ec->cmd_offset + EC_CMD_GET_FEATURES,
+ NULL, 0, ec->features,
+ sizeof(ec->features));
if (ret < 0) {
- dev_warn(ec->dev, "cannot get EC features: %d/%d\n",
- ret, msg->result);
+ dev_warn(ec->dev, "cannot get EC features: %d\n", ret);
memset(ec->features, 0, sizeof(ec->features));
- } else {
- memcpy(ec->features, msg->data, sizeof(ec->features));
}

dev_dbg(ec->dev, "EC features %08x %08x\n",
ec->features[0], ec->features[1]);
-
- kfree(msg);
}

return ec->features[feature / 32] & EC_FEATURE_MASK_0(feature);
--
2.25.0.341.g760bfbb309-goog