* [PATCH 0/8] Migrate all cros_ec_cmd_xfer() calls to cros_ec_cmd_xfer_status()
@ 2020-02-20 15:58 Enric Balletbo i Serra
2020-02-20 15:58 ` [PATCH 2/8] Input: cros_ec_keyb: Use cros_ec_cmd_xfer_status helper Enric Balletbo i Serra
2020-02-26 1:12 ` [PATCH 0/8] Migrate all cros_ec_cmd_xfer() calls to cros_ec_cmd_xfer_status() Prashant Malani
0 siblings, 2 replies; 4+ messages in thread
From: Enric Balletbo i Serra @ 2020-02-20 15:58 UTC (permalink / raw)
To: linux-kernel
Cc: Collabora Kernel ML, groeck, bleung, dtor, gwendal, pmalani,
Enrico Granata, Andy Shevchenko, Jonathan Cameron, Ting Shen,
Lee Jones, Neil Armstrong, Dmitry Torokhov, Fei Shao,
Pi-Hsun Shih, Evan Green, linux-input
Dear all,
The purpose of this series is get rid of the remaining places where the
cros_ec_cmd_xfer() function is used in favour of the
cros_ec_cmd_xfer_status() helper. This allows us to make the
cros_ec_cmd_xfer() function private and only expose to the users a
single way to send commands to the Embedded Controller.
With these changes we also want to help future improvements in the
interface, like the Prashant's series (i.e [1]) to introduce a
cros_ec_cmd() that will allow us to remove more duplicated code in
different places.
Best regards,
Enric
Note: Prashant, looks like you should fix your sendmail as the patches
are not threaded.
[1] https://lkml.org/lkml/2020/2/5/614
Enric Balletbo i Serra (8):
platform/chrome: cros_ec_proto: Report command not supported
Input: cros_ec_keyb: Use cros_ec_cmd_xfer_status helper
platform/chrome: cros_ec_vbc: Use cros_ec_cmd_xfer_status helper
platform/chrome: cros_ec_chardev: Use cros_ec_cmd_xfer_status helper
platform/chrome: cros_ec_sysfs: Use cros_ec_cmd_xfer_status helper
platform/chrome: cros_ec_lightbar: Use cros_ec_cmd_xfer_status helper
platform/chrome: cros_ec: Use cros_ec_cmd_xfer_status helper
platform/chrome: cros_ec_proto: Do not export cros_ec_cmd_xfer()
drivers/input/keyboard/cros_ec_keyb.c | 14 +++---
drivers/platform/chrome/cros_ec.c | 2 +-
drivers/platform/chrome/cros_ec_chardev.c | 2 +-
drivers/platform/chrome/cros_ec_lightbar.c | 50 ++++++---------------
drivers/platform/chrome/cros_ec_proto.c | 14 ++++--
drivers/platform/chrome/cros_ec_sysfs.c | 36 +++++++--------
drivers/platform/chrome/cros_ec_vbc.c | 4 +-
include/linux/platform_data/cros_ec_proto.h | 3 --
8 files changed, 50 insertions(+), 75 deletions(-)
--
2.25.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/8] Input: cros_ec_keyb: Use cros_ec_cmd_xfer_status helper
2020-02-20 15:58 [PATCH 0/8] Migrate all cros_ec_cmd_xfer() calls to cros_ec_cmd_xfer_status() Enric Balletbo i Serra
@ 2020-02-20 15:58 ` Enric Balletbo i Serra
2020-03-02 10:08 ` Enric Balletbo i Serra
2020-02-26 1:12 ` [PATCH 0/8] Migrate all cros_ec_cmd_xfer() calls to cros_ec_cmd_xfer_status() Prashant Malani
1 sibling, 1 reply; 4+ messages in thread
From: Enric Balletbo i Serra @ 2020-02-20 15:58 UTC (permalink / raw)
To: linux-kernel
Cc: Collabora Kernel ML, groeck, bleung, dtor, gwendal, pmalani,
Jonathan Cameron, Ting Shen, Neil Armstrong, Dmitry Torokhov,
Fei Shao, linux-input
This patch makes use of cros_ec_cmd_xfer_status() instead of
cros_ec_cmd_xfer(). In this case there is no advantage of doing this
apart from that we want to make cros_ec_cmd_xfer() a private function
for the EC protocol and let people only use the
cros_ec_cmd_xfer_status() to return Linux standard error codes.
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
drivers/input/keyboard/cros_ec_keyb.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
index 2b71c5a51f90..fc1793ca2f17 100644
--- a/drivers/input/keyboard/cros_ec_keyb.c
+++ b/drivers/input/keyboard/cros_ec_keyb.c
@@ -347,18 +347,14 @@ static int cros_ec_keyb_info(struct cros_ec_device *ec_dev,
params->info_type = info_type;
params->event_type = event_type;
- ret = cros_ec_cmd_xfer(ec_dev, msg);
- if (ret < 0) {
- dev_warn(ec_dev->dev, "Transfer error %d/%d: %d\n",
- (int)info_type, (int)event_type, ret);
- } else if (msg->result == EC_RES_INVALID_VERSION) {
+ ret = cros_ec_cmd_xfer_status(ec_dev, msg);
+ if (ret == -ENOTSUPP) {
/* With older ECs we just return 0 for everything */
memset(result, 0, result_size);
ret = 0;
- } else if (msg->result != EC_RES_SUCCESS) {
- dev_warn(ec_dev->dev, "Error getting info %d/%d: %d\n",
- (int)info_type, (int)event_type, msg->result);
- ret = -EPROTO;
+ } else if (ret < 0) {
+ dev_warn(ec_dev->dev, "Transfer error %d/%d: %d\n",
+ (int)info_type, (int)event_type, ret);
} else if (ret != result_size) {
dev_warn(ec_dev->dev, "Wrong size %d/%d: %d != %zu\n",
(int)info_type, (int)event_type,
--
2.25.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/8] Migrate all cros_ec_cmd_xfer() calls to cros_ec_cmd_xfer_status()
2020-02-20 15:58 [PATCH 0/8] Migrate all cros_ec_cmd_xfer() calls to cros_ec_cmd_xfer_status() Enric Balletbo i Serra
2020-02-20 15:58 ` [PATCH 2/8] Input: cros_ec_keyb: Use cros_ec_cmd_xfer_status helper Enric Balletbo i Serra
@ 2020-02-26 1:12 ` Prashant Malani
1 sibling, 0 replies; 4+ messages in thread
From: Prashant Malani @ 2020-02-26 1:12 UTC (permalink / raw)
To: Enric Balletbo i Serra
Cc: linux-kernel, Collabora Kernel ML, groeck, bleung, dtor, gwendal,
Enrico Granata, Andy Shevchenko, Jonathan Cameron, Ting Shen,
Lee Jones, Neil Armstrong, Dmitry Torokhov, Fei Shao,
Pi-Hsun Shih, Evan Green, linux-input
On Thu, Feb 20, 2020 at 04:58:51PM +0100, Enric Balletbo i Serra wrote:
> Dear all,
>
> The purpose of this series is get rid of the remaining places where the
> cros_ec_cmd_xfer() function is used in favour of the
> cros_ec_cmd_xfer_status() helper. This allows us to make the
> cros_ec_cmd_xfer() function private and only expose to the users a
> single way to send commands to the Embedded Controller.
>
> With these changes we also want to help future improvements in the
> interface, like the Prashant's series (i.e [1]) to introduce a
> cros_ec_cmd() that will allow us to remove more duplicated code in
> different places.
>
> Best regards,
> Enric
>
> Note: Prashant, looks like you should fix your sendmail as the patches
> are not threaded.
>
> [1] https://lkml.org/lkml/2020/2/5/614
>
> Enric Balletbo i Serra (8):
> platform/chrome: cros_ec_proto: Report command not supported
> Input: cros_ec_keyb: Use cros_ec_cmd_xfer_status helper
> platform/chrome: cros_ec_vbc: Use cros_ec_cmd_xfer_status helper
> platform/chrome: cros_ec_chardev: Use cros_ec_cmd_xfer_status helper
> platform/chrome: cros_ec_sysfs: Use cros_ec_cmd_xfer_status helper
> platform/chrome: cros_ec_lightbar: Use cros_ec_cmd_xfer_status helper
> platform/chrome: cros_ec: Use cros_ec_cmd_xfer_status helper
> platform/chrome: cros_ec_proto: Do not export cros_ec_cmd_xfer()
I picked this series on a device running 4.19 and didn't see any
unusual behaviour or dmesg logs, so for the entire series:
Tested-by: Prashant Malani <pmalani@chromium.org>
>
> drivers/input/keyboard/cros_ec_keyb.c | 14 +++---
> drivers/platform/chrome/cros_ec.c | 2 +-
> drivers/platform/chrome/cros_ec_chardev.c | 2 +-
> drivers/platform/chrome/cros_ec_lightbar.c | 50 ++++++---------------
> drivers/platform/chrome/cros_ec_proto.c | 14 ++++--
> drivers/platform/chrome/cros_ec_sysfs.c | 36 +++++++--------
> drivers/platform/chrome/cros_ec_vbc.c | 4 +-
> include/linux/platform_data/cros_ec_proto.h | 3 --
> 8 files changed, 50 insertions(+), 75 deletions(-)
>
> --
> 2.25.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/8] Input: cros_ec_keyb: Use cros_ec_cmd_xfer_status helper
2020-02-20 15:58 ` [PATCH 2/8] Input: cros_ec_keyb: Use cros_ec_cmd_xfer_status helper Enric Balletbo i Serra
@ 2020-03-02 10:08 ` Enric Balletbo i Serra
0 siblings, 0 replies; 4+ messages in thread
From: Enric Balletbo i Serra @ 2020-03-02 10:08 UTC (permalink / raw)
To: linux-kernel
Cc: Collabora Kernel ML, groeck, bleung, dtor, gwendal, pmalani,
Jonathan Cameron, Ting Shen, Neil Armstrong, Dmitry Torokhov,
Fei Shao, linux-input
Hi Dmitry,
Gentle ping, I'd like feedback from you on this series, and are you fine with
this change?
Thanks,
Enric
On 20/2/20 16:58, Enric Balletbo i Serra wrote:
> This patch makes use of cros_ec_cmd_xfer_status() instead of
> cros_ec_cmd_xfer(). In this case there is no advantage of doing this
> apart from that we want to make cros_ec_cmd_xfer() a private function
> for the EC protocol and let people only use the
> cros_ec_cmd_xfer_status() to return Linux standard error codes.
>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
>
> drivers/input/keyboard/cros_ec_keyb.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
> index 2b71c5a51f90..fc1793ca2f17 100644
> --- a/drivers/input/keyboard/cros_ec_keyb.c
> +++ b/drivers/input/keyboard/cros_ec_keyb.c
> @@ -347,18 +347,14 @@ static int cros_ec_keyb_info(struct cros_ec_device *ec_dev,
> params->info_type = info_type;
> params->event_type = event_type;
>
> - ret = cros_ec_cmd_xfer(ec_dev, msg);
> - if (ret < 0) {
> - dev_warn(ec_dev->dev, "Transfer error %d/%d: %d\n",
> - (int)info_type, (int)event_type, ret);
> - } else if (msg->result == EC_RES_INVALID_VERSION) {
> + ret = cros_ec_cmd_xfer_status(ec_dev, msg);
> + if (ret == -ENOTSUPP) {
> /* With older ECs we just return 0 for everything */
> memset(result, 0, result_size);
> ret = 0;
> - } else if (msg->result != EC_RES_SUCCESS) {
> - dev_warn(ec_dev->dev, "Error getting info %d/%d: %d\n",
> - (int)info_type, (int)event_type, msg->result);
> - ret = -EPROTO;
> + } else if (ret < 0) {
> + dev_warn(ec_dev->dev, "Transfer error %d/%d: %d\n",
> + (int)info_type, (int)event_type, ret);
> } else if (ret != result_size) {
> dev_warn(ec_dev->dev, "Wrong size %d/%d: %d != %zu\n",
> (int)info_type, (int)event_type,
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-02 10:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-20 15:58 [PATCH 0/8] Migrate all cros_ec_cmd_xfer() calls to cros_ec_cmd_xfer_status() Enric Balletbo i Serra
2020-02-20 15:58 ` [PATCH 2/8] Input: cros_ec_keyb: Use cros_ec_cmd_xfer_status helper Enric Balletbo i Serra
2020-03-02 10:08 ` Enric Balletbo i Serra
2020-02-26 1:12 ` [PATCH 0/8] Migrate all cros_ec_cmd_xfer() calls to cros_ec_cmd_xfer_status() Prashant Malani
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).