summaryrefslogtreecommitdiff
path: root/include
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 /include
parent4e692f29e3e5af6b85df472e4c4f936c6f461cb9 (diff)
downloadchrome-ec-83d793839479a6f3414dbf51c00536aff65618f3.tar.gz
host_command: Change host command return value to enum ec_status
If the host command handler callback function returns an int, it's easy to accidentally mix up the enum ec_error_list and enum ec_status types. The host commands always expect an enum ec_status type, so we change the return value to be of that explicit type. Compilation will then fail if you accidentally try to return an enum ec_error_list value. Ran the following commands and then manually fixed up a few remaining instances that were not caught: git grep --name-only 'static int .*(struct host_cmd_handler_args \*args)' |\ xargs sed -i 's#static int \(.*\)(struct host_cmd_handler_args \*args)#\ static enum ec_status \1(struct host_cmd_handler_args \*args)##' git grep --name-only 'int .*(struct host_cmd_handler_args \*args)' |\ xargs sed -i 's#int \(.*\)(struct host_cmd_handler_args \*args)#\ enum ec_status \1(struct host_cmd_handler_args \*args)##' BRANCH=none BUG=chromium:1004831 TEST=make buildall -j Cq-Depend: chrome-internal:1872675 Change-Id: Id93df9387ac53d016a1594dba86c6642babbfd1e Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1816865 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'include')
-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
4 files changed, 5 insertions, 5 deletions
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.