aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/platform/chrome/cros_ec_proto.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index 8dfa7fcb1248..e7bbdf947bbc 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -60,12 +60,14 @@ static int send_command(struct cros_ec_device *ec_dev,
60 struct cros_ec_command *msg) 60 struct cros_ec_command *msg)
61{ 61{
62 int ret; 62 int ret;
63 int (*xfer_fxn)(struct cros_ec_device *ec, struct cros_ec_command *msg);
63 64
64 if (ec_dev->proto_version > 2) 65 if (ec_dev->proto_version > 2)
65 ret = ec_dev->pkt_xfer(ec_dev, msg); 66 xfer_fxn = ec_dev->pkt_xfer;
66 else 67 else
67 ret = ec_dev->cmd_xfer(ec_dev, msg); 68 xfer_fxn = ec_dev->cmd_xfer;
68 69
70 ret = (*xfer_fxn)(ec_dev, msg);
69 if (msg->result == EC_RES_IN_PROGRESS) { 71 if (msg->result == EC_RES_IN_PROGRESS) {
70 int i; 72 int i;
71 struct cros_ec_command *status_msg; 73 struct cros_ec_command *status_msg;
@@ -88,7 +90,7 @@ static int send_command(struct cros_ec_device *ec_dev,
88 for (i = 0; i < EC_COMMAND_RETRIES; i++) { 90 for (i = 0; i < EC_COMMAND_RETRIES; i++) {
89 usleep_range(10000, 11000); 91 usleep_range(10000, 11000);
90 92
91 ret = ec_dev->cmd_xfer(ec_dev, status_msg); 93 ret = (*xfer_fxn)(ec_dev, status_msg);
92 if (ret < 0) 94 if (ret < 0)
93 break; 95 break;
94 96