summaryrefslogtreecommitdiff
path: root/power
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2019-09-20 10:04:44 -0700
committerCommit Bot <commit-bot@chromium.org>2019-10-02 10:19:57 +0000
commit83d793839479a6f3414dbf51c00536aff65618f3 (patch)
tree41047552e73878fad5ddbc4126d59a52643b041f /power
parent4e692f29e3e5af6b85df472e4c4f936c6f461cb9 (diff)
downloadchrome-ec-83d793839479a6f3414dbf51c00536aff65618f3.tar.gz
host_command: Change host command return value to enum ec_status
If the host command handler callback function returns an int, it's easy to accidentally mix up the enum ec_error_list and enum ec_status types. The host commands always expect an enum ec_status type, so we change the return value to be of that explicit type. Compilation will then fail if you accidentally try to return an enum ec_error_list value. Ran the following commands and then manually fixed up a few remaining instances that were not caught: git grep --name-only 'static int .*(struct host_cmd_handler_args \*args)' |\ xargs sed -i 's#static int \(.*\)(struct host_cmd_handler_args \*args)#\ static enum ec_status \1(struct host_cmd_handler_args \*args)##' git grep --name-only 'int .*(struct host_cmd_handler_args \*args)' |\ xargs sed -i 's#int \(.*\)(struct host_cmd_handler_args \*args)#\ enum ec_status \1(struct host_cmd_handler_args \*args)##' BRANCH=none BUG=chromium:1004831 TEST=make buildall -j Cq-Depend: chrome-internal:1872675 Change-Id: Id93df9387ac53d016a1594dba86c6642babbfd1e Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1816865 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'power')
-rw-r--r--power/common.c6
-rw-r--r--power/host_sleep.c3
2 files changed, 6 insertions, 3 deletions
diff --git a/power/common.c b/power/common.c
index d6f74d9a1e..977d46a72f 100644
--- a/power/common.c
+++ b/power/common.c
@@ -813,7 +813,8 @@ DECLARE_CONSOLE_COMMAND(hibdelay, command_hibernation_delay,
"[sec]",
"Set the delay before going into hibernation");
-static int host_command_hibernation_delay(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_hibernation_delay(struct host_cmd_handler_args *args)
{
const struct ec_params_hibernation_delay *p = args->params;
struct ec_response_hibernation_delay *r = args->response;
@@ -848,7 +849,8 @@ DECLARE_HOST_COMMAND(EC_CMD_HIBERNATION_DELAY,
#endif /* CONFIG_HIBERNATE */
#ifdef CONFIG_POWER_SHUTDOWN_PAUSE_IN_S5
-static int host_command_pause_in_s5(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_pause_in_s5(struct host_cmd_handler_args *args)
{
const struct ec_params_get_set_value *p = args->params;
struct ec_response_get_set_value *r = args->response;
diff --git a/power/host_sleep.c b/power/host_sleep.c
index 7d342441eb..673d421ca7 100644
--- a/power/host_sleep.c
+++ b/power/host_sleep.c
@@ -17,7 +17,8 @@ __overridable void power_chipset_handle_host_sleep_event(
/* Default weak implementation -- no action required. */
}
-static int host_command_host_sleep_event(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_host_sleep_event(struct host_cmd_handler_args *args)
{
const struct ec_params_host_sleep_event_v1 *p = args->params;
struct ec_response_host_sleep_event_v1 *r = args->response;