linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Prashant Malani <pmalani@chromium.org>
To: enric.balletbo@collabora.com, bleung@chromium.org
Cc: linux-kernel@vger.kernel.org, Prashant Malani <pmalani@chromium.org>
Subject: [PATCH 4/4] platform/chrome: Make check_features() use wrapper
Date: Fri, 24 Jan 2020 17:21:09 -0800	[thread overview]
Message-ID: <20200125012105.59903-5-pmalani@chromium.org> (raw)
In-Reply-To: <20200125012105.59903-1-pmalani@chromium.org>

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

Signed-off-by: Prashant Malani <pmalani@chromium.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


      parent reply	other threads:[~2020-01-25  1:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-25  1:21 [PATCH 0/4] Factor out cmd_xfer_status() setup code Prashant Malani
2020-01-25  1:21 ` [PATCH 1/4] platform/chrome: Add EC command msg wrapper Prashant Malani
2020-01-27 15:29   ` Enric Balletbo i Serra
2020-01-27 17:11     ` Prashant Malani
2020-01-27 20:35       ` Enric Balletbo Serra
2020-01-28 19:29         ` Prashant Malani
2020-01-28 20:57           ` Enric Balletbo Serra
2020-01-28 22:44             ` Prashant Malani
     [not found]             ` <CACeCKaewsKMLbO=N2hY5Gen075ZuVmSb8A=A1gQ7SWFvoF7M2w@mail.gmail.com>
2020-01-30 20:38               ` Prashant Malani
2020-01-25  1:21 ` [PATCH 2/4] platform/chrome: Make chardev use send_cmd_msg Prashant Malani
2020-01-25  1:21 ` [PATCH 3/4] platform/chrome: Use send_cmd_msg in debugfs Prashant Malani
2020-01-25  1:21 ` Prashant Malani [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200125012105.59903-5-pmalani@chromium.org \
    --to=pmalani@chromium.org \
    --cc=bleung@chromium.org \
    --cc=enric.balletbo@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).