* [PATCH 0/10] Batch of cleanup patches for cros_ec
@ 2014-06-16 21:39 Doug Anderson
2014-06-16 21:39 ` [PATCH 08/10] mfd: cros_ec: cleanup: Remove EC wrapper functions Doug Anderson
[not found] ` <1402954800-28215-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
0 siblings, 2 replies; 11+ messages in thread
From: Doug Anderson @ 2014-06-16 21:39 UTC (permalink / raw)
To: Lee Jones
Cc: Andrew Bresticker, swarren, olof, Sonny Rao, linux-samsung-soc,
Javier Martinez Canillas, Bill Richardson, sjg, Wolfram Sang,
broonie, Doug Anderson, vpalatin, sameo, dmitry.torokhov,
linux-kernel, geert, linux-i2c, linux-input
This is a batch of cleanup patches picked from the ChromeOS 3.8 kernel
tree and applied to ToT. Most of these patches were authored by Bill
Richardson (CCed). Where appropriate I've squashed patches together,
though I have erred on the side of keeping patches logically distinct
rather than squashing into one big cleanup patch.
There is very little functionality added by this series, but this gets
us closer to how things look in the ChromeOS tree so we can add more
patches atop it. In general I took the oldest patches from our tree
and stopped picking when I got to a reasonable patch size (10
patches). There are about 5 more cleanup patches still in the
ChromeOS tree, then some more major functionality patches.
Note that I didn't take the "cros_ec_dev" userspace inteface, the
"LPC" implementation, the "vboot context" implementation, and patches
relating to exynos5250-spring when picking patches. These bits are
very separate (and big!) and can be added and debated separately after
we've got cleanup in. Whenever patches touched those pieces of the
code I ignored that part of the patch. In general I did take cleanup
code that was intended to make it easier to later add these bits.
I have tested basic functionality of these patches on exynos5250-snow
and exynos5420-peach-pit.
Bill Richardson (9):
mfd: cros_ec: Fix the comment on cros_ec_remove()
mfd: cros_ec: IRQs for cros_ec should be optional
mfd: cros_ec: Allow static din/dout buffers with cros_ec_register()
mfd: cros_ec: Tweak struct cros_ec_device for clarity
mfd: cros_ec: Use struct cros_ec_command to communicate with the EC
mfd: cros_ec: cleanup: remove unused fields from struct cros_ec_device
mfd: cros_ec: cleanup: Remove EC wrapper functions
mfd: cros_ec: Check result code from EC messages
mfd: cros_ec: ec_dev->cmd_xfer() returns number of bytes received from
EC
Simon Glass (1):
mdf: cros_ec: Detect in-progress commands
drivers/i2c/busses/i2c-cros-ec-tunnel.c | 17 ++++--
drivers/input/keyboard/cros_ec_keyb.c | 14 ++++-
drivers/mfd/cros_ec.c | 76 +++++++-----------------
drivers/mfd/cros_ec_i2c.c | 44 ++++++++------
drivers/mfd/cros_ec_spi.c | 43 ++++++++------
include/linux/mfd/cros_ec.h | 100 +++++++++++++++-----------------
6 files changed, 144 insertions(+), 150 deletions(-)
--
2.0.0.526.g5318336
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 08/10] mfd: cros_ec: cleanup: Remove EC wrapper functions 2014-06-16 21:39 [PATCH 0/10] Batch of cleanup patches for cros_ec Doug Anderson @ 2014-06-16 21:39 ` Doug Anderson 2014-06-18 3:42 ` Simon Glass [not found] ` <1402954800-28215-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> 1 sibling, 1 reply; 11+ messages in thread From: Doug Anderson @ 2014-06-16 21:39 UTC (permalink / raw) To: Lee Jones Cc: Andrew Bresticker, swarren, olof, Sonny Rao, linux-samsung-soc, Javier Martinez Canillas, Bill Richardson, sjg, Wolfram Sang, broonie, Doug Anderson, dmitry.torokhov, sameo, vpalatin, geert, linux-i2c, linux-kernel, linux-input From: Bill Richardson <wfrichar@chromium.org> Remove the three wrapper functions that talk to the EC without passing all the desired arguments and just use the underlying communication function that passes everything in a struct intead. This is internal code refactoring only. Nothing should change. Signed-off-by: Bill Richardson <wfrichar@chromium.org> Signed-off-by: Doug Anderson <dianders@chromium.org> --- drivers/i2c/busses/i2c-cros-ec-tunnel.c | 15 +++++++++++---- drivers/input/keyboard/cros_ec_keyb.c | 14 ++++++++++++-- drivers/mfd/cros_ec.c | 32 -------------------------------- include/linux/mfd/cros_ec.h | 19 ++++++------------- 4 files changed, 29 insertions(+), 51 deletions(-) diff --git a/drivers/i2c/busses/i2c-cros-ec-tunnel.c b/drivers/i2c/busses/i2c-cros-ec-tunnel.c index 8e7a714..dd07818 100644 --- a/drivers/i2c/busses/i2c-cros-ec-tunnel.c +++ b/drivers/i2c/busses/i2c-cros-ec-tunnel.c @@ -183,6 +183,7 @@ static int ec_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg i2c_msgs[], u8 *request = NULL; u8 *response = NULL; int result; + struct cros_ec_command msg; request_len = ec_i2c_count_message(i2c_msgs, num); if (request_len < 0) { @@ -218,9 +219,15 @@ static int ec_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg i2c_msgs[], } ec_i2c_construct_message(request, i2c_msgs, num, bus_num); - result = bus->ec->command_sendrecv(bus->ec, EC_CMD_I2C_PASSTHRU, - request, request_len, - response, response_len); + + msg.version = 0; + msg.command = EC_CMD_I2C_PASSTHRU; + msg.outdata = request; + msg.outsize = request_len; + msg.indata = response; + msg.insize = response_len; + + result = bus->ec->cmd_xfer(bus->ec, &msg); if (result) goto exit; @@ -258,7 +265,7 @@ static int ec_i2c_probe(struct platform_device *pdev) u32 remote_bus; int err; - if (!ec->command_sendrecv) { + if (!ec->cmd_xfer) { dev_err(dev, "Missing sendrecv\n"); return -EINVAL; } diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c index 4083796..dc37b6b 100644 --- a/drivers/input/keyboard/cros_ec_keyb.c +++ b/drivers/input/keyboard/cros_ec_keyb.c @@ -191,8 +191,18 @@ static void cros_ec_keyb_close(struct input_dev *dev) static int cros_ec_keyb_get_state(struct cros_ec_keyb *ckdev, uint8_t *kb_state) { - return ckdev->ec->command_recv(ckdev->ec, EC_CMD_MKBP_STATE, - kb_state, ckdev->cols); + int ret; + struct cros_ec_command msg = { + .version = 0, + .command = EC_CMD_MKBP_STATE, + .outdata = NULL, + .outsize = 0, + .indata = kb_state, + .insize = ckdev->cols, + }; + + ret = ckdev->ec->cmd_xfer(ckdev->ec, &msg); + return ret; } static int cros_ec_keyb_work(struct notifier_block *nb, diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c index d242714..6dd91e9 100644 --- a/drivers/mfd/cros_ec.c +++ b/drivers/mfd/cros_ec.c @@ -44,34 +44,6 @@ int cros_ec_prepare_tx(struct cros_ec_device *ec_dev, } EXPORT_SYMBOL(cros_ec_prepare_tx); -static int cros_ec_command_sendrecv(struct cros_ec_device *ec_dev, - uint16_t cmd, void *out_buf, int out_len, - void *in_buf, int in_len) -{ - struct cros_ec_command msg; - - msg.version = cmd >> 8; - msg.command = cmd & 0xff; - msg.outdata = out_buf; - msg.outsize = out_len; - msg.indata = in_buf; - msg.insize = in_len; - - return ec_dev->cmd_xfer(ec_dev, &msg); -} - -static int cros_ec_command_recv(struct cros_ec_device *ec_dev, - uint16_t cmd, void *buf, int buf_len) -{ - return cros_ec_command_sendrecv(ec_dev, cmd, NULL, 0, buf, buf_len); -} - -static int cros_ec_command_send(struct cros_ec_device *ec_dev, - uint16_t cmd, void *buf, int buf_len) -{ - return cros_ec_command_sendrecv(ec_dev, cmd, buf, buf_len, NULL, 0); -} - static irqreturn_t ec_irq_thread(int irq, void *data) { struct cros_ec_device *ec_dev = data; @@ -104,10 +76,6 @@ int cros_ec_register(struct cros_ec_device *ec_dev) BLOCKING_INIT_NOTIFIER_HEAD(&ec_dev->event_notifier); - ec_dev->command_send = cros_ec_command_send; - ec_dev->command_recv = cros_ec_command_recv; - ec_dev->command_sendrecv = cros_ec_command_sendrecv; - if (ec_dev->din_size) { ec_dev->din = devm_kzalloc(dev, ec_dev->din_size, GFP_KERNEL); if (!ec_dev->din) diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h index 2b0c598..60c0880 100644 --- a/include/linux/mfd/cros_ec.h +++ b/include/linux/mfd/cros_ec.h @@ -63,9 +63,10 @@ struct cros_ec_command { * @was_wake_device: true if this device was set to wake the system from * sleep at the last suspend * @event_notifier: interrupt event notifier for transport devices - * @command_send: send a command - * @command_recv: receive a response - * @command_sendrecv: send a command and receive a response + * @cmd_xfer: send command to EC and get response + * Returns 0 if the communication succeeded, but that doesn't mean the EC + * was happy with the command it got. Caller should check msg.result for + * the EC's result code. * * @priv: Private data * @irq: Interrupt to use @@ -83,7 +84,6 @@ struct cros_ec_command { * @parent: pointer to parent device (e.g. i2c or spi device) * @wake_enabled: true if this device can wake the system from sleep * @lock: one transaction at a time - * @cmd_xfer: low-level channel to the EC */ struct cros_ec_device { @@ -94,13 +94,8 @@ struct cros_ec_device { bool was_wake_device; struct class *cros_class; struct blocking_notifier_head event_notifier; - int (*command_send)(struct cros_ec_device *ec, - uint16_t cmd, void *out_buf, int out_len); - int (*command_recv)(struct cros_ec_device *ec, - uint16_t cmd, void *in_buf, int in_len); - int (*command_sendrecv)(struct cros_ec_device *ec, - uint16_t cmd, void *out_buf, int out_len, - void *in_buf, int in_len); + int (*cmd_xfer)(struct cros_ec_device *ec, + struct cros_ec_command *msg); /* These are used to implement the platform-specific interface */ void *priv; @@ -112,8 +107,6 @@ struct cros_ec_device { struct device *parent; bool wake_enabled; struct mutex lock; - int (*cmd_xfer)(struct cros_ec_device *ec, - struct cros_ec_command *msg); }; /** -- 2.0.0.526.g5318336 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 08/10] mfd: cros_ec: cleanup: Remove EC wrapper functions 2014-06-16 21:39 ` [PATCH 08/10] mfd: cros_ec: cleanup: Remove EC wrapper functions Doug Anderson @ 2014-06-18 3:42 ` Simon Glass 2014-06-18 4:27 ` Doug Anderson 0 siblings, 1 reply; 11+ messages in thread From: Simon Glass @ 2014-06-18 3:42 UTC (permalink / raw) To: Doug Anderson Cc: Lee Jones, Andrew Bresticker, Stephen Warren, Olof Johansson, Sonny Rao, linux-samsung-soc, Javier Martinez Canillas, Bill Richardson, Wolfram Sang, Mark Brown, Dmitry Torokhov, Samuel Ortiz, Vincent Palatin, Geert Uytterhoeven, linux-i2c@vger.kernel.org, lk, linux-input@vger.kernel.org Hi Doug, On 16 June 2014 14:39, Doug Anderson <dianders@chromium.org> wrote: > From: Bill Richardson <wfrichar@chromium.org> > > Remove the three wrapper functions that talk to the EC without passing all > the desired arguments and just use the underlying communication function > that passes everything in a struct intead. > > This is internal code refactoring only. Nothing should change. > > Signed-off-by: Bill Richardson <wfrichar@chromium.org> > Signed-off-by: Doug Anderson <dianders@chromium.org> > --- > drivers/i2c/busses/i2c-cros-ec-tunnel.c | 15 +++++++++++---- > drivers/input/keyboard/cros_ec_keyb.c | 14 ++++++++++++-- > drivers/mfd/cros_ec.c | 32 -------------------------------- > include/linux/mfd/cros_ec.h | 19 ++++++------------- > 4 files changed, 29 insertions(+), 51 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-cros-ec-tunnel.c b/drivers/i2c/busses/i2c-cros-ec-tunnel.c > index 8e7a714..dd07818 100644 > --- a/drivers/i2c/busses/i2c-cros-ec-tunnel.c > +++ b/drivers/i2c/busses/i2c-cros-ec-tunnel.c > @@ -183,6 +183,7 @@ static int ec_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg i2c_msgs[], > u8 *request = NULL; > u8 *response = NULL; > int result; > + struct cros_ec_command msg; > > request_len = ec_i2c_count_message(i2c_msgs, num); > if (request_len < 0) { > @@ -218,9 +219,15 @@ static int ec_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg i2c_msgs[], > } > > ec_i2c_construct_message(request, i2c_msgs, num, bus_num); > - result = bus->ec->command_sendrecv(bus->ec, EC_CMD_I2C_PASSTHRU, > - request, request_len, > - response, response_len); > + > + msg.version = 0; > + msg.command = EC_CMD_I2C_PASSTHRU; > + msg.outdata = request; > + msg.outsize = request_len; > + msg.indata = response; > + msg.insize = response_len; > + > + result = bus->ec->cmd_xfer(bus->ec, &msg); > if (result) > goto exit; > > @@ -258,7 +265,7 @@ static int ec_i2c_probe(struct platform_device *pdev) > u32 remote_bus; > int err; > > - if (!ec->command_sendrecv) { > + if (!ec->cmd_xfer) { > dev_err(dev, "Missing sendrecv\n"); > return -EINVAL; > } > diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c > index 4083796..dc37b6b 100644 > --- a/drivers/input/keyboard/cros_ec_keyb.c > +++ b/drivers/input/keyboard/cros_ec_keyb.c > @@ -191,8 +191,18 @@ static void cros_ec_keyb_close(struct input_dev *dev) > > static int cros_ec_keyb_get_state(struct cros_ec_keyb *ckdev, uint8_t *kb_state) > { > - return ckdev->ec->command_recv(ckdev->ec, EC_CMD_MKBP_STATE, > - kb_state, ckdev->cols); > + int ret; > + struct cros_ec_command msg = { > + .version = 0, > + .command = EC_CMD_MKBP_STATE, > + .outdata = NULL, > + .outsize = 0, > + .indata = kb_state, > + .insize = ckdev->cols, > + }; > + > + ret = ckdev->ec->cmd_xfer(ckdev->ec, &msg); Do we need ret? > + return ret; > } > > static int cros_ec_keyb_work(struct notifier_block *nb, > diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c > index d242714..6dd91e9 100644 > --- a/drivers/mfd/cros_ec.c > +++ b/drivers/mfd/cros_ec.c > @@ -44,34 +44,6 @@ int cros_ec_prepare_tx(struct cros_ec_device *ec_dev, > } > EXPORT_SYMBOL(cros_ec_prepare_tx); > > -static int cros_ec_command_sendrecv(struct cros_ec_device *ec_dev, > - uint16_t cmd, void *out_buf, int out_len, > - void *in_buf, int in_len) > -{ > - struct cros_ec_command msg; > - > - msg.version = cmd >> 8; > - msg.command = cmd & 0xff; > - msg.outdata = out_buf; > - msg.outsize = out_len; > - msg.indata = in_buf; > - msg.insize = in_len; > - > - return ec_dev->cmd_xfer(ec_dev, &msg); > -} > - > -static int cros_ec_command_recv(struct cros_ec_device *ec_dev, > - uint16_t cmd, void *buf, int buf_len) > -{ > - return cros_ec_command_sendrecv(ec_dev, cmd, NULL, 0, buf, buf_len); > -} > - > -static int cros_ec_command_send(struct cros_ec_device *ec_dev, > - uint16_t cmd, void *buf, int buf_len) > -{ > - return cros_ec_command_sendrecv(ec_dev, cmd, buf, buf_len, NULL, 0); > -} > - > static irqreturn_t ec_irq_thread(int irq, void *data) > { > struct cros_ec_device *ec_dev = data; > @@ -104,10 +76,6 @@ int cros_ec_register(struct cros_ec_device *ec_dev) > > BLOCKING_INIT_NOTIFIER_HEAD(&ec_dev->event_notifier); > > - ec_dev->command_send = cros_ec_command_send; > - ec_dev->command_recv = cros_ec_command_recv; > - ec_dev->command_sendrecv = cros_ec_command_sendrecv; > - > if (ec_dev->din_size) { > ec_dev->din = devm_kzalloc(dev, ec_dev->din_size, GFP_KERNEL); > if (!ec_dev->din) > diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h > index 2b0c598..60c0880 100644 > --- a/include/linux/mfd/cros_ec.h > +++ b/include/linux/mfd/cros_ec.h > @@ -63,9 +63,10 @@ struct cros_ec_command { > * @was_wake_device: true if this device was set to wake the system from > * sleep at the last suspend > * @event_notifier: interrupt event notifier for transport devices > - * @command_send: send a command > - * @command_recv: receive a response > - * @command_sendrecv: send a command and receive a response > + * @cmd_xfer: send command to EC and get response > + * Returns 0 if the communication succeeded, but that doesn't mean the EC > + * was happy with the command it got. Caller should check msg.result for > + * the EC's result code. > * > * @priv: Private data > * @irq: Interrupt to use > @@ -83,7 +84,6 @@ struct cros_ec_command { > * @parent: pointer to parent device (e.g. i2c or spi device) > * @wake_enabled: true if this device can wake the system from sleep > * @lock: one transaction at a time > - * @cmd_xfer: low-level channel to the EC > */ > struct cros_ec_device { > > @@ -94,13 +94,8 @@ struct cros_ec_device { > bool was_wake_device; > struct class *cros_class; > struct blocking_notifier_head event_notifier; > - int (*command_send)(struct cros_ec_device *ec, > - uint16_t cmd, void *out_buf, int out_len); > - int (*command_recv)(struct cros_ec_device *ec, > - uint16_t cmd, void *in_buf, int in_len); > - int (*command_sendrecv)(struct cros_ec_device *ec, > - uint16_t cmd, void *out_buf, int out_len, > - void *in_buf, int in_len); > + int (*cmd_xfer)(struct cros_ec_device *ec, > + struct cros_ec_command *msg); > > /* These are used to implement the platform-specific interface */ > void *priv; > @@ -112,8 +107,6 @@ struct cros_ec_device { > struct device *parent; > bool wake_enabled; > struct mutex lock; > - int (*cmd_xfer)(struct cros_ec_device *ec, > - struct cros_ec_command *msg); Seems odd - maybe this line move of cmd_xfer() should be in an earlier patch? Regards, Simon ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 08/10] mfd: cros_ec: cleanup: Remove EC wrapper functions 2014-06-18 3:42 ` Simon Glass @ 2014-06-18 4:27 ` Doug Anderson [not found] ` <CAD=FV=Ue9OBkXtii4aKrCbKPd--7ZRN_G0pw2ZtX89mcz_hfzQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2014-06-18 7:40 ` Lee Jones 0 siblings, 2 replies; 11+ messages in thread From: Doug Anderson @ 2014-06-18 4:27 UTC (permalink / raw) To: Simon Glass Cc: Lee Jones, Andrew Bresticker, Stephen Warren, Olof Johansson, Sonny Rao, linux-samsung-soc, Javier Martinez Canillas, Bill Richardson, Wolfram Sang, Mark Brown, Dmitry Torokhov, Samuel Ortiz, Vincent Palatin, Geert Uytterhoeven, linux-i2c@vger.kernel.org, lk, linux-input@vger.kernel.org Simon, On Tue, Jun 17, 2014 at 8:42 PM, Simon Glass <sjg@chromium.org> wrote: >> diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c >> index 4083796..dc37b6b 100644 >> --- a/drivers/input/keyboard/cros_ec_keyb.c >> +++ b/drivers/input/keyboard/cros_ec_keyb.c >> @@ -191,8 +191,18 @@ static void cros_ec_keyb_close(struct input_dev *dev) >> >> static int cros_ec_keyb_get_state(struct cros_ec_keyb *ckdev, uint8_t *kb_state) >> { >> - return ckdev->ec->command_recv(ckdev->ec, EC_CMD_MKBP_STATE, >> - kb_state, ckdev->cols); >> + int ret; >> + struct cros_ec_command msg = { >> + .version = 0, >> + .command = EC_CMD_MKBP_STATE, >> + .outdata = NULL, >> + .outsize = 0, >> + .indata = kb_state, >> + .insize = ckdev->cols, >> + }; >> + >> + ret = ckdev->ec->cmd_xfer(ckdev->ec, &msg); > > Do we need ret? No. If you wish I will spin without it. Let me know. Note that locally this code includes a comment between the above and the return: /* FIXME: This assumes msg.result == EC_RES_SUCCESS */ Given that this is not a new problem introduced in this code, that it still hasn't been fixed locally in the ChromeOS tree, and that generally FIXMEs don't seem to be left in the code upstream, I left it out. >> diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h >> index 2b0c598..60c0880 100644 >> --- a/include/linux/mfd/cros_ec.h >> +++ b/include/linux/mfd/cros_ec.h >> @@ -63,9 +63,10 @@ struct cros_ec_command { >> * @was_wake_device: true if this device was set to wake the system from >> * sleep at the last suspend >> * @event_notifier: interrupt event notifier for transport devices >> - * @command_send: send a command >> - * @command_recv: receive a response >> - * @command_sendrecv: send a command and receive a response >> + * @cmd_xfer: send command to EC and get response >> + * Returns 0 if the communication succeeded, but that doesn't mean the EC >> + * was happy with the command it got. Caller should check msg.result for >> + * the EC's result code. >> * >> * @priv: Private data >> * @irq: Interrupt to use >> @@ -83,7 +84,6 @@ struct cros_ec_command { >> * @parent: pointer to parent device (e.g. i2c or spi device) >> * @wake_enabled: true if this device can wake the system from sleep >> * @lock: one transaction at a time >> - * @cmd_xfer: low-level channel to the EC >> */ >> struct cros_ec_device { >> >> @@ -94,13 +94,8 @@ struct cros_ec_device { >> bool was_wake_device; >> struct class *cros_class; >> struct blocking_notifier_head event_notifier; >> - int (*command_send)(struct cros_ec_device *ec, >> - uint16_t cmd, void *out_buf, int out_len); >> - int (*command_recv)(struct cros_ec_device *ec, >> - uint16_t cmd, void *in_buf, int in_len); >> - int (*command_sendrecv)(struct cros_ec_device *ec, >> - uint16_t cmd, void *out_buf, int out_len, >> - void *in_buf, int in_len); >> + int (*cmd_xfer)(struct cros_ec_device *ec, >> + struct cros_ec_command *msg); >> >> /* These are used to implement the platform-specific interface */ >> void *priv; >> @@ -112,8 +107,6 @@ struct cros_ec_device { >> struct device *parent; >> bool wake_enabled; >> struct mutex lock; >> - int (*cmd_xfer)(struct cros_ec_device *ec, >> - struct cros_ec_command *msg); > > Seems odd - maybe this line move of cmd_xfer() should be in an earlier patch? It got moved from "private" to public. Bill reorganized all the public stuff at the top and the private at the bottom. -Doug ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <CAD=FV=Ue9OBkXtii4aKrCbKPd--7ZRN_G0pw2ZtX89mcz_hfzQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH 08/10] mfd: cros_ec: cleanup: Remove EC wrapper functions [not found] ` <CAD=FV=Ue9OBkXtii4aKrCbKPd--7ZRN_G0pw2ZtX89mcz_hfzQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2014-06-18 5:05 ` Simon Glass 0 siblings, 0 replies; 11+ messages in thread From: Simon Glass @ 2014-06-18 5:05 UTC (permalink / raw) To: Doug Anderson Cc: Lee Jones, Andrew Bresticker, Stephen Warren, Olof Johansson, Sonny Rao, linux-samsung-soc, Javier Martinez Canillas, Bill Richardson, Wolfram Sang, Mark Brown, Dmitry Torokhov, Samuel Ortiz, Vincent Palatin, Geert Uytterhoeven, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, lk, linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Hi Doug, On 17 June 2014 21:27, Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> wrote: > Simon, > > On Tue, Jun 17, 2014 at 8:42 PM, Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> wrote: >>> diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c >>> index 4083796..dc37b6b 100644 >>> --- a/drivers/input/keyboard/cros_ec_keyb.c >>> +++ b/drivers/input/keyboard/cros_ec_keyb.c >>> @@ -191,8 +191,18 @@ static void cros_ec_keyb_close(struct input_dev *dev) >>> >>> static int cros_ec_keyb_get_state(struct cros_ec_keyb *ckdev, uint8_t *kb_state) >>> { >>> - return ckdev->ec->command_recv(ckdev->ec, EC_CMD_MKBP_STATE, >>> - kb_state, ckdev->cols); >>> + int ret; >>> + struct cros_ec_command msg = { >>> + .version = 0, >>> + .command = EC_CMD_MKBP_STATE, >>> + .outdata = NULL, >>> + .outsize = 0, >>> + .indata = kb_state, >>> + .insize = ckdev->cols, >>> + }; >>> + >>> + ret = ckdev->ec->cmd_xfer(ckdev->ec, &msg); >> >> Do we need ret? > > No. If you wish I will spin without it. Let me know. > > Note that locally this code includes a comment between the above and the return: > /* FIXME: This assumes msg.result == EC_RES_SUCCESS */ It's not important to me, and you've explained the other question. Reviewed-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 08/10] mfd: cros_ec: cleanup: Remove EC wrapper functions 2014-06-18 4:27 ` Doug Anderson [not found] ` <CAD=FV=Ue9OBkXtii4aKrCbKPd--7ZRN_G0pw2ZtX89mcz_hfzQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2014-06-18 7:40 ` Lee Jones 1 sibling, 0 replies; 11+ messages in thread From: Lee Jones @ 2014-06-18 7:40 UTC (permalink / raw) To: Doug Anderson Cc: Simon Glass, Andrew Bresticker, Stephen Warren, Olof Johansson, Sonny Rao, linux-samsung-soc, Javier Martinez Canillas, Bill Richardson, Wolfram Sang, Mark Brown, Dmitry Torokhov, Samuel Ortiz, Vincent Palatin, Geert Uytterhoeven, linux-i2c@vger.kernel.org, lk, linux-input@vger.kernel.org > >> diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c > >> index 4083796..dc37b6b 100644 > >> --- a/drivers/input/keyboard/cros_ec_keyb.c > >> +++ b/drivers/input/keyboard/cros_ec_keyb.c > >> @@ -191,8 +191,18 @@ static void cros_ec_keyb_close(struct input_dev *dev) > >> > >> static int cros_ec_keyb_get_state(struct cros_ec_keyb *ckdev, uint8_t *kb_state) > >> { > >> - return ckdev->ec->command_recv(ckdev->ec, EC_CMD_MKBP_STATE, > >> - kb_state, ckdev->cols); > >> + int ret; > >> + struct cros_ec_command msg = { > >> + .version = 0, > >> + .command = EC_CMD_MKBP_STATE, > >> + .outdata = NULL, > >> + .outsize = 0, > >> + .indata = kb_state, > >> + .insize = ckdev->cols, > >> + }; > >> + > >> + ret = ckdev->ec->cmd_xfer(ckdev->ec, &msg); > > > > Do we need ret? > > No. If you wish I will spin without it. Let me know. > > Note that locally this code includes a comment between the above and the return: > /* FIXME: This assumes msg.result == EC_RES_SUCCESS */ > > Given that this is not a new problem introduced in this code, that it > still hasn't been fixed locally in the ChromeOS tree, and that > generally FIXMEs don't seem to be left in the code upstream, I left it > out. As you're re-spinning anyway, please fix this and add my: Acked-by: Lee Jones <lee.jones@linaro.org> > >> diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h > >> index 2b0c598..60c0880 100644 > >> --- a/include/linux/mfd/cros_ec.h > >> +++ b/include/linux/mfd/cros_ec.h > >> @@ -63,9 +63,10 @@ struct cros_ec_command { > >> * @was_wake_device: true if this device was set to wake the system from > >> * sleep at the last suspend > >> * @event_notifier: interrupt event notifier for transport devices > >> - * @command_send: send a command > >> - * @command_recv: receive a response > >> - * @command_sendrecv: send a command and receive a response > >> + * @cmd_xfer: send command to EC and get response > >> + * Returns 0 if the communication succeeded, but that doesn't mean the EC > >> + * was happy with the command it got. Caller should check msg.result for > >> + * the EC's result code. > >> * > >> * @priv: Private data > >> * @irq: Interrupt to use > >> @@ -83,7 +84,6 @@ struct cros_ec_command { > >> * @parent: pointer to parent device (e.g. i2c or spi device) > >> * @wake_enabled: true if this device can wake the system from sleep > >> * @lock: one transaction at a time > >> - * @cmd_xfer: low-level channel to the EC > >> */ > >> struct cros_ec_device { > >> > >> @@ -94,13 +94,8 @@ struct cros_ec_device { > >> bool was_wake_device; > >> struct class *cros_class; > >> struct blocking_notifier_head event_notifier; > >> - int (*command_send)(struct cros_ec_device *ec, > >> - uint16_t cmd, void *out_buf, int out_len); > >> - int (*command_recv)(struct cros_ec_device *ec, > >> - uint16_t cmd, void *in_buf, int in_len); > >> - int (*command_sendrecv)(struct cros_ec_device *ec, > >> - uint16_t cmd, void *out_buf, int out_len, > >> - void *in_buf, int in_len); > >> + int (*cmd_xfer)(struct cros_ec_device *ec, > >> + struct cros_ec_command *msg); > >> > >> /* These are used to implement the platform-specific interface */ > >> void *priv; > >> @@ -112,8 +107,6 @@ struct cros_ec_device { > >> struct device *parent; > >> bool wake_enabled; > >> struct mutex lock; > >> - int (*cmd_xfer)(struct cros_ec_device *ec, > >> - struct cros_ec_command *msg); > > > > Seems odd - maybe this line move of cmd_xfer() should be in an earlier patch? > > It got moved from "private" to public. Bill reorganized all the > public stuff at the top and the private at the bottom. > > -Doug -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <1402954800-28215-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>]
* [PATCH 10/10] mfd: cros_ec: ec_dev->cmd_xfer() returns number of bytes received from EC [not found] ` <1402954800-28215-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> @ 2014-06-16 21:40 ` Doug Anderson [not found] ` <1402954800-28215-11-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Doug Anderson @ 2014-06-16 21:40 UTC (permalink / raw) To: Lee Jones Cc: Andrew Bresticker, swarren-3lzwWm7+Weoh9ZMKESR00Q, olof-nZhT3qVonbNeoWH0uzbU5w, Sonny Rao, linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA, Javier Martinez Canillas, Bill Richardson, sjg-F7+t8E8rja9g9hUCZPvPmw, Wolfram Sang, broonie-DgEjT+Ai2ygdnm+yROfE0A, Doug Anderson, sameo-VuQAYsv1563Yd54FQh9/CA, vpalatin-F7+t8E8rja9g9hUCZPvPmw, linux-i2c-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA From: Bill Richardson <wfrichar-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> 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-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> Signed-off-by: Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> --- drivers/i2c/busses/i2c-cros-ec-tunnel.c | 2 +- drivers/mfd/cros_ec_i2c.c | 2 +- drivers/mfd/cros_ec_spi.c | 2 +- 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 dd07818..05e033c 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[], msg.insize = response_len; result = bus->ec->cmd_xfer(bus->ec, &msg); - if (result) + if (result < 0) goto exit; 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 2276096..dc0ba29 100644 --- a/drivers/mfd/cros_ec_i2c.c +++ b/drivers/mfd/cros_ec_i2c.c @@ -120,7 +120,7 @@ static int cros_ec_cmd_xfer_i2c(struct cros_ec_device *ec_dev, goto done; } - ret = 0; + ret = i2c_msg[1].buf[1]; done: kfree(in_buf); kfree(out_buf); diff --git a/drivers/mfd/cros_ec_spi.c b/drivers/mfd/cros_ec_spi.c index 4d34f1c..beba1bc 100644 --- a/drivers/mfd/cros_ec_spi.c +++ b/drivers/mfd/cros_ec_spi.c @@ -333,7 +333,7 @@ static int cros_ec_cmd_xfer_spi(struct cros_ec_device *ec_dev, goto exit; } - ret = 0; + ret = len; exit: mutex_unlock(&ec_spi->lock); return ret; diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h index 60c0880..7b65a75 100644 --- a/include/linux/mfd/cros_ec.h +++ b/include/linux/mfd/cros_ec.h @@ -41,7 +41,7 @@ enum { * @outdata: Outgoing data to EC * @outsize: Outgoing length in bytes * @indata: Where to put the incoming data from EC - * @insize: Incoming length in bytes (filled in by EC) + * @insize: Max number of bytes to accept from EC * @result: EC's response to the command (separate from communication failure) */ struct cros_ec_command { @@ -64,9 +64,9 @@ struct cros_ec_command { * sleep at the last suspend * @event_notifier: interrupt event notifier for transport devices * @cmd_xfer: send command to EC and get response - * Returns 0 if the communication succeeded, but that doesn't mean the EC - * was happy with the command it got. Caller should check msg.result for - * the EC's result code. + * Returns the number of bytes received if the communication succeeded, but + * that doesn't mean the EC was happy with the command. The caller + * should check msg.result for the EC's result code. * * @priv: Private data * @irq: Interrupt to use -- 2.0.0.526.g5318336 ^ permalink raw reply related [flat|nested] 11+ messages in thread
[parent not found: <1402954800-28215-11-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>]
* Re: [PATCH 10/10] mfd: cros_ec: ec_dev->cmd_xfer() returns number of bytes received from EC [not found] ` <1402954800-28215-11-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> @ 2014-06-18 3:46 ` Simon Glass 2014-06-18 4:54 ` Doug Anderson 2014-06-18 7:34 ` Lee Jones 1 sibling, 1 reply; 11+ messages in thread From: Simon Glass @ 2014-06-18 3:46 UTC (permalink / raw) To: Doug Anderson Cc: Lee Jones, Andrew Bresticker, Stephen Warren, Olof Johansson, Sonny Rao, linux-samsung-soc, Javier Martinez Canillas, Bill Richardson, Wolfram Sang, Mark Brown, Samuel Ortiz, Vincent Palatin, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, lk Hi, On 16 June 2014 14:40, Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> wrote: > From: Bill Richardson <wfrichar-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> > > When communicating with the EC, the cmd_xfer() function should return the > number of bytes it received from the EC, or negative on error. This is just for the I2C tunnel feature, right? If so, I think this should be mentioned here. It seems to be affecting ec_i2c_xfer(), not cmd_xfer(). > > Signed-off-by: Bill Richardson <wfrichar-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> > Signed-off-by: Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> > --- > drivers/i2c/busses/i2c-cros-ec-tunnel.c | 2 +- > drivers/mfd/cros_ec_i2c.c | 2 +- > drivers/mfd/cros_ec_spi.c | 2 +- > 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 dd07818..05e033c 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[], > msg.insize = response_len; > > result = bus->ec->cmd_xfer(bus->ec, &msg); > - if (result) > + if (result < 0) > goto exit; > > 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 2276096..dc0ba29 100644 > --- a/drivers/mfd/cros_ec_i2c.c > +++ b/drivers/mfd/cros_ec_i2c.c > @@ -120,7 +120,7 @@ static int cros_ec_cmd_xfer_i2c(struct cros_ec_device *ec_dev, > goto done; > } > > - ret = 0; > + ret = i2c_msg[1].buf[1]; > done: > kfree(in_buf); > kfree(out_buf); > diff --git a/drivers/mfd/cros_ec_spi.c b/drivers/mfd/cros_ec_spi.c > index 4d34f1c..beba1bc 100644 > --- a/drivers/mfd/cros_ec_spi.c > +++ b/drivers/mfd/cros_ec_spi.c > @@ -333,7 +333,7 @@ static int cros_ec_cmd_xfer_spi(struct cros_ec_device *ec_dev, > goto exit; > } > > - ret = 0; > + ret = len; > exit: > mutex_unlock(&ec_spi->lock); > return ret; > diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h > index 60c0880..7b65a75 100644 > --- a/include/linux/mfd/cros_ec.h > +++ b/include/linux/mfd/cros_ec.h > @@ -41,7 +41,7 @@ enum { > * @outdata: Outgoing data to EC > * @outsize: Outgoing length in bytes > * @indata: Where to put the incoming data from EC > - * @insize: Incoming length in bytes (filled in by EC) > + * @insize: Max number of bytes to accept from EC > * @result: EC's response to the command (separate from communication failure) > */ > struct cros_ec_command { > @@ -64,9 +64,9 @@ struct cros_ec_command { > * sleep at the last suspend > * @event_notifier: interrupt event notifier for transport devices > * @cmd_xfer: send command to EC and get response > - * Returns 0 if the communication succeeded, but that doesn't mean the EC > - * was happy with the command it got. Caller should check msg.result for > - * the EC's result code. > + * Returns the number of bytes received if the communication succeeded, but > + * that doesn't mean the EC was happy with the command. The caller > + * should check msg.result for the EC's result code. > * > * @priv: Private data > * @irq: Interrupt to use > -- > 2.0.0.526.g5318336 > Regards, Simon ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 10/10] mfd: cros_ec: ec_dev->cmd_xfer() returns number of bytes received from EC 2014-06-18 3:46 ` Simon Glass @ 2014-06-18 4:54 ` Doug Anderson 2014-06-18 5:07 ` Simon Glass 0 siblings, 1 reply; 11+ messages in thread From: Doug Anderson @ 2014-06-18 4:54 UTC (permalink / raw) To: Simon Glass Cc: Lee Jones, Andrew Bresticker, Stephen Warren, Olof Johansson, Sonny Rao, linux-samsung-soc, Javier Martinez Canillas, Bill Richardson, Wolfram Sang, Mark Brown, Samuel Ortiz, Vincent Palatin, linux-i2c@vger.kernel.org, lk Simon, On Tue, Jun 17, 2014 at 8:46 PM, Simon Glass <sjg@chromium.org> wrote: > Hi, > > On 16 June 2014 14:40, Doug Anderson <dianders@chromium.org> wrote: >> From: Bill Richardson <wfrichar@chromium.org> >> >> When communicating with the EC, the cmd_xfer() function should return the >> number of bytes it received from the EC, or negative on error. > > This is just for the I2C tunnel feature, right? If so, I think this > should be mentioned here. It seems to be affecting ec_i2c_xfer(), not > cmd_xfer(). No, the tunnel feature is implemented just fine without this (and is already landed and working). It looks like the (not yet upstreamed) ec_i2c_limited_xfer for spring returns this new value directly but I'm not convinced that's technicall correct. Bill can correct me if I'm wrong, but I think this is primarily interesting once we add in cros_ec_dev (the userspace API) which needs this info. Until that happens this patch doesn't hurt and just returns some extra info. -Doug ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 10/10] mfd: cros_ec: ec_dev->cmd_xfer() returns number of bytes received from EC 2014-06-18 4:54 ` Doug Anderson @ 2014-06-18 5:07 ` Simon Glass 0 siblings, 0 replies; 11+ messages in thread From: Simon Glass @ 2014-06-18 5:07 UTC (permalink / raw) To: Doug Anderson Cc: Lee Jones, Andrew Bresticker, Stephen Warren, Olof Johansson, Sonny Rao, linux-samsung-soc, Javier Martinez Canillas, Bill Richardson, Wolfram Sang, Mark Brown, Samuel Ortiz, Vincent Palatin, linux-i2c@vger.kernel.org, lk Hi Doug, On 17 June 2014 21:54, Doug Anderson <dianders@chromium.org> wrote: > Simon, > > On Tue, Jun 17, 2014 at 8:46 PM, Simon Glass <sjg@chromium.org> wrote: >> Hi, >> >> On 16 June 2014 14:40, Doug Anderson <dianders@chromium.org> wrote: >>> From: Bill Richardson <wfrichar@chromium.org> >>> >>> When communicating with the EC, the cmd_xfer() function should return the >>> number of bytes it received from the EC, or negative on error. >> >> This is just for the I2C tunnel feature, right? If so, I think this >> should be mentioned here. It seems to be affecting ec_i2c_xfer(), not >> cmd_xfer(). > > No, the tunnel feature is implemented just fine without this (and is > already landed and working). It looks like the (not yet upstreamed) > ec_i2c_limited_xfer for spring returns this new value directly but I'm > not convinced that's technicall correct. > > Bill can correct me if I'm wrong, but I think this is primarily > interesting once we add in cros_ec_dev (the userspace API) which needs > this info. Until that happens this patch doesn't hurt and just > returns some extra info. Agreed. Reviewed-by: Simon Glass <sjg@chromium.org> Regards, Simon ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 10/10] mfd: cros_ec: ec_dev->cmd_xfer() returns number of bytes received from EC [not found] ` <1402954800-28215-11-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> 2014-06-18 3:46 ` Simon Glass @ 2014-06-18 7:34 ` Lee Jones 1 sibling, 0 replies; 11+ messages in thread From: Lee Jones @ 2014-06-18 7:34 UTC (permalink / raw) To: Doug Anderson Cc: Andrew Bresticker, swarren-3lzwWm7+Weoh9ZMKESR00Q, olof-nZhT3qVonbNeoWH0uzbU5w, Sonny Rao, linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA, Javier Martinez Canillas, Bill Richardson, sjg-F7+t8E8rja9g9hUCZPvPmw, Wolfram Sang, broonie-DgEjT+Ai2ygdnm+yROfE0A, sameo-VuQAYsv1563Yd54FQh9/CA, vpalatin-F7+t8E8rja9g9hUCZPvPmw, linux-i2c-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Mon, 16 Jun 2014, Doug Anderson wrote: > From: Bill Richardson <wfrichar-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> > > 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-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> > Signed-off-by: Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> > --- > drivers/i2c/busses/i2c-cros-ec-tunnel.c | 2 +- > drivers/mfd/cros_ec_i2c.c | 2 +- > drivers/mfd/cros_ec_spi.c | 2 +- > include/linux/mfd/cros_ec.h | 8 ++++---- > 4 files changed, 7 insertions(+), 7 deletions(-) For the re-spin: Acked-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > diff --git a/drivers/i2c/busses/i2c-cros-ec-tunnel.c b/drivers/i2c/busses/i2c-cros-ec-tunnel.c > index dd07818..05e033c 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[], > msg.insize = response_len; > > result = bus->ec->cmd_xfer(bus->ec, &msg); > - if (result) > + if (result < 0) > goto exit; > > 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 2276096..dc0ba29 100644 > --- a/drivers/mfd/cros_ec_i2c.c > +++ b/drivers/mfd/cros_ec_i2c.c > @@ -120,7 +120,7 @@ static int cros_ec_cmd_xfer_i2c(struct cros_ec_device *ec_dev, > goto done; > } > > - ret = 0; > + ret = i2c_msg[1].buf[1]; > done: > kfree(in_buf); > kfree(out_buf); > diff --git a/drivers/mfd/cros_ec_spi.c b/drivers/mfd/cros_ec_spi.c > index 4d34f1c..beba1bc 100644 > --- a/drivers/mfd/cros_ec_spi.c > +++ b/drivers/mfd/cros_ec_spi.c > @@ -333,7 +333,7 @@ static int cros_ec_cmd_xfer_spi(struct cros_ec_device *ec_dev, > goto exit; > } > > - ret = 0; > + ret = len; > exit: > mutex_unlock(&ec_spi->lock); > return ret; > diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h > index 60c0880..7b65a75 100644 > --- a/include/linux/mfd/cros_ec.h > +++ b/include/linux/mfd/cros_ec.h > @@ -41,7 +41,7 @@ enum { > * @outdata: Outgoing data to EC > * @outsize: Outgoing length in bytes > * @indata: Where to put the incoming data from EC > - * @insize: Incoming length in bytes (filled in by EC) > + * @insize: Max number of bytes to accept from EC > * @result: EC's response to the command (separate from communication failure) > */ > struct cros_ec_command { > @@ -64,9 +64,9 @@ struct cros_ec_command { > * sleep at the last suspend > * @event_notifier: interrupt event notifier for transport devices > * @cmd_xfer: send command to EC and get response > - * Returns 0 if the communication succeeded, but that doesn't mean the EC > - * was happy with the command it got. Caller should check msg.result for > - * the EC's result code. > + * Returns the number of bytes received if the communication succeeded, but > + * that doesn't mean the EC was happy with the command. The caller > + * should check msg.result for the EC's result code. > * > * @priv: Private data > * @irq: Interrupt to use -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2014-06-18 7:40 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-16 21:39 [PATCH 0/10] Batch of cleanup patches for cros_ec Doug Anderson
2014-06-16 21:39 ` [PATCH 08/10] mfd: cros_ec: cleanup: Remove EC wrapper functions Doug Anderson
2014-06-18 3:42 ` Simon Glass
2014-06-18 4:27 ` Doug Anderson
[not found] ` <CAD=FV=Ue9OBkXtii4aKrCbKPd--7ZRN_G0pw2ZtX89mcz_hfzQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-18 5:05 ` Simon Glass
2014-06-18 7:40 ` Lee Jones
[not found] ` <1402954800-28215-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2014-06-16 21:40 ` [PATCH 10/10] mfd: cros_ec: ec_dev->cmd_xfer() returns number of bytes received from EC Doug Anderson
[not found] ` <1402954800-28215-11-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2014-06-18 3:46 ` Simon Glass
2014-06-18 4:54 ` Doug Anderson
2014-06-18 5:07 ` Simon Glass
2014-06-18 7:34 ` Lee Jones
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).