summaryrefslogtreecommitdiff
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
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>
-rw-r--r--board/glados_pd/board.c2
-rw-r--r--board/reef_it8320/board.c3
-rw-r--r--board/samus/panel.c3
-rw-r--r--board/samus_pd/board.c5
-rw-r--r--chip/ish/host_command_heci.c2
-rw-r--r--chip/it83xx/lpc.c2
-rw-r--r--chip/lm4/lpc.c2
-rw-r--r--chip/lm4/system.c4
-rw-r--r--chip/mchp/lpc.c2
-rw-r--r--chip/mec1322/lpc.c2
-rw-r--r--chip/mt_scp/ipi.c2
-rw-r--r--chip/npcx/audio_codec.c19
-rw-r--r--chip/npcx/cec.c6
-rw-r--r--chip/npcx/flash.c2
-rw-r--r--chip/npcx/lpc.c2
-rw-r--r--chip/npcx/shi.c2
-rw-r--r--chip/npcx/system.c8
-rw-r--r--chip/stm32/clock-f.c8
-rw-r--r--chip/stm32/spi.c4
-rw-r--r--chip/stm32/trng.c2
-rw-r--r--common/adc.c2
-rw-r--r--common/ap_hang_detect.c3
-rw-r--r--common/audio_codec.c8
-rw-r--r--common/audio_codec_dmic.c8
-rw-r--r--common/audio_codec_i2s_rx.c13
-rw-r--r--common/audio_codec_wov.c16
-rw-r--r--common/backlight_lid.c3
-rw-r--r--common/battery.c11
-rw-r--r--common/cbi.c4
-rw-r--r--common/charge_manager.c12
-rw-r--r--common/charge_state_v2.c9
-rw-r--r--common/chipset.c2
-rw-r--r--common/device_event.c2
-rw-r--r--common/fan.c11
-rw-r--r--common/flash.c15
-rw-r--r--common/fpsensor/fpsensor.c10
-rw-r--r--common/fpsensor/fpsensor_state.c9
-rw-r--r--common/gpio_commands.c4
-rw-r--r--common/host_command.c35
-rw-r--r--common/host_command_pd.c3
-rw-r--r--common/host_event_commands.c34
-rw-r--r--common/i2c_master.c5
-rw-r--r--common/i2c_slave.c2
-rw-r--r--common/keyboard_backlight.c4
-rw-r--r--common/keyboard_mkbp.c8
-rw-r--r--common/keyboard_scan.c5
-rw-r--r--common/keyboard_test.c2
-rw-r--r--common/led_common.c2
-rw-r--r--common/lid_switch.c2
-rw-r--r--common/lightbar.c2
-rw-r--r--common/mkbp_event.c7
-rw-r--r--common/motion_lid.c2
-rw-r--r--common/motion_sense.c2
-rw-r--r--common/panic_output.c2
-rw-r--r--common/pd_log.c4
-rw-r--r--common/peripheral.c2
-rw-r--r--common/port80.c4
-rw-r--r--common/power_button_x86.c2
-rw-r--r--common/pstore_commands.c6
-rw-r--r--common/pwm.c6
-rw-r--r--common/rollback.c6
-rw-r--r--common/rwsig.c4
-rw-r--r--common/spi_flash.c2
-rw-r--r--common/system.c25
-rw-r--r--common/temp_sensor.c2
-rw-r--r--common/thermal.c6
-rw-r--r--common/uart_buffering.c9
-rw-r--r--common/uptime.c3
-rw-r--r--common/usb_pd_policy.c4
-rw-r--r--common/usb_pd_protocol.c17
-rw-r--r--common/usb_port_power_dumb.c3
-rw-r--r--common/usb_port_power_smart.c3
-rw-r--r--common/usbc/usb_pe_drp_sm.c4
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c15
-rw-r--r--common/vboot/vboot.c2
-rw-r--r--common/vboot_hash.c3
-rw-r--r--common/vstore.c6
-rw-r--r--common/wireless.c2
-rw-r--r--driver/battery/bq20z453.c2
-rw-r--r--driver/battery/smart.c12
-rw-r--r--driver/temp_sensor/tmp006.c6
-rw-r--r--driver/usb_mux/usb_mux.c2
-rw-r--r--extra/lightbar/simulation.h2
-rw-r--r--include/host_command.h4
-rw-r--r--include/i2c.h2
-rw-r--r--include/motion_lid.h2
-rw-r--r--include/uart.h2
-rw-r--r--power/common.c6
-rw-r--r--power/host_sleep.c3
89 files changed, 296 insertions, 228 deletions
diff --git a/board/glados_pd/board.c b/board/glados_pd/board.c
index 07ac9b7f06..b0c4ddbff9 100644
--- a/board/glados_pd/board.c
+++ b/board/glados_pd/board.c
@@ -126,7 +126,7 @@ DECLARE_CONSOLE_COMMAND(ecint, command_ec_int,
"",
"Toggle EC interrupt line");
-static int ec_status_host_cmd(struct host_cmd_handler_args *args)
+static enum ec_status ec_status_host_cmd(struct host_cmd_handler_args *args)
{
const struct ec_params_pd_status *p = args->params;
struct ec_response_pd_status *r = args->response;
diff --git a/board/reef_it8320/board.c b/board/reef_it8320/board.c
index db4056e8c2..010bfd48b5 100644
--- a/board/reef_it8320/board.c
+++ b/board/reef_it8320/board.c
@@ -109,7 +109,8 @@ void board_pd_vconn_ctrl(int port, enum usbpd_cc_pin cc_pin, int enabled)
*/
static uint32_t pd_host_event_status __aligned(4);
-static int hc_pd_host_event_status(struct host_cmd_handler_args *args)
+static enum ec_status
+hc_pd_host_event_status(struct host_cmd_handler_args *args)
{
struct ec_response_host_event_status *r = args->response;
diff --git a/board/samus/panel.c b/board/samus/panel.c
index beb0d32e9d..b3fe6060aa 100644
--- a/board/samus/panel.c
+++ b/board/samus/panel.c
@@ -144,7 +144,8 @@ DECLARE_DEFERRED(lp8555_enable_pwm_mode);
/**
* Host command to toggle backlight.
*/
-static int switch_command_enable_backlight(struct host_cmd_handler_args *args)
+static enum ec_status
+switch_command_enable_backlight(struct host_cmd_handler_args *args)
{
const struct ec_params_switch_enable_backlight *p = args->params;
diff --git a/board/samus_pd/board.c b/board/samus_pd/board.c
index 772ee2cb3f..c942418ee6 100644
--- a/board/samus_pd/board.c
+++ b/board/samus_pd/board.c
@@ -528,7 +528,7 @@ DECLARE_CONSOLE_COMMAND(pdevent, command_pd_host_event,
/****************************************************************************/
/* Host commands */
-static int ec_status_host_cmd(struct host_cmd_handler_args *args)
+static enum ec_status ec_status_host_cmd(struct host_cmd_handler_args *args)
{
const struct ec_params_pd_status *p = args->params;
struct ec_response_pd_status *r = args->response;
@@ -595,7 +595,8 @@ static int ec_status_host_cmd(struct host_cmd_handler_args *args)
DECLARE_HOST_COMMAND(EC_CMD_PD_EXCHANGE_STATUS, ec_status_host_cmd,
EC_VER_MASK(EC_VER_PD_EXCHANGE_STATUS));
-static int host_event_status_host_cmd(struct host_cmd_handler_args *args)
+static enum ec_status
+host_event_status_host_cmd(struct host_cmd_handler_args *args)
{
struct ec_response_host_event_status *r = args->response;
diff --git a/chip/ish/host_command_heci.c b/chip/ish/host_command_heci.c
index 69736eeae7..2fcab44b8b 100644
--- a/chip/ish/host_command_heci.c
+++ b/chip/ish/host_command_heci.c
@@ -126,7 +126,7 @@ static void cros_ec_ishtp_subsys_new_msg_received(const heci_handle_t handle,
/**
* Get protocol information
*/
-static int heci_get_protocol_info(struct host_cmd_handler_args *args)
+static enum ec_status heci_get_protocol_info(struct host_cmd_handler_args *args)
{
struct ec_response_get_protocol_info *r = args->response;
diff --git a/chip/it83xx/lpc.c b/chip/it83xx/lpc.c
index 64137b447a..cd4f9ad608 100644
--- a/chip/it83xx/lpc.c
+++ b/chip/it83xx/lpc.c
@@ -740,7 +740,7 @@ void lpc_disable_acpi_interrupts(void)
}
/* Get protocol information */
-static int lpc_get_protocol_info(struct host_cmd_handler_args *args)
+static enum ec_status lpc_get_protocol_info(struct host_cmd_handler_args *args)
{
struct ec_response_get_protocol_info *r = args->response;
diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c
index 29e83be8b1..0c672bd63a 100644
--- a/chip/lm4/lpc.c
+++ b/chip/lm4/lpc.c
@@ -815,7 +815,7 @@ DECLARE_HOOK(HOOK_TICK, lpc_tick, HOOK_PRIO_DEFAULT);
/**
* Get protocol information
*/
-static int lpc_get_protocol_info(struct host_cmd_handler_args *args)
+static enum ec_status lpc_get_protocol_info(struct host_cmd_handler_args *args)
{
struct ec_response_get_protocol_info *r = args->response;
diff --git a/chip/lm4/system.c b/chip/lm4/system.c
index cf7705ff06..6a32804bf0 100644
--- a/chip/lm4/system.c
+++ b/chip/lm4/system.c
@@ -731,7 +731,7 @@ DECLARE_CONSOLE_COMMAND(rtc_alarm, command_rtc_alarm_test,
/* Host commands */
#ifdef CONFIG_HOSTCMD_RTC
-static int system_rtc_get_value(struct host_cmd_handler_args *args)
+static enum ec_status system_rtc_get_value(struct host_cmd_handler_args *args)
{
struct ec_response_rtc *r = args->response;
@@ -744,7 +744,7 @@ DECLARE_HOST_COMMAND(EC_CMD_RTC_GET_VALUE,
system_rtc_get_value,
EC_VER_MASK(0));
-static int system_rtc_set_value(struct host_cmd_handler_args *args)
+static enum ec_status system_rtc_set_value(struct host_cmd_handler_args *args)
{
const struct ec_params_rtc *p = args->params;
diff --git a/chip/mchp/lpc.c b/chip/mchp/lpc.c
index 32e1c81c95..2b273e11c5 100644
--- a/chip/mchp/lpc.c
+++ b/chip/mchp/lpc.c
@@ -937,7 +937,7 @@ static int lpc_command_init(int argc, char **argv)
DECLARE_CONSOLE_COMMAND(lpcinit, lpc_command_init, NULL, NULL);
/* Get protocol information */
-static int lpc_get_protocol_info(struct host_cmd_handler_args *args)
+static enum ec_status lpc_get_protocol_info(struct host_cmd_handler_args *args)
{
struct ec_response_get_protocol_info *r = args->response;
diff --git a/chip/mec1322/lpc.c b/chip/mec1322/lpc.c
index 32d6fa6405..69fe3b856c 100644
--- a/chip/mec1322/lpc.c
+++ b/chip/mec1322/lpc.c
@@ -501,7 +501,7 @@ static int lpc_command_init(int argc, char **argv)
DECLARE_CONSOLE_COMMAND(lpcinit, lpc_command_init, NULL, NULL);
/* Get protocol information */
-static int lpc_get_protocol_info(struct host_cmd_handler_args *args)
+static enum ec_status lpc_get_protocol_info(struct host_cmd_handler_args *args)
{
struct ec_response_get_protocol_info *r = args->response;
diff --git a/chip/mt_scp/ipi.c b/chip/mt_scp/ipi.c
index c8c0c1c74f..222e117a79 100644
--- a/chip/mt_scp/ipi.c
+++ b/chip/mt_scp/ipi.c
@@ -293,7 +293,7 @@ DECLARE_IPI(IPI_HOST_COMMAND, ipi_hostcmd_handler, 0);
/*
* Get protocol information
*/
-static int ipi_get_protocol_info(struct host_cmd_handler_args *args)
+static enum ec_status ipi_get_protocol_info(struct host_cmd_handler_args *args)
{
struct ec_response_get_protocol_info *r = args->response;
diff --git a/chip/npcx/audio_codec.c b/chip/npcx/audio_codec.c
index 5273e89717..7b1d32a5ff 100644
--- a/chip/npcx/audio_codec.c
+++ b/chip/npcx/audio_codec.c
@@ -13,9 +13,9 @@
#define EC_WOV_I2S_SAMPLE_RATE 48000
-typedef int (*codec_i2s_func)(struct host_cmd_handler_args *args);
+typedef enum ec_status (*codec_i2s_func)(struct host_cmd_handler_args *args);
-static int codec_set_sample_depth(struct host_cmd_handler_args *args)
+static enum ec_status codec_set_sample_depth(struct host_cmd_handler_args *args)
{
struct ec_param_codec_i2s *param =
(struct ec_param_codec_i2s *)args->params;
@@ -35,7 +35,7 @@ static int codec_set_sample_depth(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-static int codec_set_gain(struct host_cmd_handler_args *args)
+static enum ec_status codec_set_gain(struct host_cmd_handler_args *args)
{
struct ec_param_codec_i2s *param =
(struct ec_param_codec_i2s *)args->params;
@@ -46,7 +46,7 @@ static int codec_set_gain(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-static int codec_get_gain(struct host_cmd_handler_args *args)
+static enum ec_status codec_get_gain(struct host_cmd_handler_args *args)
{
struct ec_codec_i2s_gain *resp =
(struct ec_codec_i2s_gain *)args->response;
@@ -62,7 +62,7 @@ static int codec_get_gain(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-static int codec_i2s_enable(struct host_cmd_handler_args *args)
+static enum ec_status codec_i2s_enable(struct host_cmd_handler_args *args)
{
struct ec_param_codec_i2s *param =
(struct ec_param_codec_i2s *)args->params;
@@ -93,7 +93,7 @@ static int codec_i2s_enable(struct host_cmd_handler_args *args)
return rv ? EC_RES_ERROR : EC_RES_SUCCESS;
}
-static int codec_i2s_set_fmt(struct host_cmd_handler_args *args)
+static enum ec_status codec_i2s_set_fmt(struct host_cmd_handler_args *args)
{
struct ec_param_codec_i2s *param =
(struct ec_param_codec_i2s *)args->params;
@@ -107,7 +107,8 @@ static int codec_i2s_set_fmt(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-static int codec_i2s_set_tdm_config(struct host_cmd_handler_args *args)
+static enum ec_status
+codec_i2s_set_tdm_config(struct host_cmd_handler_args *args)
{
struct ec_param_codec_i2s *param =
(struct ec_param_codec_i2s *)args->params;
@@ -125,7 +126,7 @@ static int codec_i2s_set_tdm_config(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-static int codec_i2s_set_bclk(struct host_cmd_handler_args *args)
+static enum ec_status codec_i2s_set_bclk(struct host_cmd_handler_args *args)
{
struct ec_param_codec_i2s *param =
(struct ec_param_codec_i2s *)args->params;
@@ -138,7 +139,7 @@ static int codec_i2s_set_bclk(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-static int codec_i2s(struct host_cmd_handler_args *args)
+static enum ec_status codec_i2s(struct host_cmd_handler_args *args)
{
struct ec_param_codec_i2s *param =
(struct ec_param_codec_i2s *)args->params;
diff --git a/chip/npcx/cec.c b/chip/npcx/cec.c
index 7b02dbe683..effbf6bd46 100644
--- a/chip/npcx/cec.c
+++ b/chip/npcx/cec.c
@@ -836,7 +836,7 @@ static int cec_send(const uint8_t *msg, uint8_t len)
return 0;
}
-static int hc_cec_write(struct host_cmd_handler_args *args)
+static enum ec_status hc_cec_write(struct host_cmd_handler_args *args)
{
const struct ec_params_cec_write *params = args->params;
@@ -923,7 +923,7 @@ static int cec_set_logical_addr(uint8_t logical_addr)
return EC_RES_SUCCESS;
}
-static int hc_cec_set(struct host_cmd_handler_args *args)
+static enum ec_status hc_cec_set(struct host_cmd_handler_args *args)
{
const struct ec_params_cec_set *params = args->params;
@@ -939,7 +939,7 @@ static int hc_cec_set(struct host_cmd_handler_args *args)
DECLARE_HOST_COMMAND(EC_CMD_CEC_SET, hc_cec_set, EC_VER_MASK(0));
-static int hc_cec_get(struct host_cmd_handler_args *args)
+static enum ec_status hc_cec_get(struct host_cmd_handler_args *args)
{
struct ec_response_cec_get *response = args->response;
const struct ec_params_cec_get *params = args->params;
diff --git a/chip/npcx/flash.c b/chip/npcx/flash.c
index f5b124e650..b0cbca536f 100644
--- a/chip/npcx/flash.c
+++ b/chip/npcx/flash.c
@@ -723,7 +723,7 @@ void flash_lock_mapped_storage(int lock)
#if defined(CONFIG_HOSTCMD_FLASH_SPI_INFO) && !defined(BOARD_NPCX_EVB)
/* NPCX EVB uses implementation from spi_flash.c */
-static int flash_command_spi_info(struct host_cmd_handler_args *args)
+static enum ec_status flash_command_spi_info(struct host_cmd_handler_args *args)
{
struct ec_response_flash_spi_info *r = args->response;
diff --git a/chip/npcx/lpc.c b/chip/npcx/lpc.c
index f32f6d8909..09dc8c7f20 100644
--- a/chip/npcx/lpc.c
+++ b/chip/npcx/lpc.c
@@ -861,7 +861,7 @@ static void lpc_init(void)
DECLARE_HOOK(HOOK_INIT, lpc_init, HOOK_PRIO_INIT_LPC);
/* Get protocol information */
-static int lpc_get_protocol_info(struct host_cmd_handler_args *args)
+static enum ec_status lpc_get_protocol_info(struct host_cmd_handler_args *args)
{
struct ec_response_get_protocol_info *r = args->response;
diff --git a/chip/npcx/shi.c b/chip/npcx/shi.c
index 48ad4f0843..d97963bc3f 100644
--- a/chip/npcx/shi.c
+++ b/chip/npcx/shi.c
@@ -1050,7 +1050,7 @@ DECLARE_HOOK(HOOK_INIT, shi_init, HOOK_PRIO_INIT_CHIPSET - 1);
/**
* Get protocol information
*/
-static int shi_get_protocol_info(struct host_cmd_handler_args *args)
+static enum ec_status shi_get_protocol_info(struct host_cmd_handler_args *args)
{
struct ec_response_get_protocol_info *r = args->response;
diff --git a/chip/npcx/system.c b/chip/npcx/system.c
index 7eb95b8d34..e247989693 100644
--- a/chip/npcx/system.c
+++ b/chip/npcx/system.c
@@ -999,7 +999,7 @@ DECLARE_CONSOLE_COMMAND(rtc_alarm, command_rtc_alarm_test,
/* Host commands */
#ifdef CONFIG_HOSTCMD_RTC
-static int system_rtc_get_value(struct host_cmd_handler_args *args)
+static enum ec_status system_rtc_get_value(struct host_cmd_handler_args *args)
{
struct ec_response_rtc *r = args->response;
@@ -1012,7 +1012,7 @@ DECLARE_HOST_COMMAND(EC_CMD_RTC_GET_VALUE,
system_rtc_get_value,
EC_VER_MASK(0));
-static int system_rtc_set_value(struct host_cmd_handler_args *args)
+static enum ec_status system_rtc_set_value(struct host_cmd_handler_args *args)
{
const struct ec_params_rtc *p = args->params;
@@ -1023,7 +1023,7 @@ DECLARE_HOST_COMMAND(EC_CMD_RTC_SET_VALUE,
system_rtc_set_value,
EC_VER_MASK(0));
-static int system_rtc_set_alarm(struct host_cmd_handler_args *args)
+static enum ec_status system_rtc_set_alarm(struct host_cmd_handler_args *args)
{
const struct ec_params_rtc *p = args->params;
@@ -1034,7 +1034,7 @@ DECLARE_HOST_COMMAND(EC_CMD_RTC_SET_ALARM,
system_rtc_set_alarm,
EC_VER_MASK(0));
-static int system_rtc_get_alarm(struct host_cmd_handler_args *args)
+static enum ec_status system_rtc_get_alarm(struct host_cmd_handler_args *args)
{
struct ec_response_rtc *r = args->response;
diff --git a/chip/stm32/clock-f.c b/chip/stm32/clock-f.c
index 9c73e2b41f..90ada3eeba 100644
--- a/chip/stm32/clock-f.c
+++ b/chip/stm32/clock-f.c
@@ -440,7 +440,7 @@ DECLARE_CONSOLE_COMMAND(rtc_alarm, command_rtc_alarm_test,
/* Host commands */
#ifdef CONFIG_HOSTCMD_RTC
-static int system_rtc_get_value(struct host_cmd_handler_args *args)
+static enum ec_status system_rtc_get_value(struct host_cmd_handler_args *args)
{
struct ec_response_rtc *r = args->response;
struct rtc_time_reg rtc;
@@ -455,7 +455,7 @@ DECLARE_HOST_COMMAND(EC_CMD_RTC_GET_VALUE,
system_rtc_get_value,
EC_VER_MASK(0));
-static int system_rtc_set_value(struct host_cmd_handler_args *args)
+static enum ec_status system_rtc_set_value(struct host_cmd_handler_args *args)
{
const struct ec_params_rtc *p = args->params;
@@ -466,7 +466,7 @@ DECLARE_HOST_COMMAND(EC_CMD_RTC_SET_VALUE,
system_rtc_set_value,
EC_VER_MASK(0));
-static int system_rtc_set_alarm(struct host_cmd_handler_args *args)
+static enum ec_status system_rtc_set_alarm(struct host_cmd_handler_args *args)
{
struct rtc_time_reg rtc;
const struct ec_params_rtc *p = args->params;
@@ -482,7 +482,7 @@ DECLARE_HOST_COMMAND(EC_CMD_RTC_SET_ALARM,
system_rtc_set_alarm,
EC_VER_MASK(0));
-static int system_rtc_get_alarm(struct host_cmd_handler_args *args)
+static enum ec_status system_rtc_get_alarm(struct host_cmd_handler_args *args)
{
struct ec_response_rtc *r = args->response;
diff --git a/chip/stm32/spi.c b/chip/stm32/spi.c
index c71d0580c9..78ff064dbd 100644
--- a/chip/stm32/spi.c
+++ b/chip/stm32/spi.c
@@ -720,7 +720,7 @@ DECLARE_HOOK(HOOK_INIT, spi_init, HOOK_PRIO_INIT_SPI);
/**
* Get protocol information
*/
-static int spi_get_protocol_info(struct host_cmd_handler_args *args)
+static enum ec_status spi_get_protocol_info(struct host_cmd_handler_args *args)
{
struct ec_response_get_protocol_info *r = args->response;
@@ -735,7 +735,7 @@ static int spi_get_protocol_info(struct host_cmd_handler_args *args)
args->response_size = sizeof(*r);
- return EC_SUCCESS;
+ return EC_RES_SUCCESS;
}
DECLARE_HOST_COMMAND(EC_CMD_GET_PROTOCOL_INFO,
spi_get_protocol_info,
diff --git a/chip/stm32/trng.c b/chip/stm32/trng.c
index a5087df666..fcc0f5432e 100644
--- a/chip/stm32/trng.c
+++ b/chip/stm32/trng.c
@@ -118,7 +118,7 @@ static int command_rand(int argc, char **argv)
DECLARE_CONSOLE_COMMAND(rand, command_rand,
NULL, "Output random bytes to console.");
-static int host_command_rand(struct host_cmd_handler_args *args)
+static enum ec_status host_command_rand(struct host_cmd_handler_args *args)
{
const struct ec_params_rand_num *p = args->params;
struct ec_response_rand_num *r = args->response;
diff --git a/common/adc.c b/common/adc.c
index a307ed9a83..5407de6cfe 100644
--- a/common/adc.c
+++ b/common/adc.c
@@ -66,7 +66,7 @@ DECLARE_CONSOLE_COMMAND(adc, command_adc,
"[name]",
"Print ADC channel(s)");
-static int hc_adc_read(struct host_cmd_handler_args *args)
+static enum ec_status hc_adc_read(struct host_cmd_handler_args *args)
{
const struct ec_params_adc_read *params = args->params;
struct ec_response_adc_read *resp = args->response;
diff --git a/common/ap_hang_detect.c b/common/ap_hang_detect.c
index c8d148dfb8..0c9e7a186d 100644
--- a/common/ap_hang_detect.c
+++ b/common/ap_hang_detect.c
@@ -159,7 +159,8 @@ DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, hang_detect_shutdown, HOOK_PRIO_DEFAULT);
/*****************************************************************************/
/* Host command */
-static int hang_detect_host_command(struct host_cmd_handler_args *args)
+static enum ec_status
+hang_detect_host_command(struct host_cmd_handler_args *args)
{
const struct ec_params_hang_detect *p = args->params;
diff --git a/common/audio_codec.c b/common/audio_codec.c
index 43ba520707..fde79b4129 100644
--- a/common/audio_codec.c
+++ b/common/audio_codec.c
@@ -28,7 +28,7 @@ static struct {
uint32_t len;
} shms[EC_CODEC_SHM_ID_LAST];
-static int get_capabilities(struct host_cmd_handler_args *args)
+static enum ec_status get_capabilities(struct host_cmd_handler_args *args)
{
struct ec_response_ec_codec_get_capabilities *r = args->response;
@@ -38,7 +38,7 @@ static int get_capabilities(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-static int get_shm_addr(struct host_cmd_handler_args *args)
+static enum ec_status get_shm_addr(struct host_cmd_handler_args *args)
{
const struct ec_param_ec_codec *p = args->params;
struct ec_response_ec_codec_get_shm_addr *r = args->response;
@@ -60,7 +60,7 @@ static int get_shm_addr(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-static int set_shm_addr(struct host_cmd_handler_args *args)
+static enum ec_status set_shm_addr(struct host_cmd_handler_args *args)
{
const struct ec_param_ec_codec *p = args->params;
const uint8_t shm_id = p->set_shm_addr_param.shm_id;
@@ -99,7 +99,7 @@ static char *strcmd[] = {
BUILD_ASSERT(ARRAY_SIZE(sub_cmds) == ARRAY_SIZE(strcmd));
#endif
-static int host_command(struct host_cmd_handler_args *args)
+static enum ec_status host_command(struct host_cmd_handler_args *args)
{
const struct ec_param_ec_codec *p = args->params;
diff --git a/common/audio_codec_dmic.c b/common/audio_codec_dmic.c
index 986451650e..58827440cc 100644
--- a/common/audio_codec_dmic.c
+++ b/common/audio_codec_dmic.c
@@ -10,7 +10,7 @@
#define CPRINTS(format, args...) cprints(CC_AUDIO_CODEC, format, ## args)
-static int dmic_get_max_gain(struct host_cmd_handler_args *args)
+static enum ec_status dmic_get_max_gain(struct host_cmd_handler_args *args)
{
struct ec_response_ec_codec_dmic_get_max_gain *r = args->response;
@@ -21,7 +21,7 @@ static int dmic_get_max_gain(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-static int dmic_set_gain_idx(struct host_cmd_handler_args *args)
+static enum ec_status dmic_set_gain_idx(struct host_cmd_handler_args *args)
{
const struct ec_param_ec_codec_dmic *p = args->params;
@@ -33,7 +33,7 @@ static int dmic_set_gain_idx(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-static int dmic_get_gain_idx(struct host_cmd_handler_args *args)
+static enum ec_status dmic_get_gain_idx(struct host_cmd_handler_args *args)
{
const struct ec_param_ec_codec_dmic *p = args->params;
struct ec_response_ec_codec_dmic_get_gain_idx *r = args->response;
@@ -61,7 +61,7 @@ static char *strcmd[] = {
BUILD_ASSERT(ARRAY_SIZE(sub_cmds) == ARRAY_SIZE(strcmd));
#endif
-static int dmic_host_command(struct host_cmd_handler_args *args)
+static enum ec_status dmic_host_command(struct host_cmd_handler_args *args)
{
const struct ec_param_ec_codec_dmic *p = args->params;
diff --git a/common/audio_codec_i2s_rx.c b/common/audio_codec_i2s_rx.c
index 301612b086..b5c3be4926 100644
--- a/common/audio_codec_i2s_rx.c
+++ b/common/audio_codec_i2s_rx.c
@@ -12,7 +12,7 @@
static uint8_t i2s_rx_enabled;
-static int i2s_rx_enable(struct host_cmd_handler_args *args)
+static enum ec_status i2s_rx_enable(struct host_cmd_handler_args *args)
{
if (i2s_rx_enabled)
return EC_RES_BUSY;
@@ -25,7 +25,7 @@ static int i2s_rx_enable(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-static int i2s_rx_disable(struct host_cmd_handler_args *args)
+static enum ec_status i2s_rx_disable(struct host_cmd_handler_args *args)
{
if (!i2s_rx_enabled)
return EC_RES_BUSY;
@@ -38,7 +38,8 @@ static int i2s_rx_disable(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-static int i2s_rx_set_sample_depth(struct host_cmd_handler_args *args)
+static enum ec_status
+i2s_rx_set_sample_depth(struct host_cmd_handler_args *args)
{
const struct ec_param_ec_codec_i2s_rx *p = args->params;
const uint8_t depth = p->set_sample_depth_param.depth;
@@ -54,7 +55,7 @@ static int i2s_rx_set_sample_depth(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-static int i2s_rx_set_daifmt(struct host_cmd_handler_args *args)
+static enum ec_status i2s_rx_set_daifmt(struct host_cmd_handler_args *args)
{
const struct ec_param_ec_codec_i2s_rx *p = args->params;
const uint8_t daifmt = p->set_daifmt_param.daifmt;
@@ -70,7 +71,7 @@ static int i2s_rx_set_daifmt(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-static int i2s_rx_set_bclk(struct host_cmd_handler_args *args)
+static enum ec_status i2s_rx_set_bclk(struct host_cmd_handler_args *args)
{
const struct ec_param_ec_codec_i2s_rx *p = args->params;
@@ -102,7 +103,7 @@ static char *strcmd[] = {
BUILD_ASSERT(ARRAY_SIZE(sub_cmds) == ARRAY_SIZE(strcmd));
#endif
-static int i2s_rx_host_command(struct host_cmd_handler_args *args)
+static enum ec_status i2s_rx_host_command(struct host_cmd_handler_args *args)
{
const struct ec_param_ec_codec_i2s_rx *p = args->params;
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;
diff --git a/common/backlight_lid.c b/common/backlight_lid.c
index 2a10fe61fc..3b857df592 100644
--- a/common/backlight_lid.c
+++ b/common/backlight_lid.c
@@ -69,7 +69,8 @@ void backlight_interrupt(enum gpio_signal signal)
* The requested state will persist until the next lid-switch or request-gpio
* transition.
*/
-static int switch_command_enable_backlight(struct host_cmd_handler_args *args)
+static enum ec_status
+switch_command_enable_backlight(struct host_cmd_handler_args *args)
{
const struct ec_params_switch_enable_backlight *p = args->params;
diff --git a/common/battery.c b/common/battery.c
index 3f858f6f27..7b6c3ee5bd 100644
--- a/common/battery.c
+++ b/common/battery.c
@@ -320,7 +320,7 @@ static void clear_pending_cutoff(void)
}
DECLARE_HOOK(HOOK_AC_CHANGE, clear_pending_cutoff, HOOK_PRIO_DEFAULT);
-static int battery_command_cutoff(struct host_cmd_handler_args *args)
+static enum ec_status battery_command_cutoff(struct host_cmd_handler_args *args)
{
const struct ec_params_battery_cutoff *p;
int rv;
@@ -429,7 +429,8 @@ DECLARE_CONSOLE_COMMAND(battparam, console_command_battery_vendor_param,
"<param> [value]",
"Get or set battery vendor parameters");
-static int host_command_battery_vendor_param(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_battery_vendor_param(struct host_cmd_handler_args *args)
{
int rv;
const struct ec_params_battery_vendor_param *p = args->params;
@@ -458,7 +459,8 @@ DECLARE_HOST_COMMAND(EC_CMD_BATTERY_VENDOR_PARAM,
#ifdef CONFIG_BATTERY_V2
#ifdef CONFIG_HOSTCMD_BATTERY_V2
static void battery_update(enum battery_index i);
-static int host_command_battery_get_static(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_battery_get_static(struct host_cmd_handler_args *args)
{
const struct ec_params_battery_static_info *p = args->params;
struct ec_response_battery_static_info *r = args->response;
@@ -475,7 +477,8 @@ DECLARE_HOST_COMMAND(EC_CMD_BATTERY_GET_STATIC,
host_command_battery_get_static,
EC_VER_MASK(0));
-static int host_command_battery_get_dynamic(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_battery_get_dynamic(struct host_cmd_handler_args *args)
{
const struct ec_params_battery_dynamic_info *p = args->params;
struct ec_response_battery_dynamic_info *r = args->response;
diff --git a/common/cbi.c b/common/cbi.c
index 29b22e5e83..f29ae2040c 100644
--- a/common/cbi.c
+++ b/common/cbi.c
@@ -283,7 +283,7 @@ int cbi_get_model_id(uint32_t *id)
return cbi_get_board_info(CBI_TAG_MODEL_ID, (uint8_t *)id, &size);
}
-static int hc_cbi_get(struct host_cmd_handler_args *args)
+static enum ec_status hc_cbi_get(struct host_cmd_handler_args *args)
{
const struct __ec_align4 ec_params_get_cbi *p = args->params;
uint8_t size = MIN(args->response_max, UINT8_MAX);
@@ -301,7 +301,7 @@ DECLARE_HOST_COMMAND(EC_CMD_GET_CROS_BOARD_INFO,
hc_cbi_get,
EC_VER_MASK(0));
-static int hc_cbi_set(struct host_cmd_handler_args *args)
+static enum ec_status hc_cbi_set(struct host_cmd_handler_args *args)
{
const struct __ec_align4 ec_params_set_cbi *p = args->params;
diff --git a/common/charge_manager.c b/common/charge_manager.c
index 4c56a21afc..176781234f 100644
--- a/common/charge_manager.c
+++ b/common/charge_manager.c
@@ -1196,7 +1196,7 @@ int charge_manager_get_source_pdo(const uint32_t **src_pdo, const int port)
#endif /* CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT */
#ifndef TEST_BUILD
-static int hc_pd_power_info(struct host_cmd_handler_args *args)
+static enum ec_status hc_pd_power_info(struct host_cmd_handler_args *args)
{
const struct ec_params_usb_pd_power_info *p = args->params;
struct ec_response_usb_pd_power_info *r = args->response;
@@ -1219,7 +1219,7 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_POWER_INFO,
EC_VER_MASK(0));
#endif /* TEST_BUILD */
-static int hc_charge_port_count(struct host_cmd_handler_args *args)
+static enum ec_status hc_charge_port_count(struct host_cmd_handler_args *args)
{
struct ec_response_charge_port_count *resp = args->response;
@@ -1232,7 +1232,8 @@ DECLARE_HOST_COMMAND(EC_CMD_CHARGE_PORT_COUNT,
hc_charge_port_count,
EC_VER_MASK(0));
-static int hc_charge_port_override(struct host_cmd_handler_args *args)
+static enum ec_status
+hc_charge_port_override(struct host_cmd_handler_args *args)
{
const struct ec_params_charge_port_override *p = args->params;
const int16_t override_port = p->override_port;
@@ -1249,7 +1250,7 @@ DECLARE_HOST_COMMAND(EC_CMD_PD_CHARGE_PORT_OVERRIDE,
EC_VER_MASK(0));
#if CONFIG_DEDICATED_CHARGE_PORT_COUNT > 0
-static int hc_override_dedicated_charger_limit(
+static enum ec_status hc_override_dedicated_charger_limit(
struct host_cmd_handler_args *args)
{
const struct ec_params_dedicated_charger_limit *p = args->params;
@@ -1326,7 +1327,8 @@ static void charge_manager_external_power_limit_off(void)
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, charge_manager_external_power_limit_off,
HOOK_PRIO_DEFAULT);
-static int hc_external_power_limit(struct host_cmd_handler_args *args)
+static enum ec_status
+hc_external_power_limit(struct host_cmd_handler_args *args)
{
const struct ec_params_external_power_limit_v1 *p = args->params;
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index d5a2fb7cef..11d11d1aa7 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -2262,7 +2262,8 @@ int charge_set_input_current_limit(int ma, int mv)
/*****************************************************************************/
/* Host commands */
-static int charge_command_charge_control(struct host_cmd_handler_args *args)
+static enum ec_status
+charge_command_charge_control(struct host_cmd_handler_args *args)
{
const struct ec_params_charge_control *p = args->params;
int rv;
@@ -2293,7 +2294,8 @@ static void reset_current_limit(void)
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, reset_current_limit, HOOK_PRIO_DEFAULT);
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, reset_current_limit, HOOK_PRIO_DEFAULT);
-static int charge_command_current_limit(struct host_cmd_handler_args *args)
+static enum ec_status
+charge_command_current_limit(struct host_cmd_handler_args *args)
{
const struct ec_params_current_limit *p = args->params;
@@ -2304,7 +2306,8 @@ static int charge_command_current_limit(struct host_cmd_handler_args *args)
DECLARE_HOST_COMMAND(EC_CMD_CHARGE_CURRENT_LIMIT, charge_command_current_limit,
EC_VER_MASK(0));
-static int charge_command_charge_state(struct host_cmd_handler_args *args)
+static enum ec_status
+charge_command_charge_state(struct host_cmd_handler_args *args)
{
const struct ec_params_charge_state *in = args->params;
struct ec_response_charge_state *out = args->response;
diff --git a/common/chipset.c b/common/chipset.c
index 232c9fcb42..209334add5 100644
--- a/common/chipset.c
+++ b/common/chipset.c
@@ -47,7 +47,7 @@ DECLARE_CONSOLE_COMMAND(apshutdown, command_apshutdown,
#endif
#ifdef CONFIG_HOSTCMD_AP_RESET
-static int host_command_apreset(struct host_cmd_handler_args *args)
+static enum ec_status host_command_apreset(struct host_cmd_handler_args *args)
{
/* Force the chipset to reset */
chipset_reset(CHIPSET_RESET_HOST_CMD);
diff --git a/common/device_event.c b/common/device_event.c
index 3cb81abb6f..ab11c0826c 100644
--- a/common/device_event.c
+++ b/common/device_event.c
@@ -102,7 +102,7 @@ DECLARE_CONSOLE_COMMAND(deviceevent, command_device_event,
/*****************************************************************************/
/* Host commands */
-static int device_event_cmd(struct host_cmd_handler_args *args)
+static enum ec_status device_event_cmd(struct host_cmd_handler_args *args)
{
const struct ec_params_device_event *p = args->params;
struct ec_response_device_event *r = args->response;
diff --git a/common/fan.c b/common/fan.c
index a3748c2d1b..f3ee013a4c 100644
--- a/common/fan.c
+++ b/common/fan.c
@@ -342,7 +342,8 @@ void dptf_set_fan_duty_target(int pct)
/*****************************************************************************/
/* Host commands */
-static int hc_pwm_get_fan_target_rpm(struct host_cmd_handler_args *args)
+static enum ec_status
+hc_pwm_get_fan_target_rpm(struct host_cmd_handler_args *args)
{
struct ec_response_pwm_get_fan_rpm *r = args->response;
@@ -359,7 +360,8 @@ DECLARE_HOST_COMMAND(EC_CMD_PWM_GET_FAN_TARGET_RPM,
hc_pwm_get_fan_target_rpm,
EC_VER_MASK(0));
-static int hc_pwm_set_fan_target_rpm(struct host_cmd_handler_args *args)
+static enum ec_status
+hc_pwm_set_fan_target_rpm(struct host_cmd_handler_args *args)
{
const struct ec_params_pwm_set_fan_target_rpm_v1 *p_v1 = args->params;
const struct ec_params_pwm_set_fan_target_rpm_v0 *p_v0 = args->params;
@@ -395,7 +397,7 @@ DECLARE_HOST_COMMAND(EC_CMD_PWM_SET_FAN_TARGET_RPM,
hc_pwm_set_fan_target_rpm,
EC_VER_MASK(0) | EC_VER_MASK(1));
-static int hc_pwm_set_fan_duty(struct host_cmd_handler_args *args)
+static enum ec_status hc_pwm_set_fan_duty(struct host_cmd_handler_args *args)
{
const struct ec_params_pwm_set_fan_duty_v1 *p_v1 = args->params;
const struct ec_params_pwm_set_fan_duty_v0 *p_v0 = args->params;
@@ -420,7 +422,8 @@ DECLARE_HOST_COMMAND(EC_CMD_PWM_SET_FAN_DUTY,
hc_pwm_set_fan_duty,
EC_VER_MASK(0) | EC_VER_MASK(1));
-static int hc_thermal_auto_fan_ctrl(struct host_cmd_handler_args *args)
+static enum ec_status
+hc_thermal_auto_fan_ctrl(struct host_cmd_handler_args *args)
{
int fan;
const struct ec_params_auto_fan_ctrl_v1 *p_v1 = args->params;
diff --git a/common/flash.c b/common/flash.c
index 632153a99b..00d13d2693 100644
--- a/common/flash.c
+++ b/common/flash.c
@@ -1105,7 +1105,7 @@ DECLARE_CONSOLE_COMMAND(flashwp, command_flash_wp,
#define EC_FLASH_REGION_START MIN(CONFIG_EC_PROTECTED_STORAGE_OFF, \
CONFIG_EC_WRITABLE_STORAGE_OFF)
-static int flash_command_get_info(struct host_cmd_handler_args *args)
+static enum ec_status flash_command_get_info(struct host_cmd_handler_args *args)
{
const struct ec_params_flash_info_2 *p_2 = args->params;
struct ec_response_flash_info_2 *r_2 = args->response;
@@ -1200,7 +1200,7 @@ DECLARE_HOST_COMMAND(EC_CMD_FLASH_INFO,
flash_command_get_info, FLASH_INFO_VER);
-static int flash_command_read(struct host_cmd_handler_args *args)
+static enum ec_status flash_command_read(struct host_cmd_handler_args *args)
{
const struct ec_params_flash_read *p = args->params;
uint32_t offset = p->offset + EC_FLASH_REGION_START;
@@ -1225,7 +1225,7 @@ DECLARE_HOST_COMMAND(EC_CMD_FLASH_READ,
* Version 0 and 1 are equivalent from the EC-side; the only difference is
* that the host can only send 64 bytes of data at a time in version 0.
*/
-static int flash_command_write(struct host_cmd_handler_args *args)
+static enum ec_status flash_command_write(struct host_cmd_handler_args *args)
{
const struct ec_params_flash_write *p = args->params;
uint32_t offset = p->offset + EC_FLASH_REGION_START;
@@ -1259,7 +1259,7 @@ BUILD_ASSERT(CONFIG_RO_SIZE % CONFIG_FLASH_ERASE_SIZE == 0);
BUILD_ASSERT(CONFIG_RW_SIZE % CONFIG_FLASH_ERASE_SIZE == 0);
#endif
-static int flash_command_erase(struct host_cmd_handler_args *args)
+static enum ec_status flash_command_erase(struct host_cmd_handler_args *args)
{
const struct ec_params_flash_erase *p = args->params;
int rc = EC_RES_SUCCESS, cmd = FLASH_ERASE_SECTOR;
@@ -1328,7 +1328,7 @@ DECLARE_HOST_COMMAND(EC_CMD_FLASH_ERASE, flash_command_erase,
#endif
);
-static int flash_command_protect(struct host_cmd_handler_args *args)
+static enum ec_status flash_command_protect(struct host_cmd_handler_args *args)
{
const struct ec_params_flash_protect *p = args->params;
struct ec_response_flash_protect *r = args->response;
@@ -1372,7 +1372,8 @@ DECLARE_HOST_COMMAND(EC_CMD_FLASH_PROTECT,
flash_command_protect,
EC_VER_MASK(0) | EC_VER_MASK(1));
-static int flash_command_region_info(struct host_cmd_handler_args *args)
+static enum ec_status
+flash_command_region_info(struct host_cmd_handler_args *args)
{
const struct ec_params_flash_region_info *p = args->params;
struct ec_response_flash_region_info *r = args->response;
@@ -1413,7 +1414,7 @@ DECLARE_HOST_COMMAND(EC_CMD_FLASH_REGION_INFO,
#ifdef CONFIG_FLASH_SELECT_REQUIRED
-static int flash_command_select(struct host_cmd_handler_args *args)
+static enum ec_status flash_command_select(struct host_cmd_handler_args *args)
{
const struct ec_params_flash_select *p = args->params;
diff --git a/common/fpsensor/fpsensor.c b/common/fpsensor/fpsensor.c
index 11060baf6c..5574a625fb 100644
--- a/common/fpsensor/fpsensor.c
+++ b/common/fpsensor/fpsensor.c
@@ -289,7 +289,7 @@ void fp_task(void)
#endif /* !HAVE_FP_PRIVATE_DRIVER */
}
-static int fp_command_passthru(struct host_cmd_handler_args *args)
+static enum ec_status fp_command_passthru(struct host_cmd_handler_args *args)
{
const struct ec_params_fp_passthru *params = args->params;
void *out = args->response;
@@ -321,7 +321,7 @@ static int fp_command_passthru(struct host_cmd_handler_args *args)
}
DECLARE_HOST_COMMAND(EC_CMD_FP_PASSTHRU, fp_command_passthru, EC_VER_MASK(0));
-static int fp_command_info(struct host_cmd_handler_args *args)
+static enum ec_status fp_command_info(struct host_cmd_handler_args *args)
{
struct ec_response_fp_info *r = args->response;
@@ -355,7 +355,7 @@ static int validate_fp_buffer_offset(const uint32_t buffer_size,
return EC_SUCCESS;
}
-static int fp_command_frame(struct host_cmd_handler_args *args)
+static enum ec_status fp_command_frame(struct host_cmd_handler_args *args)
{
const struct ec_params_fp_frame *params = args->params;
void *out = args->response;
@@ -443,7 +443,7 @@ static int fp_command_frame(struct host_cmd_handler_args *args)
}
DECLARE_HOST_COMMAND(EC_CMD_FP_FRAME, fp_command_frame, EC_VER_MASK(0));
-static int fp_command_stats(struct host_cmd_handler_args *args)
+static enum ec_status fp_command_stats(struct host_cmd_handler_args *args)
{
struct ec_response_fp_stats *r = args->response;
@@ -470,7 +470,7 @@ static int validate_template_format(
return EC_RES_SUCCESS;
}
-static int fp_command_template(struct host_cmd_handler_args *args)
+static enum ec_status fp_command_template(struct host_cmd_handler_args *args)
{
const struct ec_params_fp_template *params = args->params;
uint32_t size = params->size & ~FP_TEMPLATE_COMMIT;
diff --git a/common/fpsensor/fpsensor_state.c b/common/fpsensor/fpsensor_state.c
index bfbf0c6cb5..c395bd7af3 100644
--- a/common/fpsensor/fpsensor_state.c
+++ b/common/fpsensor/fpsensor_state.c
@@ -92,7 +92,7 @@ int fp_get_next_event(uint8_t *out)
}
DECLARE_EVENT_SOURCE(EC_MKBP_EVENT_FINGERPRINT, fp_get_next_event);
-static int fp_command_tpm_seed(struct host_cmd_handler_args *args)
+static enum ec_status fp_command_tpm_seed(struct host_cmd_handler_args *args)
{
const struct ec_params_fp_seed *params = args->params;
@@ -117,7 +117,8 @@ int fp_tpm_seed_is_set(void)
return fp_encryption_status & FP_ENC_STATUS_SEED_SET;
}
-static int fp_command_encryption_status(struct host_cmd_handler_args *args)
+static enum ec_status
+fp_command_encryption_status(struct host_cmd_handler_args *args)
{
struct ec_response_fp_encryption_status *r = args->response;
@@ -182,7 +183,7 @@ int fp_set_sensor_mode(uint32_t mode, uint32_t *mode_output)
return EC_RES_SUCCESS;
}
-static int fp_command_mode(struct host_cmd_handler_args *args)
+static enum ec_status fp_command_mode(struct host_cmd_handler_args *args)
{
const struct ec_params_fp_mode *p = args->params;
struct ec_response_fp_mode *r = args->response;
@@ -196,7 +197,7 @@ static int fp_command_mode(struct host_cmd_handler_args *args)
}
DECLARE_HOST_COMMAND(EC_CMD_FP_MODE, fp_command_mode, EC_VER_MASK(0));
-static int fp_command_context(struct host_cmd_handler_args *args)
+static enum ec_status fp_command_context(struct host_cmd_handler_args *args)
{
const struct ec_params_fp_context *params = args->params;
diff --git a/common/gpio_commands.c b/common/gpio_commands.c
index e71497fc4b..f66b76a9dc 100644
--- a/common/gpio_commands.c
+++ b/common/gpio_commands.c
@@ -207,7 +207,7 @@ DECLARE_CONSOLE_COMMAND(gpioset, command_gpio_set,
/*****************************************************************************/
/* Host commands */
-static int gpio_command_get(struct host_cmd_handler_args *args)
+static enum ec_status gpio_command_get(struct host_cmd_handler_args *args)
{
const struct ec_params_gpio_get_v1 *p_v1 = args->params;
struct ec_response_gpio_get_v1 *r_v1 = args->response;
@@ -260,7 +260,7 @@ static int gpio_command_get(struct host_cmd_handler_args *args)
DECLARE_HOST_COMMAND(EC_CMD_GPIO_GET, gpio_command_get,
EC_VER_MASK(0) | EC_VER_MASK(1));
-static int gpio_command_set(struct host_cmd_handler_args *args)
+static enum ec_status gpio_command_set(struct host_cmd_handler_args *args)
{
const struct ec_params_gpio_set *p = args->params;
diff --git a/common/host_command.c b/common/host_command.c
index f4431b3c99..9e14156c6e 100644
--- a/common/host_command.c
+++ b/common/host_command.c
@@ -469,7 +469,8 @@ void host_command_task(void *u)
/* Host commands */
/* TODO(crosbug.com/p/11223): Remove this once the kernel no longer cares */
-static int host_command_proto_version(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_proto_version(struct host_cmd_handler_args *args)
{
struct ec_response_proto_version *r = args->response;
@@ -482,7 +483,7 @@ DECLARE_HOST_COMMAND(EC_CMD_PROTO_VERSION,
host_command_proto_version,
EC_VER_MASK(0));
-static int host_command_hello(struct host_cmd_handler_args *args)
+static enum ec_status host_command_hello(struct host_cmd_handler_args *args)
{
const struct ec_params_hello *p = args->params;
struct ec_response_hello *r = args->response;
@@ -497,7 +498,7 @@ DECLARE_HOST_COMMAND(EC_CMD_HELLO,
host_command_hello,
EC_VER_MASK(0));
-static int host_command_read_test(struct host_cmd_handler_args *args)
+static enum ec_status host_command_read_test(struct host_cmd_handler_args *args)
{
const struct ec_params_read_test *p = args->params;
struct ec_response_read_test *r = args->response;
@@ -525,7 +526,8 @@ DECLARE_HOST_COMMAND(EC_CMD_READ_TEST,
* Host command to read memory map is not needed on LPC, because LPC can
* directly map the data to the host's memory space.
*/
-static int host_command_read_memmap(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_read_memmap(struct host_cmd_handler_args *args)
{
const struct ec_params_read_memmap *p = args->params;
@@ -552,7 +554,8 @@ DECLARE_HOST_COMMAND(EC_CMD_READ_MEMMAP,
EC_VER_MASK(0));
#endif
-static int host_command_get_cmd_versions(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_get_cmd_versions(struct host_cmd_handler_args *args)
{
const struct ec_params_get_cmd_versions *p = args->params;
const struct ec_params_get_cmd_versions_v1 *p_v1 = args->params;
@@ -716,14 +719,15 @@ uint16_t host_command_process(struct host_cmd_handler_args *args)
#ifdef CONFIG_HOST_COMMAND_STATUS
/* Returns current command status (busy or not) */
-static int host_command_get_comms_status(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_get_comms_status(struct host_cmd_handler_args *args)
{
struct ec_response_get_comms_status *r = args->response;
r->flags = command_pending ? EC_COMMS_STATUS_PROCESSING : 0;
args->response_size = sizeof(*r);
- return EC_SUCCESS;
+ return EC_RES_SUCCESS;
}
DECLARE_HOST_COMMAND(EC_CMD_GET_COMMS_STATUS,
@@ -731,7 +735,8 @@ DECLARE_HOST_COMMAND(EC_CMD_GET_COMMS_STATUS,
EC_VER_MASK(0));
/* Resend the last saved response */
-static int host_command_resend_response(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_resend_response(struct host_cmd_handler_args *args)
{
/* Handle resending response */
args->result = saved_result;
@@ -739,7 +744,7 @@ static int host_command_resend_response(struct host_cmd_handler_args *args)
saved_result = EC_RES_UNAVAILABLE;
- return EC_SUCCESS;
+ return EC_RES_SUCCESS;
}
DECLARE_HOST_COMMAND(EC_CMD_RESEND_RESPONSE,
@@ -747,20 +752,21 @@ DECLARE_HOST_COMMAND(EC_CMD_RESEND_RESPONSE,
EC_VER_MASK(0));
#endif /* CONFIG_HOST_COMMAND_STATUS */
-
-static int host_command_entering_mode(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_entering_mode(struct host_cmd_handler_args *args)
{
struct ec_params_entering_mode *param =
(struct ec_params_entering_mode *)args->params;
args->response_size = 0;
g_vboot_mode = param->vboot_mode;
- return EC_SUCCESS;
+ return EC_RES_SUCCESS;
}
DECLARE_HOST_COMMAND(EC_CMD_ENTERING_MODE,
host_command_entering_mode, EC_VER_MASK(0));
/* Returns what we tell it to. */
-static int host_command_test_protocol(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_test_protocol(struct host_cmd_handler_args *args)
{
const struct ec_params_test_protocol *p = args->params;
struct ec_response_test_protocol *r = args->response;
@@ -777,7 +783,8 @@ DECLARE_HOST_COMMAND(EC_CMD_TEST_PROTOCOL,
EC_VER_MASK(0));
/* Returns supported features. */
-static int host_command_get_features(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_get_features(struct host_cmd_handler_args *args)
{
struct ec_response_get_features *r = args->response;
args->response_size = sizeof(*r);
diff --git a/common/host_command_pd.c b/common/host_command_pd.c
index a02fd754c4..3f0f83c4b2 100644
--- a/common/host_command_pd.c
+++ b/common/host_command_pd.c
@@ -235,7 +235,8 @@ void pd_command_task(void *u)
*/
static uint32_t pd_host_event_status __aligned(4);
-static int hc_pd_host_event_status(struct host_cmd_handler_args *args)
+static enum ec_status
+hc_pd_host_event_status(struct host_cmd_handler_args *args)
{
struct ec_response_host_event_status *r = args->response;
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;
diff --git a/common/i2c_master.c b/common/i2c_master.c
index 956de25d3e..ea33b6f533 100644
--- a/common/i2c_master.c
+++ b/common/i2c_master.c
@@ -779,7 +779,7 @@ static int check_i2c_params(const struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-static int i2c_command_passthru(struct host_cmd_handler_args *args)
+static enum ec_status i2c_command_passthru(struct host_cmd_handler_args *args)
{
const struct ec_params_i2c_passthru *params = args->params;
const struct ec_params_i2c_passthru_msg *msg;
@@ -933,7 +933,8 @@ static void i2c_passthru_protect_tcpc_ports(void)
#endif
}
-static int i2c_command_passthru_protect(struct host_cmd_handler_args *args)
+static enum ec_status
+i2c_command_passthru_protect(struct host_cmd_handler_args *args)
{
const struct ec_params_i2c_passthru_protect *params = args->params;
struct ec_response_i2c_passthru_protect *resp = args->response;
diff --git a/common/i2c_slave.c b/common/i2c_slave.c
index e0b975246a..7e710b2ef4 100644
--- a/common/i2c_slave.c
+++ b/common/i2c_slave.c
@@ -9,7 +9,7 @@
#include "i2c.h"
#include "util.h"
-int i2c_get_protocol_info(struct host_cmd_handler_args *args)
+enum ec_status i2c_get_protocol_info(struct host_cmd_handler_args *args)
{
struct ec_response_get_protocol_info *r = args->response;
diff --git a/common/keyboard_backlight.c b/common/keyboard_backlight.c
index 7962fea99c..c0c46e5299 100644
--- a/common/keyboard_backlight.c
+++ b/common/keyboard_backlight.c
@@ -124,7 +124,7 @@ DECLARE_CONSOLE_COMMAND(kblight, cc_kblight,
"percent",
"Get/set keyboard backlight");
-int hc_get_keyboard_backlight(struct host_cmd_handler_args *args)
+enum ec_status hc_get_keyboard_backlight(struct host_cmd_handler_args *args)
{
struct ec_response_pwm_get_keyboard_backlight *r = args->response;
@@ -138,7 +138,7 @@ DECLARE_HOST_COMMAND(EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT,
hc_get_keyboard_backlight,
EC_VER_MASK(0));
-int hc_set_keyboard_backlight(struct host_cmd_handler_args *args)
+enum ec_status hc_set_keyboard_backlight(struct host_cmd_handler_args *args)
{
const struct ec_params_pwm_set_keyboard_backlight *p = args->params;
diff --git a/common/keyboard_mkbp.c b/common/keyboard_mkbp.c
index c39028cfbc..ff7ddc4d5c 100644
--- a/common/keyboard_mkbp.c
+++ b/common/keyboard_mkbp.c
@@ -448,7 +448,7 @@ static uint32_t get_supported_switches(void)
return val;
}
-static int mkbp_get_info(struct host_cmd_handler_args *args)
+static enum ec_status mkbp_get_info(struct host_cmd_handler_args *args)
{
const struct ec_params_mkbp_info *p = args->params;
@@ -679,7 +679,8 @@ static void keyscan_copy_config(const struct ec_mkbp_config *src,
dst->flags = new_flags;
}
-static int host_command_mkbp_set_config(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_mkbp_set_config(struct host_cmd_handler_args *args)
{
const struct ec_params_mkbp_set_config *req = args->params;
@@ -693,7 +694,8 @@ DECLARE_HOST_COMMAND(EC_CMD_MKBP_SET_CONFIG,
host_command_mkbp_set_config,
EC_VER_MASK(0));
-static int host_command_mkbp_get_config(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_mkbp_get_config(struct host_cmd_handler_args *args)
{
struct ec_response_mkbp_get_config *resp = args->response;
struct ec_mkbp_config *dst = &resp->config;
diff --git a/common/keyboard_scan.c b/common/keyboard_scan.c
index 0f38692788..b4dd719784 100644
--- a/common/keyboard_scan.c
+++ b/common/keyboard_scan.c
@@ -840,7 +840,8 @@ DECLARE_HOOK(HOOK_USB_PM_CHANGE, keyboard_usb_pm_change, HOOK_PRIO_DEFAULT);
/*****************************************************************************/
/* Host commands */
-static int mkbp_command_simulate_key(struct host_cmd_handler_args *args)
+static enum ec_status
+mkbp_command_simulate_key(struct host_cmd_handler_args *args)
{
const struct ec_params_mkbp_simulate_key *p = args->params;
@@ -923,7 +924,7 @@ done:
return shorted;
}
-static int keyboard_factory_test(struct host_cmd_handler_args *args)
+static enum ec_status keyboard_factory_test(struct host_cmd_handler_args *args)
{
struct ec_response_keyboard_factory_test *r = args->response;
diff --git a/common/keyboard_test.c b/common/keyboard_test.c
index 34c04e7304..e7b1dfe501 100644
--- a/common/keyboard_test.c
+++ b/common/keyboard_test.c
@@ -157,7 +157,7 @@ static int keyscan_seq_collect(struct ec_params_keyscan_seq_ctrl *req,
return sizeof(*resp) + resp->collect.num_items;
}
-static int keyscan_seq_ctrl(struct host_cmd_handler_args *args)
+static enum ec_status keyscan_seq_ctrl(struct host_cmd_handler_args *args)
{
struct ec_params_keyscan_seq_ctrl req, *msg;
struct keyscan_item *ksi;
diff --git a/common/led_common.c b/common/led_common.c
index 086483601b..85879b148f 100644
--- a/common/led_common.c
+++ b/common/led_common.c
@@ -47,7 +47,7 @@ int led_auto_control_is_enabled(enum ec_led_id led_id)
return (led_auto_control_flags & LED_AUTO_CONTROL_FLAG(led_id)) != 0;
}
-static int led_command_control(struct host_cmd_handler_args *args)
+static enum ec_status led_command_control(struct host_cmd_handler_args *args)
{
const struct ec_params_led_control *p = args->params;
struct ec_response_led_control *r = args->response;
diff --git a/common/lid_switch.c b/common/lid_switch.c
index 4b0da4d92d..2528e00092 100644
--- a/common/lid_switch.c
+++ b/common/lid_switch.c
@@ -151,7 +151,7 @@ DECLARE_CONSOLE_COMMAND(lidstate, command_lidstate,
/**
* Host command to enable/disable lid opened.
*/
-static int hc_force_lid_open(struct host_cmd_handler_args *args)
+static enum ec_status hc_force_lid_open(struct host_cmd_handler_args *args)
{
const struct ec_params_force_lid_open *p = args->params;
diff --git a/common/lightbar.c b/common/lightbar.c
index 84bd24d0c6..814ef3b2cc 100644
--- a/common/lightbar.c
+++ b/common/lightbar.c
@@ -1699,7 +1699,7 @@ DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, lightbar_shutdown, HOOK_PRIO_DEFAULT);
/* Host commands via LPC bus */
/****************************************************************************/
-static int lpc_cmd_lightbar(struct host_cmd_handler_args *args)
+static enum ec_status lpc_cmd_lightbar(struct host_cmd_handler_args *args)
{
const struct ec_params_lightbar *in = args->params;
struct ec_response_lightbar *out = args->response;
diff --git a/common/mkbp_event.c b/common/mkbp_event.c
index 32169d24e3..74fb1409fe 100644
--- a/common/mkbp_event.c
+++ b/common/mkbp_event.c
@@ -313,7 +313,7 @@ static int take_event_if_set(uint8_t event_type)
return taken;
}
-static int mkbp_get_next_event(struct host_cmd_handler_args *args)
+static enum ec_status mkbp_get_next_event(struct host_cmd_handler_args *args)
{
static int last;
int i, evt;
@@ -384,7 +384,8 @@ DECLARE_HOST_COMMAND(EC_CMD_GET_NEXT_EVENT,
#ifdef CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK
#ifdef CONFIG_MKBP_USE_HOST_EVENT
-static int mkbp_get_host_event_wake_mask(struct host_cmd_handler_args *args)
+static enum ec_status
+mkbp_get_host_event_wake_mask(struct host_cmd_handler_args *args)
{
struct ec_response_host_event_mask *r = args->response;
@@ -401,7 +402,7 @@ DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_GET_WAKE_MASK,
#if defined(CONFIG_MKBP_EVENT_WAKEUP_MASK) || \
defined(CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK)
-static int hc_mkbp_wake_mask(struct host_cmd_handler_args *args)
+static enum ec_status hc_mkbp_wake_mask(struct host_cmd_handler_args *args)
{
struct ec_response_mkbp_event_wake_mask *r = args->response;
const struct ec_params_mkbp_event_wake_mask *p = args->params;
diff --git a/common/motion_lid.c b/common/motion_lid.c
index bb07dcaf91..bdef89f3b7 100644
--- a/common/motion_lid.c
+++ b/common/motion_lid.c
@@ -497,7 +497,7 @@ void motion_lid_calc(void)
/* Host commands */
-int host_cmd_motion_lid(struct host_cmd_handler_args *args)
+enum ec_status host_cmd_motion_lid(struct host_cmd_handler_args *args)
{
const struct ec_params_motion_sense *in = args->params;
struct ec_response_motion_sense *out = args->response;
diff --git a/common/motion_sense.c b/common/motion_sense.c
index c74971a14b..77f007e556 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -1000,7 +1000,7 @@ static struct motion_sensor_t
return host_sensor_id_to_real_sensor(host_id);
}
-static int host_cmd_motion_sense(struct host_cmd_handler_args *args)
+static enum ec_status host_cmd_motion_sense(struct host_cmd_handler_args *args)
{
const struct ec_params_motion_sense *in = args->params;
struct ec_response_motion_sense *out = args->response;
diff --git a/common/panic_output.c b/common/panic_output.c
index cce99e23a3..8188cea299 100644
--- a/common/panic_output.c
+++ b/common/panic_output.c
@@ -254,7 +254,7 @@ DECLARE_CONSOLE_COMMAND(panicinfo, command_panicinfo,
/*****************************************************************************/
/* Host commands */
-int host_command_panic_info(struct host_cmd_handler_args *args)
+enum ec_status host_command_panic_info(struct host_cmd_handler_args *args)
{
if (pdata_ptr->magic == PANIC_DATA_MAGIC) {
ASSERT(pdata_ptr->struct_size <= args->response_max);
diff --git a/common/pd_log.c b/common/pd_log.c
index 86aa2b9e69..b91a58762c 100644
--- a/common/pd_log.c
+++ b/common/pd_log.c
@@ -58,7 +58,7 @@ void pd_log_recv_vdm(int port, int cnt, uint32_t *payload)
}
/* we are a PD MCU/EC, send back the events to the host */
-static int hc_pd_get_log_entry(struct host_cmd_handler_args *args)
+static enum ec_status hc_pd_get_log_entry(struct host_cmd_handler_args *args)
{
struct ec_response_pd_log *r = args->response;
@@ -88,7 +88,7 @@ DECLARE_HOST_COMMAND(EC_CMD_PD_GET_LOG_ENTRY,
hc_pd_get_log_entry,
EC_VER_MASK(0));
-static int hc_pd_write_log_entry(struct host_cmd_handler_args *args)
+static enum ec_status hc_pd_write_log_entry(struct host_cmd_handler_args *args)
{
const struct ec_params_pd_write_log_entry *p = args->params;
uint8_t type = p->type;
diff --git a/common/peripheral.c b/common/peripheral.c
index f45a13ff19..686368fd02 100644
--- a/common/peripheral.c
+++ b/common/peripheral.c
@@ -10,7 +10,7 @@
#include "usb_pd_tcpm.h"
#ifdef CONFIG_HOSTCMD_LOCATE_CHIP
-static int hc_locate_chip(struct host_cmd_handler_args *args)
+static enum ec_status hc_locate_chip(struct host_cmd_handler_args *args)
{
const struct ec_params_locate_chip *params = args->params;
struct ec_response_locate_chip *resp = args->response;
diff --git a/common/port80.c b/common/port80.c
index 881fb6f85f..7bb708e964 100644
--- a/common/port80.c
+++ b/common/port80.c
@@ -153,7 +153,7 @@ DECLARE_CONSOLE_COMMAND(port80, command_port80,
"[scroll | intprint | flush]",
"Print port80 writes or toggle port80 scrolling");
-int port80_last_boot(struct host_cmd_handler_args *args)
+enum ec_status port80_last_boot(struct host_cmd_handler_args *args)
{
struct ec_response_port80_last_boot *r = args->response;
@@ -163,7 +163,7 @@ int port80_last_boot(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-int port80_command_read(struct host_cmd_handler_args *args)
+enum ec_status port80_command_read(struct host_cmd_handler_args *args)
{
const struct ec_params_port80_read *p = args->params;
uint32_t offset = p->read_buffer.offset;
diff --git a/common/power_button_x86.c b/common/power_button_x86.c
index 6909815972..e5772d2f68 100644
--- a/common/power_button_x86.c
+++ b/common/power_button_x86.c
@@ -504,7 +504,7 @@ DECLARE_HOOK(HOOK_POWER_BUTTON_CHANGE, powerbtn_x86_changed, HOOK_PRIO_DEFAULT);
/**
* Handle configuring the power button behavior through a host command
*/
-static int hc_config_powerbtn_x86(struct host_cmd_handler_args *args)
+static enum ec_status hc_config_powerbtn_x86(struct host_cmd_handler_args *args)
{
const struct ec_params_config_power_button *p = args->params;
diff --git a/common/pstore_commands.c b/common/pstore_commands.c
index 78b8a6a90c..52270cd1cf 100644
--- a/common/pstore_commands.c
+++ b/common/pstore_commands.c
@@ -10,7 +10,7 @@
#include "host_command.h"
#include "util.h"
-int pstore_command_get_info(struct host_cmd_handler_args *args)
+enum ec_status pstore_command_get_info(struct host_cmd_handler_args *args)
{
struct ec_response_pstore_info *r = args->response;
@@ -26,7 +26,7 @@ DECLARE_HOST_COMMAND(EC_CMD_PSTORE_INFO,
pstore_command_get_info,
EC_VER_MASK(0));
-int pstore_command_read(struct host_cmd_handler_args *args)
+enum ec_status pstore_command_read(struct host_cmd_handler_args *args)
{
const struct ec_params_pstore_read *p = args->params;
char *dest = args->response;
@@ -63,7 +63,7 @@ DECLARE_HOST_COMMAND(EC_CMD_PSTORE_READ,
pstore_command_read,
EC_VER_MASK(0));
-int pstore_command_write(struct host_cmd_handler_args *args)
+enum ec_status pstore_command_write(struct host_cmd_handler_args *args)
{
const struct ec_params_pstore_write *p = args->params;
diff --git a/common/pwm.c b/common/pwm.c
index 7ed963e9dc..73b12fc20c 100644
--- a/common/pwm.c
+++ b/common/pwm.c
@@ -54,7 +54,8 @@ __attribute__((weak)) uint16_t pwm_get_raw_duty(enum pwm_channel ch)
return (pwm_get_duty(ch) * 65535) / 100;
}
-static int host_command_pwm_set_duty(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_pwm_set_duty(struct host_cmd_handler_args *args)
{
const struct ec_params_pwm_set_duty *p = args->params;
enum pwm_channel channel;
@@ -71,7 +72,8 @@ DECLARE_HOST_COMMAND(EC_CMD_PWM_SET_DUTY,
host_command_pwm_set_duty,
EC_VER_MASK(0));
-static int host_command_pwm_get_duty(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_pwm_get_duty(struct host_cmd_handler_args *args)
{
const struct ec_params_pwm_get_duty *p = args->params;
struct ec_response_pwm_get_duty *r = args->response;
diff --git a/common/rollback.c b/common/rollback.c
index 0c2c41c738..4654b21b64 100644
--- a/common/rollback.c
+++ b/common/rollback.c
@@ -460,7 +460,8 @@ out:
}
DECLARE_DEFERRED(add_entropy_deferred);
-static int hc_rollback_add_entropy(struct host_cmd_handler_args *args)
+static enum ec_status
+hc_rollback_add_entropy(struct host_cmd_handler_args *args)
{
const struct ec_params_rollback_add_entropy *p = args->params;
@@ -535,7 +536,8 @@ DECLARE_SAFE_CONSOLE_COMMAND(rollbackinfo, command_rollback_info,
NULL,
"Print rollback info");
-static int host_command_rollback_info(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_rollback_info(struct host_cmd_handler_args *args)
{
int ret = EC_RES_UNAVAILABLE;
struct ec_response_rollback_info *r = args->response;
diff --git a/common/rwsig.c b/common/rwsig.c
index ac86cf2a39..8bccd2acb1 100644
--- a/common/rwsig.c
+++ b/common/rwsig.c
@@ -290,7 +290,7 @@ exit:
task_wait_event(-1);
}
-int rwsig_cmd_action(struct host_cmd_handler_args *args)
+enum ec_status rwsig_cmd_action(struct host_cmd_handler_args *args)
{
const struct ec_params_rwsig_action *p = args->params;
@@ -312,7 +312,7 @@ DECLARE_HOST_COMMAND(EC_CMD_RWSIG_ACTION,
EC_VER_MASK(0));
#else /* !HAS_TASK_RWSIG */
-int rwsig_cmd_check_status(struct host_cmd_handler_args *args)
+enum ec_status rwsig_cmd_check_status(struct host_cmd_handler_args *args)
{
struct ec_response_rwsig_check_status *r = args->response;
diff --git a/common/spi_flash.c b/common/spi_flash.c
index ea9095fac1..3f003052bf 100644
--- a/common/spi_flash.c
+++ b/common/spi_flash.c
@@ -507,7 +507,7 @@ DECLARE_CONSOLE_COMMAND(spi_flashinfo, command_spi_flashinfo,
"Print SPI flash info");
#ifdef CONFIG_HOSTCMD_FLASH_SPI_INFO
-static int flash_command_spi_info(struct host_cmd_handler_args *args)
+static enum ec_status flash_command_spi_info(struct host_cmd_handler_args *args)
{
struct ec_response_flash_spi_info *r = args->response;
diff --git a/common/system.c b/common/system.c
index 9efb931baa..074ae24af7 100644
--- a/common/system.c
+++ b/common/system.c
@@ -1311,7 +1311,8 @@ DECLARE_CONSOLE_COMMAND(sysrq, command_sysrq,
/*****************************************************************************/
/* Host commands */
-static int host_command_get_version(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_get_version(struct host_cmd_handler_args *args)
{
struct ec_response_get_version *r = args->response;
enum system_image_copy_t active_slot = system_get_active_copy();
@@ -1344,7 +1345,8 @@ DECLARE_HOST_COMMAND(EC_CMD_GET_VERSION,
EC_VER_MASK(0));
#ifdef CONFIG_HOSTCMD_SKUID
-static int host_command_get_sku_id(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_get_sku_id(struct host_cmd_handler_args *args)
{
struct ec_sku_id_info *r = args->response;
@@ -1359,7 +1361,8 @@ DECLARE_HOST_COMMAND(EC_CMD_GET_SKU_ID,
#endif
#ifdef CONFIG_HOSTCMD_AP_SET_SKUID
-static int host_command_set_sku_id(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_set_sku_id(struct host_cmd_handler_args *args)
{
const struct ec_sku_id_info *p = args->params;
@@ -1373,7 +1376,8 @@ DECLARE_HOST_COMMAND(EC_CMD_SET_SKU_ID,
#endif
#ifdef CONFIG_KEYBOARD_LANGUAGE_ID
-static int host_command_get_keyboard_id(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_get_keyboard_id(struct host_cmd_handler_args *args)
{
struct ec_response_keyboard_id *r = args->response;
@@ -1387,7 +1391,8 @@ DECLARE_HOST_COMMAND(EC_CMD_GET_KEYBOARD_ID,
EC_VER_MASK(0));
#endif
-static int host_command_build_info(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_build_info(struct host_cmd_handler_args *args)
{
strzcpy(args->response, system_get_build_info(), args->response_max);
args->response_size = strlen(args->response) + 1;
@@ -1398,7 +1403,8 @@ DECLARE_HOST_COMMAND(EC_CMD_GET_BUILD_INFO,
host_command_build_info,
EC_VER_MASK(0));
-static int host_command_get_chip_info(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_get_chip_info(struct host_cmd_handler_args *args)
{
struct ec_response_get_chip_info *r = args->response;
@@ -1415,7 +1421,8 @@ DECLARE_HOST_COMMAND(EC_CMD_GET_CHIP_INFO,
EC_VER_MASK(0));
#ifdef CONFIG_BOARD_VERSION
-int host_command_get_board_version(struct host_cmd_handler_args *args)
+enum ec_status
+host_command_get_board_version(struct host_cmd_handler_args *args)
{
struct ec_response_board_version *r = args->response;
int board_version;
@@ -1437,7 +1444,7 @@ DECLARE_HOST_COMMAND(EC_CMD_GET_BOARD_VERSION,
#endif
#ifdef CONFIG_HOSTCMD_VBNV_CONTEXT
-int host_command_vbnvcontext(struct host_cmd_handler_args *args)
+enum ec_status host_command_vbnvcontext(struct host_cmd_handler_args *args)
{
const struct ec_params_vbnvcontext *p = args->params;
struct ec_response_vbnvcontext *r;
@@ -1469,7 +1476,7 @@ DECLARE_HOST_COMMAND(EC_CMD_VBNV_CONTEXT,
EC_VER_MASK(EC_VER_VBNV_CONTEXT));
#endif /* CONFIG_HOSTCMD_VBNV_CONTEXT */
-int host_command_reboot(struct host_cmd_handler_args *args)
+enum ec_status host_command_reboot(struct host_cmd_handler_args *args)
{
struct ec_params_reboot_ec p;
diff --git a/common/temp_sensor.c b/common/temp_sensor.c
index 2b0b6b1514..819da155ac 100644
--- a/common/temp_sensor.c
+++ b/common/temp_sensor.c
@@ -142,7 +142,7 @@ DECLARE_CONSOLE_COMMAND(temps, command_temps,
/*****************************************************************************/
/* Host commands */
-int temp_sensor_command_get_info(struct host_cmd_handler_args *args)
+enum ec_status temp_sensor_command_get_info(struct host_cmd_handler_args *args)
{
const struct ec_params_temp_sensor_get_info *p = args->params;
struct ec_response_temp_sensor_get_info *r = args->response;
diff --git a/common/thermal.c b/common/thermal.c
index a0303f8521..f5988f7046 100644
--- a/common/thermal.c
+++ b/common/thermal.c
@@ -265,7 +265,8 @@ DECLARE_CONSOLE_COMMAND(thermalset, command_thermalset,
* not version 0. Different structs, different meanings.
*/
-static int thermal_command_set_threshold(struct host_cmd_handler_args *args)
+static enum ec_status
+thermal_command_set_threshold(struct host_cmd_handler_args *args)
{
const struct ec_params_thermal_set_threshold_v1 *p = args->params;
@@ -280,7 +281,8 @@ DECLARE_HOST_COMMAND(EC_CMD_THERMAL_SET_THRESHOLD,
thermal_command_set_threshold,
EC_VER_MASK(1));
-static int thermal_command_get_threshold(struct host_cmd_handler_args *args)
+static enum ec_status
+thermal_command_get_threshold(struct host_cmd_handler_args *args)
{
const struct ec_params_thermal_get_threshold_v1 *p = args->params;
struct ec_thermal_config *r = args->response;
diff --git a/common/uart_buffering.c b/common/uart_buffering.c
index f1c68e7773..6eb8241355 100644
--- a/common/uart_buffering.c
+++ b/common/uart_buffering.c
@@ -383,7 +383,8 @@ DECLARE_HOOK(HOOK_INIT, uart_rx_dma_init, HOOK_PRIO_DEFAULT);
/*****************************************************************************/
/* Host commands */
-static int host_command_console_snapshot(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_console_snapshot(struct host_cmd_handler_args *args)
{
return uart_console_read_buffer_init();
}
@@ -391,8 +392,8 @@ DECLARE_HOST_COMMAND(EC_CMD_CONSOLE_SNAPSHOT,
host_command_console_snapshot,
EC_VER_MASK(0));
-
-static int host_command_console_read(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_console_read(struct host_cmd_handler_args *args)
{
if (args->version == 0) {
/*
@@ -428,7 +429,7 @@ DECLARE_HOST_COMMAND(EC_CMD_CONSOLE_READ,
#endif
);
-int uart_console_read_buffer_init(void)
+enum ec_status uart_console_read_buffer_init(void)
{
/* Assume the whole circular buffer is full */
tx_snapshot_head = tx_buf_head;
diff --git a/common/uptime.c b/common/uptime.c
index 2e50ab0fdd..2fdd8bdb19 100644
--- a/common/uptime.c
+++ b/common/uptime.c
@@ -9,7 +9,8 @@
#include "host_command.h"
#include "util.h"
-static int host_command_get_uptime_info(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_get_uptime_info(struct host_cmd_handler_args *args)
{
/*
* In the current implementation, not all terms are preserved across a
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c
index f8499cba0f..3d9d76d0d3 100644
--- a/common/usb_pd_policy.c
+++ b/common/usb_pd_policy.c
@@ -984,7 +984,7 @@ static void pd_usb_billboard_deferred(void)
DECLARE_DEFERRED(pd_usb_billboard_deferred);
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int hc_remote_pd_discovery(struct host_cmd_handler_args *args)
+static enum ec_status hc_remote_pd_discovery(struct host_cmd_handler_args *args)
{
const uint8_t *port = args->params;
struct ec_params_usb_pd_discovery_entry *r = args->response;
@@ -1005,7 +1005,7 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_DISCOVERY,
hc_remote_pd_discovery,
EC_VER_MASK(0));
-static int hc_remote_pd_get_amode(struct host_cmd_handler_args *args)
+static enum ec_status hc_remote_pd_get_amode(struct host_cmd_handler_args *args)
{
struct svdm_amode_data *modep;
const struct ec_params_usb_pd_get_mode_request *p = args->params;
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 30e1fc3652..9885bc6540 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -5293,7 +5293,7 @@ DECLARE_CONSOLE_COMMAND(pd, command_pd,
#ifdef HAS_TASK_HOSTCMD
-static int hc_pd_ports(struct host_cmd_handler_args *args)
+static enum ec_status hc_pd_ports(struct host_cmd_handler_args *args)
{
struct ec_response_usb_pd_ports *r = args->response;
r->num_ports = CONFIG_USB_PD_PORT_COUNT;
@@ -5330,7 +5330,7 @@ __attribute__((weak)) uint8_t board_get_dp_pin_mode(int port)
return 0;
}
-static int hc_usb_pd_control(struct host_cmd_handler_args *args)
+static enum ec_status hc_usb_pd_control(struct host_cmd_handler_args *args)
{
const struct ec_params_usb_pd_control *p = args->params;
struct ec_response_usb_pd_control_v2 *r_v2 = args->response;
@@ -5429,7 +5429,7 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_CONTROL,
EC_VER_MASK(0) | EC_VER_MASK(1) | EC_VER_MASK(2));
#ifdef CONFIG_HOSTCMD_FLASHPD
-static int hc_remote_flash(struct host_cmd_handler_args *args)
+static enum ec_status hc_remote_flash(struct host_cmd_handler_args *args)
{
const struct ec_params_usb_pd_fw_update *p = args->params;
int port = p->port;
@@ -5529,7 +5529,8 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_FW_UPDATE,
#endif /* CONFIG_HOSTCMD_FLASHPD */
#ifdef CONFIG_HOSTCMD_RWHASHPD
-static int hc_remote_rw_hash_entry(struct host_cmd_handler_args *args)
+static enum ec_status
+hc_remote_rw_hash_entry(struct host_cmd_handler_args *args)
{
int i, idx = 0, found = 0;
const struct ec_params_usb_pd_rw_hash_entry *p = args->params;
@@ -5560,7 +5561,7 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_RW_HASH_ENTRY,
EC_VER_MASK(0));
#endif /* CONFIG_HOSTCMD_RWHASHPD */
-static int hc_remote_pd_dev_info(struct host_cmd_handler_args *args)
+static enum ec_status hc_remote_pd_dev_info(struct host_cmd_handler_args *args)
{
const uint8_t *port = args->params;
struct ec_params_usb_pd_rw_hash_entry *r = args->response;
@@ -5586,7 +5587,7 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_DEV_INFO,
#ifndef CONFIG_USB_PD_TCPC
#ifdef CONFIG_EC_CMD_PD_CHIP_INFO
-static int hc_remote_pd_chip_info(struct host_cmd_handler_args *args)
+static enum ec_status hc_remote_pd_chip_info(struct host_cmd_handler_args *args)
{
const struct ec_params_pd_chip_info *p = args->params;
struct ec_response_pd_chip_info_v1 *info;
@@ -5616,7 +5617,7 @@ DECLARE_HOST_COMMAND(EC_CMD_PD_CHIP_INFO,
#endif
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int hc_remote_pd_set_amode(struct host_cmd_handler_args *args)
+static enum ec_status hc_remote_pd_set_amode(struct host_cmd_handler_args *args)
{
const struct ec_params_usb_pd_set_mode_request *p = args->params;
@@ -5652,7 +5653,7 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_SET_AMODE,
#ifdef CONFIG_CMD_PD_CONTROL
-static int pd_control(struct host_cmd_handler_args *args)
+static enum ec_status pd_control(struct host_cmd_handler_args *args)
{
static int pd_control_disabled[CONFIG_USB_PD_PORT_COUNT];
const struct ec_params_pd_control *cmd = args->params;
diff --git a/common/usb_port_power_dumb.c b/common/usb_port_power_dumb.c
index a005e19262..5cdf6005a6 100644
--- a/common/usb_port_power_dumb.c
+++ b/common/usb_port_power_dumb.c
@@ -69,7 +69,8 @@ int usb_charge_set_mode(int port_id, enum usb_charge_mode mode,
return EC_SUCCESS;
}
-static int usb_port_command_set_mode(struct host_cmd_handler_args *args)
+static enum ec_status
+usb_port_command_set_mode(struct host_cmd_handler_args *args)
{
const struct ec_params_usb_charge_set_mode *p = args->params;
diff --git a/common/usb_port_power_smart.c b/common/usb_port_power_smart.c
index 8668100518..ac3509b692 100644
--- a/common/usb_port_power_smart.c
+++ b/common/usb_port_power_smart.c
@@ -184,7 +184,8 @@ DECLARE_CONSOLE_COMMAND(usbchargemode, command_set_mode,
/*****************************************************************************/
/* Host commands */
-static int usb_charge_command_set_mode(struct host_cmd_handler_args *args)
+static enum ec_status
+usb_charge_command_set_mode(struct host_cmd_handler_args *args)
{
const struct ec_params_usb_charge_set_mode *p = args->params;
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c
index b2aa88902f..70c7a32eb7 100644
--- a/common/usbc/usb_pe_drp_sm.c
+++ b/common/usbc/usb_pe_drp_sm.c
@@ -4682,7 +4682,7 @@ DECLARE_CONSOLE_COMMAND(pe, command_pe,
"USB PE");
#endif /* CONFIG_CMD_USB_PD_PE */
-static int hc_remote_pd_discovery(struct host_cmd_handler_args *args)
+static enum ec_status hc_remote_pd_discovery(struct host_cmd_handler_args *args)
{
const uint8_t *port = args->params;
struct ec_params_usb_pd_discovery_entry *r = args->response;
@@ -4704,7 +4704,7 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_DISCOVERY,
hc_remote_pd_discovery,
EC_VER_MASK(0));
-static int hc_remote_pd_get_amode(struct host_cmd_handler_args *args)
+static enum ec_status hc_remote_pd_get_amode(struct host_cmd_handler_args *args)
{
struct svdm_amode_data *modep;
const struct ec_params_usb_pd_get_mode_request *p = args->params;
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index de9381742b..6db060a3a2 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -981,7 +981,7 @@ static void handle_new_power_state(int port)
* HOST COMMANDS
*/
#ifdef HAS_TASK_HOSTCMD
-static int hc_pd_ports(struct host_cmd_handler_args *args)
+static enum ec_status hc_pd_ports(struct host_cmd_handler_args *args)
{
struct ec_response_usb_pd_ports *r = args->response;
@@ -1011,7 +1011,7 @@ static const enum typec_mux typec_mux_map[USB_PD_CTRL_MUX_COUNT] = {
};
#endif
-static int hc_usb_pd_control(struct host_cmd_handler_args *args)
+static enum ec_status hc_usb_pd_control(struct host_cmd_handler_args *args)
{
const struct ec_params_usb_pd_control *p = args->params;
struct ec_response_usb_pd_control_v1 *r_v1 = args->response;
@@ -1083,7 +1083,7 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_CONTROL,
hc_usb_pd_control,
EC_VER_MASK(0) | EC_VER_MASK(1));
-static int hc_remote_flash(struct host_cmd_handler_args *args)
+static enum ec_status hc_remote_flash(struct host_cmd_handler_args *args)
{
const struct ec_params_usb_pd_fw_update *p = args->params;
int port = p->port;
@@ -1151,7 +1151,8 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_FW_UPDATE,
hc_remote_flash,
EC_VER_MASK(0));
-static int hc_remote_rw_hash_entry(struct host_cmd_handler_args *args)
+static enum ec_status
+hc_remote_rw_hash_entry(struct host_cmd_handler_args *args)
{
int i, idx = 0, found = 0;
const struct ec_params_usb_pd_rw_hash_entry *p = args->params;
@@ -1182,7 +1183,7 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_RW_HASH_ENTRY,
hc_remote_rw_hash_entry,
EC_VER_MASK(0));
-static int hc_remote_pd_dev_info(struct host_cmd_handler_args *args)
+static enum ec_status hc_remote_pd_dev_info(struct host_cmd_handler_args *args)
{
const uint8_t *port = args->params;
struct ec_params_usb_pd_rw_hash_entry *r = args->response;
@@ -1207,7 +1208,7 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_DEV_INFO,
#ifndef CONFIG_USB_PD_TCPC
#ifdef CONFIG_EC_CMD_PD_CHIP_INFO
-static int hc_remote_pd_chip_info(struct host_cmd_handler_args *args)
+static enum ec_status hc_remote_pd_chip_info(struct host_cmd_handler_args *args)
{
const struct ec_params_pd_chip_info *p = args->params;
struct ec_response_pd_chip_info_v1 *info;
@@ -1254,7 +1255,7 @@ void pd_notify_dp_alt_mode_entry(void)
#endif /* CONFIG_HOSTCMD_EVENTS */
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int hc_remote_pd_set_amode(struct host_cmd_handler_args *args)
+static enum ec_status hc_remote_pd_set_amode(struct host_cmd_handler_args *args)
{
const struct ec_params_usb_pd_set_mode_request *p = args->params;
diff --git a/common/vboot/vboot.c b/common/vboot/vboot.c
index 8a0e039aa2..fad338229f 100644
--- a/common/vboot/vboot.c
+++ b/common/vboot/vboot.c
@@ -113,7 +113,7 @@ static int verify_slot(enum system_image_copy_t slot)
return EC_SUCCESS;
}
-static int hc_verify_slot(struct host_cmd_handler_args *args)
+static enum ec_status hc_verify_slot(struct host_cmd_handler_args *args)
{
const struct ec_params_efs_verify *p = args->params;
enum system_image_copy_t slot;
diff --git a/common/vboot_hash.c b/common/vboot_hash.c
index 16e62003c6..4d12af7c7b 100644
--- a/common/vboot_hash.c
+++ b/common/vboot_hash.c
@@ -438,7 +438,8 @@ static int host_start_hash(const struct ec_params_vboot_hash *p)
return EC_RES_ERROR;
}
-static int host_command_vboot_hash(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_vboot_hash(struct host_cmd_handler_args *args)
{
const struct ec_params_vboot_hash *p = args->params;
struct ec_response_vboot_hash *r = args->response;
diff --git a/common/vstore.c b/common/vstore.c
index a2d81ba9a5..9b4636397c 100644
--- a/common/vstore.c
+++ b/common/vstore.c
@@ -38,7 +38,7 @@ BUILD_ASSERT(ARRAY_SIZE(vstore_slots) <= EC_VSTORE_SLOT_MAX);
/*
* vstore_info - Get slot count and mask of locked slots.
*/
-static int vstore_info(struct host_cmd_handler_args *args)
+static enum ec_status vstore_info(struct host_cmd_handler_args *args)
{
struct ec_response_vstore_info *r = args->response;
int i;
@@ -60,7 +60,7 @@ DECLARE_HOST_COMMAND(EC_CMD_VSTORE_INFO, vstore_info, EC_VER_MASK(0));
*
* Response is EC_VSTORE_SLOT_SIZE bytes of data.
*/
-static int vstore_read(struct host_cmd_handler_args *args)
+static enum ec_status vstore_read(struct host_cmd_handler_args *args)
{
const struct ec_params_vstore_read *p = args->params;
struct ec_response_vstore_read *r = args->response;
@@ -79,7 +79,7 @@ DECLARE_HOST_COMMAND(EC_CMD_VSTORE_READ, vstore_read, EC_VER_MASK(0));
/*
* vstore_write - Write temporary secure storage slot and lock it.
*/
-static int vstore_write(struct host_cmd_handler_args *args)
+static enum ec_status vstore_write(struct host_cmd_handler_args *args)
{
const struct ec_params_vstore_write *p = args->params;
struct vstore_slot *slot;
diff --git a/common/wireless.c b/common/wireless.c
index 4eb7b75d3b..d1f5cad645 100644
--- a/common/wireless.c
+++ b/common/wireless.c
@@ -110,7 +110,7 @@ void wireless_set_state(enum wireless_power_state state)
}
}
-static int wireless_enable_cmd(struct host_cmd_handler_args *args)
+static enum ec_status wireless_enable_cmd(struct host_cmd_handler_args *args)
{
const struct ec_params_switch_enable_wireless_v1 *p = args->params;
struct ec_response_switch_enable_wireless_v1 *r = args->response;
diff --git a/driver/battery/bq20z453.c b/driver/battery/bq20z453.c
index 1dab5d76e5..3cd16e8b8f 100644
--- a/driver/battery/bq20z453.c
+++ b/driver/battery/bq20z453.c
@@ -18,7 +18,7 @@ static void cutoff(void)
}
DECLARE_DEFERRED(cutoff);
-int battery_command_cut_off(struct host_cmd_handler_args *args)
+enum ec_status battery_command_cut_off(struct host_cmd_handler_args *args)
{
/*
* Queue battery cutoff. This must be deferred so we can send the
diff --git a/driver/battery/smart.c b/driver/battery/smart.c
index 50a29cfeff..89a99623af 100644
--- a/driver/battery/smart.c
+++ b/driver/battery/smart.c
@@ -498,7 +498,8 @@ DECLARE_CONSOLE_COMMAND(battmfgacc, command_batt_mfg_access_read,
/* Smart battery pass-through
*/
#ifdef CONFIG_I2C_PASSTHROUGH
-static int host_command_sb_read_word(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_sb_read_word(struct host_cmd_handler_args *args)
{
int rv;
int val;
@@ -520,7 +521,8 @@ DECLARE_HOST_COMMAND(EC_CMD_SB_READ_WORD,
host_command_sb_read_word,
EC_VER_MASK(0));
-static int host_command_sb_write_word(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_sb_write_word(struct host_cmd_handler_args *args)
{
int rv;
const struct ec_params_sb_wr_word *p = args->params;
@@ -537,7 +539,8 @@ DECLARE_HOST_COMMAND(EC_CMD_SB_WRITE_WORD,
host_command_sb_write_word,
EC_VER_MASK(0));
-static int host_command_sb_read_block(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_sb_read_block(struct host_cmd_handler_args *args)
{
int rv;
const struct ec_params_sb_rd *p = args->params;
@@ -560,7 +563,8 @@ DECLARE_HOST_COMMAND(EC_CMD_SB_READ_BLOCK,
host_command_sb_read_block,
EC_VER_MASK(0));
-static int host_command_sb_write_block(struct host_cmd_handler_args *args)
+static enum ec_status
+host_command_sb_write_block(struct host_cmd_handler_args *args)
{
/* Not implemented */
return EC_RES_INVALID_COMMAND;
diff --git a/driver/temp_sensor/tmp006.c b/driver/temp_sensor/tmp006.c
index 1b8f6eb746..e4794ccc4a 100644
--- a/driver/temp_sensor/tmp006.c
+++ b/driver/temp_sensor/tmp006.c
@@ -264,7 +264,7 @@ int tmp006_get_val(int idx, int *temp_ptr)
/*****************************************************************************/
/* Host commands */
-int tmp006_get_calibration(struct host_cmd_handler_args *args)
+enum ec_status tmp006_get_calibration(struct host_cmd_handler_args *args)
{
const struct ec_params_tmp006_get_calibration *p = args->params;
struct ec_response_tmp006_get_calibration_v1 *r1 = args->response;
@@ -299,7 +299,7 @@ DECLARE_HOST_COMMAND(EC_CMD_TMP006_GET_CALIBRATION,
tmp006_get_calibration,
EC_VER_MASK(1));
-int tmp006_set_calibration(struct host_cmd_handler_args *args)
+enum ec_status tmp006_set_calibration(struct host_cmd_handler_args *args)
{
const struct ec_params_tmp006_set_calibration_v1 *p1 = args->params;
struct tmp006_data_t *tdata;
@@ -333,7 +333,7 @@ DECLARE_HOST_COMMAND(EC_CMD_TMP006_SET_CALIBRATION,
tmp006_set_calibration,
EC_VER_MASK(1));
-int tmp006_get_raw(struct host_cmd_handler_args *args)
+enum ec_status tmp006_get_raw(struct host_cmd_handler_args *args)
{
const struct ec_params_tmp006_get_raw *p = args->params;
struct ec_response_tmp006_get_raw *r = args->response;
diff --git a/driver/usb_mux/usb_mux.c b/driver/usb_mux/usb_mux.c
index 43ebd9841a..122c206b98 100644
--- a/driver/usb_mux/usb_mux.c
+++ b/driver/usb_mux/usb_mux.c
@@ -227,7 +227,7 @@ DECLARE_CONSOLE_COMMAND(typec, command_typec,
"Control type-C connector muxing");
#endif
-static int hc_usb_pd_mux_info(struct host_cmd_handler_args *args)
+static enum ec_status hc_usb_pd_mux_info(struct host_cmd_handler_args *args)
{
const struct ec_params_usb_pd_mux_info *p = args->params;
struct ec_response_usb_pd_mux_info *r = args->response;
diff --git a/extra/lightbar/simulation.h b/extra/lightbar/simulation.h
index eebd5e1f65..eb878ed04e 100644
--- a/extra/lightbar/simulation.h
+++ b/extra/lightbar/simulation.h
@@ -107,7 +107,7 @@ uint8_t *system_get_jump_tag(uint16_t tag, int *version, int *size);
void fake_hook_##fn(void) { fn(); }
#define DECLARE_HOST_COMMAND(X, fn, Y) \
- int fake_hostcmd_##fn(struct host_cmd_handler_args *args) \
+ enum ec_status fake_hostcmd_##fn(struct host_cmd_handler_args *args) \
{ return fn(args); }
#define DECLARE_CONSOLE_COMMAND(X, fn, Y...) \
diff --git a/include/host_command.h b/include/host_command.h
index 3aa0d54d03..2be94cdb83 100644
--- a/include/host_command.h
+++ b/include/host_command.h
@@ -116,7 +116,7 @@ struct host_command {
* Handler for the command. Args points to context for handler.
* Returns result status (EC_RES_*).
*/
- int (*handler)(struct host_cmd_handler_args *args);
+ enum ec_status (*handler)(struct host_cmd_handler_args *args);
/* Command code */
int command;
/* Mask of supported versions */
@@ -265,7 +265,7 @@ void host_packet_receive(struct host_packet *pkt);
version_mask}
#else
#define DECLARE_HOST_COMMAND(command, routine, version_mask) \
- int (routine)(struct host_cmd_handler_args *args) \
+ enum ec_status (routine)(struct host_cmd_handler_args *args) \
__attribute__((unused))
#define DECLARE_PRIVATE_HOST_COMMAND(command, routine, version_mask) \
diff --git a/include/i2c.h b/include/i2c.h
index 0d9914f4d1..dd237e5354 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -428,7 +428,7 @@ int i2c_port_to_controller(int port);
* @param args: host command handler arguments
* @return EC_SUCCESS
*/
-int i2c_get_protocol_info(struct host_cmd_handler_args *args);
+enum ec_status i2c_get_protocol_info(struct host_cmd_handler_args *args);
/**
* Callbacks processing received data and response
diff --git a/include/motion_lid.h b/include/motion_lid.h
index 14221821e8..ed7fd4b741 100644
--- a/include/motion_lid.h
+++ b/include/motion_lid.h
@@ -30,7 +30,7 @@
*/
int motion_lid_get_angle(void);
-int host_cmd_motion_lid(struct host_cmd_handler_args *args);
+enum ec_status host_cmd_motion_lid(struct host_cmd_handler_args *args);
void motion_lid_calc(void);
diff --git a/include/uart.h b/include/uart.h
index 66561b09a7..a55c8fce2f 100644
--- a/include/uart.h
+++ b/include/uart.h
@@ -325,7 +325,7 @@ void uart_default_pad_rx_interrupt(enum gpio_signal signal);
*
* @return result status (EC_RES_*)
*/
-int uart_console_read_buffer_init(void);
+enum ec_status uart_console_read_buffer_init(void);
/**
* Read from uart buffer.
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;