summaryrefslogtreecommitdiff
path: root/common/audio_codec_wov.c
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 /common/audio_codec_wov.c
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 'common/audio_codec_wov.c')
-rw-r--r--common/audio_codec_wov.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/common/audio_codec_wov.c b/common/audio_codec_wov.c
index 30ffe98836..141403f783 100644
--- a/common/audio_codec_wov.c
+++ b/common/audio_codec_wov.c
@@ -95,7 +95,7 @@ static int check_lang_buf(uint8_t *data, uint32_t len, const uint8_t *hash)
}
#ifdef CONFIG_AUDIO_CODEC_CAP_WOV_LANG_SHM
-static int wov_set_lang_shm(struct host_cmd_handler_args *args)
+static enum ec_status wov_set_lang_shm(struct host_cmd_handler_args *args)
{
const struct ec_param_ec_codec_wov *p = args->params;
const struct ec_param_ec_codec_wov_set_lang_shm *pp =
@@ -118,7 +118,7 @@ static int wov_set_lang_shm(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
#else
-static int wov_set_lang(struct host_cmd_handler_args *args)
+static enum ec_status wov_set_lang(struct host_cmd_handler_args *args)
{
const struct ec_param_ec_codec_wov *p = args->params;
const struct ec_param_ec_codec_wov_set_lang *pp = &p->set_lang_param;
@@ -156,7 +156,7 @@ static int wov_set_lang(struct host_cmd_handler_args *args)
}
#endif /* CONFIG_AUDIO_CODEC_CAP_WOV_LANG_SHM */
-static int wov_get_lang(struct host_cmd_handler_args *args)
+static enum ec_status wov_get_lang(struct host_cmd_handler_args *args)
{
struct ec_response_ec_codec_wov_get_lang *r = args->response;
@@ -166,7 +166,7 @@ static int wov_get_lang(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-static int wov_enable(struct host_cmd_handler_args *args)
+static enum ec_status wov_enable(struct host_cmd_handler_args *args)
{
if (wov_enabled)
return EC_RES_BUSY;
@@ -197,7 +197,7 @@ static int wov_enable(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-static int wov_disable(struct host_cmd_handler_args *args)
+static enum ec_status wov_disable(struct host_cmd_handler_args *args)
{
if (!wov_enabled)
return EC_RES_BUSY;
@@ -216,7 +216,7 @@ static int wov_disable(struct host_cmd_handler_args *args)
}
#ifdef CONFIG_AUDIO_CODEC_CAP_WOV_AUDIO_SHM
-static int wov_read_audio_shm(struct host_cmd_handler_args *args)
+static enum ec_status wov_read_audio_shm(struct host_cmd_handler_args *args)
{
struct ec_response_ec_codec_wov_read_audio_shm *r = args->response;
@@ -249,7 +249,7 @@ static int wov_read_audio_shm(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
#else
-static int wov_read_audio(struct host_cmd_handler_args *args)
+static enum ec_status wov_read_audio(struct host_cmd_handler_args *args)
{
struct ec_response_ec_codec_wov_read_audio *r = args->response;
uint8_t *p;
@@ -327,7 +327,7 @@ static char *strcmd[] = {
BUILD_ASSERT(ARRAY_SIZE(sub_cmds) == ARRAY_SIZE(strcmd));
#endif
-static int wov_host_command(struct host_cmd_handler_args *args)
+static enum ec_status wov_host_command(struct host_cmd_handler_args *args)
{
const struct ec_param_ec_codec_wov *p = args->params;