]> git.baikalelectronics.ru Git - kernel.git/commit
platform/chrome: straighten out cros_ec_get_{next,host}_event() error codes
authorBrian Norris <briannorris@chromium.org>
Thu, 8 Nov 2018 02:49:38 +0000 (18:49 -0800)
committerBenson Leung <bleung@chromium.org>
Wed, 14 Nov 2018 05:25:14 +0000 (21:25 -0800)
commitae23330194065b74094aea50b7daf998d6bb23f6
treebd15b031be36618b8796d84017658caa9316076d
parenta9e80a095d95d1159b26f73bd6d9c2fadc7fb411
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>
drivers/platform/chrome/cros_ec_proto.c
include/linux/mfd/cros_ec.h