diff options
author | Brian Norris <briannorris@chromium.org> | 2018-11-07 18:49:38 -0800 |
---|---|---|
committer | Benson Leung <bleung@chromium.org> | 2018-11-13 21:25:14 -0800 |
commit | 475b08734edb3695b9396950c87e75d7c72278a8 (patch) | |
tree | bd15b031be36618b8796d84017658caa9316076d /drivers/platform | |
parent | 651022382c7f8da46cb4872a545ee1da6d097d2a (diff) | |
download | linux-475b08734edb3695b9396950c87e75d7c72278a8.tar.bz2 |
platform/chrome: straighten out cros_ec_get_{next,host}_event() error codes
cros_ec_get_next_event() is documented to return 0 for success and
negative for errors. It currently returns negative for some errors, and
non-negative (number of bytes received) for success (including some "no
data available" responses as zero). This mostly works out OK, because the
callers were more or less ignoring the documentation, and only treating
positive values as success (and indepdently checking the modification of
'wakeup').
Let's button this up by avoiding pretending to handle event/wakeup
distinctions when no event info was retrieved (i.e., returned 0 bytes).
And fix the documentation of cros_ec_get_host_event() and
cros_ec_get_next_event() to accurately describe their behavior.
Signed-off-by: Brian Norris <briannorris@chromium.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Benson Leung <bleung@chromium.org>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/chrome/cros_ec_proto.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c index b6fd4838f60f..fff67b389c87 100644 --- a/drivers/platform/chrome/cros_ec_proto.c +++ b/drivers/platform/chrome/cros_ec_proto.c @@ -580,7 +580,7 @@ int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event) if (!ec_dev->mkbp_event_supported) { ret = get_keyboard_state_event(ec_dev); - if (ret < 0) + if (ret <= 0) return ret; if (wake_event) @@ -590,7 +590,7 @@ int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event) } ret = get_next_event(ec_dev); - if (ret < 0) + if (ret <= 0) return ret; if (wake_event) { |