[PATCH 04/17] platform/chrome: usbpd_logger: Use cmd_send_msg()

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


Convert the earlier call of cros_ec_cmd_xfer_status() to
cros_ec_send_cmd_msg() which does the buffer setup and message
allocation.

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

diff --git a/drivers/platform/chrome/cros_usbpd_logger.c b/drivers/platform/chrome/cros_usbpd_logger.c
index 374cdd1e868ac1..356bc2fe068466 100644
--- a/drivers/platform/chrome/cros_usbpd_logger.c
+++ b/drivers/platform/chrome/cros_usbpd_logger.c
@@ -62,19 +62,16 @@ static int append_str(char *buf, int pos, const char *fmt, ...)
static struct ec_response_pd_log *ec_get_log_entry(struct logger_data *logger)
{
struct cros_ec_dev *ec_dev = logger->ec_dev;
- struct cros_ec_command *msg;
int ret;

- msg = (struct cros_ec_command *)logger->ec_buffer;
-
- msg->command = ec_dev->cmd_offset + EC_CMD_PD_GET_LOG_ENTRY;
- msg->insize = CROS_USBPD_LOG_RESP_SIZE;
-
- ret = cros_ec_cmd_xfer_status(ec_dev->ec_dev, msg);
+ ret = cros_ec_send_cmd_msg(ec_dev->ec_dev, 0,
+ ec_dev->cmd_offset + EC_CMD_PD_GET_LOG_ENTRY,
+ NULL, 0,
+ logger->ec_buffer, CROS_USBPD_LOG_RESP_SIZE);
if (ret < 0)
return ERR_PTR(ret);

- return (struct ec_response_pd_log *)msg->data;
+ return (struct ec_response_pd_log *)logger->ec_buffer;
}

static void cros_usbpd_print_log_entry(struct ec_response_pd_log *r,
--
2.25.0.341.g760bfbb309-goog