Skip to content

Commit d48b8c5

Browse files
snematbakhshbleungatchromium
authored andcommitted
platform/chrome: Use proper protocol transfer function
pkt_xfer should be used for protocol v3, and cmd_xfer otherwise. We had one instance of these functions correct, but not the second, fall-back case. We use the fall-back only when the first command returns an IN_PROGRESS status, which is only used on some EC firmwares where we don't want to constantly poll the bus, but instead back off and sleep/retry for a little while. Fixes: 2c7589a ("mfd: cros_ec: add proto v3 skeleton") Signed-off-by: Shawn Nematbakhsh <[email protected]> Signed-off-by: Brian Norris <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Signed-off-by: Benson Leung <[email protected]>
1 parent e675191 commit d48b8c5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/platform/chrome/cros_ec_proto.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,14 @@ static int send_command(struct cros_ec_device *ec_dev,
6060
struct cros_ec_command *msg)
6161
{
6262
int ret;
63+
int (*xfer_fxn)(struct cros_ec_device *ec, struct cros_ec_command *msg);
6364

6465
if (ec_dev->proto_version > 2)
65-
ret = ec_dev->pkt_xfer(ec_dev, msg);
66+
xfer_fxn = ec_dev->pkt_xfer;
6667
else
67-
ret = ec_dev->cmd_xfer(ec_dev, msg);
68+
xfer_fxn = ec_dev->cmd_xfer;
6869

70+
ret = (*xfer_fxn)(ec_dev, msg);
6971
if (msg->result == EC_RES_IN_PROGRESS) {
7072
int i;
7173
struct cros_ec_command *status_msg;
@@ -88,7 +90,7 @@ static int send_command(struct cros_ec_device *ec_dev,
8890
for (i = 0; i < EC_COMMAND_RETRIES; i++) {
8991
usleep_range(10000, 11000);
9092

91-
ret = ec_dev->cmd_xfer(ec_dev, status_msg);
93+
ret = (*xfer_fxn)(ec_dev, status_msg);
9294
if (ret < 0)
9395
break;
9496

0 commit comments

Comments
 (0)