diff options
author | Bill Richardson <wfrichar@chromium.org> | 2014-06-18 14:14:06 -0400 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-07-09 09:58:20 -0400 |
commit | 12ebc8a50bc54e3a6fe207861fc6793181f9c2dc (patch) | |
tree | 2375f0509badbfb00479cdc58d19a332aa9158b4 | |
parent | 6db07b6336589ff480528173e41f8f6af3f0097f (diff) |
mfd: cros_ec: ec_dev->cmd_xfer() returns number of bytes received from EC
When communicating with the EC, the cmd_xfer() function should return the
number of bytes it received from the EC, or negative on error.
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r-- | drivers/i2c/busses/i2c-cros-ec-tunnel.c | 2 | ||||
-rw-r--r-- | drivers/mfd/cros_ec_i2c.c | 2 | ||||
-rw-r--r-- | drivers/mfd/cros_ec_spi.c | 2 | ||||
-rw-r--r-- | include/linux/mfd/cros_ec.h | 8 |
4 files changed, 7 insertions, 7 deletions
diff --git a/drivers/i2c/busses/i2c-cros-ec-tunnel.c b/drivers/i2c/busses/i2c-cros-ec-tunnel.c index dd07818d03d0..05e033c98115 100644 --- a/drivers/i2c/busses/i2c-cros-ec-tunnel.c +++ b/drivers/i2c/busses/i2c-cros-ec-tunnel.c | |||
@@ -228,7 +228,7 @@ static int ec_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg i2c_msgs[], | |||
228 | msg.insize = response_len; | 228 | msg.insize = response_len; |
229 | 229 | ||
230 | result = bus->ec->cmd_xfer(bus->ec, &msg); | 230 | result = bus->ec->cmd_xfer(bus->ec, &msg); |
231 | if (result) | 231 | if (result < 0) |
232 | goto exit; | 232 | goto exit; |
233 | 233 | ||
234 | result = ec_i2c_parse_response(response, i2c_msgs, &num); | 234 | result = ec_i2c_parse_response(response, i2c_msgs, &num); |
diff --git a/drivers/mfd/cros_ec_i2c.c b/drivers/mfd/cros_ec_i2c.c index 189e7d1d7742..fd7a546d3478 100644 --- a/drivers/mfd/cros_ec_i2c.c +++ b/drivers/mfd/cros_ec_i2c.c | |||
@@ -111,7 +111,7 @@ static int cros_ec_cmd_xfer_i2c(struct cros_ec_device *ec_dev, | |||
111 | goto done; | 111 | goto done; |
112 | } | 112 | } |
113 | 113 | ||
114 | ret = 0; | 114 | ret = i2c_msg[1].buf[1]; |
115 | done: | 115 | done: |
116 | kfree(in_buf); | 116 | kfree(in_buf); |
117 | kfree(out_buf); | 117 | kfree(out_buf); |
diff --git a/drivers/mfd/cros_ec_spi.c b/drivers/mfd/cros_ec_spi.c index da1da05cd546..ac52e3653e90 100644 --- a/drivers/mfd/cros_ec_spi.c +++ b/drivers/mfd/cros_ec_spi.c | |||
@@ -320,7 +320,7 @@ static int cros_ec_cmd_xfer_spi(struct cros_ec_device *ec_dev, | |||
320 | goto exit; | 320 | goto exit; |
321 | } | 321 | } |
322 | 322 | ||
323 | ret = 0; | 323 | ret = len; |
324 | exit: | 324 | exit: |
325 | mutex_unlock(&ec_spi->lock); | 325 | mutex_unlock(&ec_spi->lock); |
326 | return ret; | 326 | return ret; |
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h index 1f79f162abe4..0ebf26fddbbb 100644 --- a/include/linux/mfd/cros_ec.h +++ b/include/linux/mfd/cros_ec.h | |||
@@ -41,7 +41,7 @@ enum { | |||
41 | * @outdata: Outgoing data to EC | 41 | * @outdata: Outgoing data to EC |
42 | * @outsize: Outgoing length in bytes | 42 | * @outsize: Outgoing length in bytes |
43 | * @indata: Where to put the incoming data from EC | 43 | * @indata: Where to put the incoming data from EC |
44 | * @insize: Incoming length in bytes (filled in by EC) | 44 | * @insize: Max number of bytes to accept from EC |
45 | * @result: EC's response to the command (separate from communication failure) | 45 | * @result: EC's response to the command (separate from communication failure) |
46 | */ | 46 | */ |
47 | struct cros_ec_command { | 47 | struct cros_ec_command { |
@@ -64,9 +64,9 @@ struct cros_ec_command { | |||
64 | * sleep at the last suspend | 64 | * sleep at the last suspend |
65 | * @event_notifier: interrupt event notifier for transport devices | 65 | * @event_notifier: interrupt event notifier for transport devices |
66 | * @cmd_xfer: send command to EC and get response | 66 | * @cmd_xfer: send command to EC and get response |
67 | * Returns 0 if the communication succeeded, but that doesn't mean the EC | 67 | * Returns the number of bytes received if the communication succeeded, but |
68 | * was happy with the command it got. Caller should check msg.result for | 68 | * that doesn't mean the EC was happy with the command. The caller |
69 | * the EC's result code. | 69 | * should check msg.result for the EC's result code. |
70 | * | 70 | * |
71 | * @priv: Private data | 71 | * @priv: Private data |
72 | * @irq: Interrupt to use | 72 | * @irq: Interrupt to use |