[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200125012105.59903-5-pmalani@chromium.org>
Date: Fri, 24 Jan 2020 17:21:09 -0800
From: Prashant Malani <pmalani@...omium.org>
To: enric.balletbo@...labora.com, bleung@...omium.org
Cc: linux-kernel@...r.kernel.org,
Prashant Malani <pmalani@...omium.org>
Subject: [PATCH 4/4] platform/chrome: Make check_features() use wrapper
Replace the use of cros_ec_cmd_xfer_status() with the new wrapper
function.
Signed-off-by: Prashant Malani <pmalani@...omium.org>
---
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 8ef3b7d27d260..d3540fe1b7556 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -804,31 +804,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
Powered by blists - more mailing lists