diff options
author | Tzung-Bi Shih <tzungbi@kernel.org> | 2022-06-09 11:49:42 +0300 |
---|---|---|
committer | Tzung-Bi Shih <tzungbi@kernel.org> | 2022-06-10 05:31:43 +0300 |
commit | 93bea2faed630bd014916fd2e7ab16a79ee1b46a (patch) | |
tree | d29090ba49bc20fe969458ca882eb18e4f7e45d7 /drivers/platform/chrome | |
parent | 8e3991610ba5c11003d8c228b280cc007c2a6177 (diff) | |
download | linux-93bea2faed630bd014916fd2e7ab16a79ee1b46a.tar.xz |
platform/chrome: cros_ec_proto: use cros_ec_map_error()
Use cros_ec_map_error() in cros_ec_get_host_event_wake_mask().
The behavior of cros_ec_get_host_event_wake_mask() slightly changed. It
is acceptable because the caller only needs it returns negative integers
for indicating errors. Especially, the EC_RES_INVALID_COMMAND still
maps to -EOPNOTSUPP.
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20220609084957.3684698-7-tzungbi@kernel.org
Diffstat (limited to 'drivers/platform/chrome')
-rw-r--r-- | drivers/platform/chrome/cros_ec_proto.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c index 1e01eb94fbee..b3e6096e027c 100644 --- a/drivers/platform/chrome/cros_ec_proto.c +++ b/drivers/platform/chrome/cros_ec_proto.c @@ -247,7 +247,7 @@ static int cros_ec_get_host_event_wake_mask(struct cros_ec_device *ec_dev, uint32_t *mask) { struct ec_response_host_event_mask *r; - int ret; + int ret, mapped; msg->command = EC_CMD_HOST_EVENT_GET_WAKE_MASK; msg->version = 0; @@ -256,10 +256,9 @@ static int cros_ec_get_host_event_wake_mask(struct cros_ec_device *ec_dev, ret = send_command(ec_dev, msg); if (ret >= 0) { - if (msg->result == EC_RES_INVALID_COMMAND) - return -EOPNOTSUPP; - if (msg->result != EC_RES_SUCCESS) - return -EPROTO; + mapped = cros_ec_map_error(msg->result); + if (mapped) + return mapped; } if (ret > 0) { r = (struct ec_response_host_event_mask *)msg->data; |