diff options
author | Tom Hughes <tomhughes@chromium.org> | 2019-09-20 10:04:44 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-10-02 10:19:57 +0000 |
commit | 83d793839479a6f3414dbf51c00536aff65618f3 (patch) | |
tree | 41047552e73878fad5ddbc4126d59a52643b041f /common/host_event_commands.c | |
parent | 4e692f29e3e5af6b85df472e4c4f936c6f461cb9 (diff) | |
download | chrome-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 'common/host_event_commands.c')
-rw-r--r-- | common/host_event_commands.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/common/host_event_commands.c b/common/host_event_commands.c index 901ea567c7..c421ea512a 100644 --- a/common/host_event_commands.c +++ b/common/host_event_commands.c @@ -504,7 +504,8 @@ DECLARE_CONSOLE_COMMAND(hostevent, command_host_event, #ifdef CONFIG_HOSTCMD_X86 -static int host_event_get_smi_mask(struct host_cmd_handler_args *args) +static enum ec_status +host_event_get_smi_mask(struct host_cmd_handler_args *args) { struct ec_response_host_event_mask *r = args->response; @@ -517,7 +518,8 @@ DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_GET_SMI_MASK, host_event_get_smi_mask, EC_VER_MASK(0)); -static int host_event_get_sci_mask(struct host_cmd_handler_args *args) +static enum ec_status +host_event_get_sci_mask(struct host_cmd_handler_args *args) { struct ec_response_host_event_mask *r = args->response; @@ -530,7 +532,8 @@ DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_GET_SCI_MASK, host_event_get_sci_mask, EC_VER_MASK(0)); -static int host_event_get_wake_mask(struct host_cmd_handler_args *args) +static enum ec_status +host_event_get_wake_mask(struct host_cmd_handler_args *args) { struct ec_response_host_event_mask *r = args->response; @@ -543,7 +546,8 @@ DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_GET_WAKE_MASK, host_event_get_wake_mask, EC_VER_MASK(0)); -static int host_event_set_smi_mask(struct host_cmd_handler_args *args) +static enum ec_status +host_event_set_smi_mask(struct host_cmd_handler_args *args) { const struct ec_params_host_event_mask *p = args->params; @@ -554,7 +558,8 @@ DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_SET_SMI_MASK, host_event_set_smi_mask, EC_VER_MASK(0)); -static int host_event_set_sci_mask(struct host_cmd_handler_args *args) +static enum ec_status +host_event_set_sci_mask(struct host_cmd_handler_args *args) { const struct ec_params_host_event_mask *p = args->params; @@ -565,7 +570,8 @@ DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_SET_SCI_MASK, host_event_set_sci_mask, EC_VER_MASK(0)); -static int host_event_set_wake_mask(struct host_cmd_handler_args *args) +static enum ec_status +host_event_set_wake_mask(struct host_cmd_handler_args *args) { const struct ec_params_host_event_mask *p = args->params; @@ -584,7 +590,7 @@ uint8_t lpc_is_active_wm_set_by_host(void) #endif /* CONFIG_HOSTCMD_X86 */ -static int host_event_get_b(struct host_cmd_handler_args *args) +static enum ec_status host_event_get_b(struct host_cmd_handler_args *args) { struct ec_response_host_event_mask *r = args->response; @@ -597,7 +603,7 @@ DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_GET_B, host_event_get_b, EC_VER_MASK(0)); -static int host_event_clear(struct host_cmd_handler_args *args) +static enum ec_status host_event_clear(struct host_cmd_handler_args *args) { const struct ec_params_host_event_mask *p = args->params; @@ -608,7 +614,7 @@ DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_CLEAR, host_event_clear, EC_VER_MASK(0)); -static int host_event_clear_b(struct host_cmd_handler_args *args) +static enum ec_status host_event_clear_b(struct host_cmd_handler_args *args) { const struct ec_params_host_event_mask *p = args->params; @@ -619,7 +625,7 @@ DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_CLEAR_B, host_event_clear_b, EC_VER_MASK(0)); -static int host_event_action_get(struct host_cmd_handler_args *args) +static enum ec_status host_event_action_get(struct host_cmd_handler_args *args) { struct ec_response_host_event *r = args->response; const struct ec_params_host_event *p = args->params; @@ -666,7 +672,7 @@ static int host_event_action_get(struct host_cmd_handler_args *args) return result; } -static int host_event_action_set(struct host_cmd_handler_args *args) +static enum ec_status host_event_action_set(struct host_cmd_handler_args *args) { const struct ec_params_host_event *p = args->params; int result = EC_RES_SUCCESS; @@ -708,7 +714,8 @@ static int host_event_action_set(struct host_cmd_handler_args *args) return result; } -static int host_event_action_clear(struct host_cmd_handler_args *args) +static enum ec_status +host_event_action_clear(struct host_cmd_handler_args *args) { const struct ec_params_host_event *p = args->params; int result = EC_RES_SUCCESS; @@ -728,7 +735,8 @@ static int host_event_action_clear(struct host_cmd_handler_args *args) return result; } -static int host_command_host_event(struct host_cmd_handler_args *args) +static enum ec_status +host_command_host_event(struct host_cmd_handler_args *args) { const struct ec_params_host_event *p = args->params; |