[PATCH v2 03/17] platform/chrome: proto: Use cros_ec_cmd()

From: Prashant Malani
Date: Wed Feb 05 2020 - 14:05:20 EST


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

Signed-off-by: Prashant Malani <pmalani@xxxxxxxxxxxx>
---

Changes in v2:
- Updated to use new function name and parameter list.

drivers/platform/chrome/cros_ec_proto.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index b3d5368f596813..aa7ae1f394cc91 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -811,31 +811,20 @@ 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_cmd(ec->ec_dev, 0,
+ ec->cmd_offset + EC_CMD_GET_FEATURES, NULL, 0,
+ ec->features, sizeof(ec->features), NULL);
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