summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-07-26 11:12:31 -0700
committerGerrit <chrome-bot@google.com>2012-07-26 16:25:34 -0700
commit247fdaf13d7d317465d6d04b015a309721e599a9 (patch)
tree6eef0fb1a07133135f0529a6e26635b99428b6ea
parentd0d50b6da7b826c0aa13391d6794b66e1c0f1303 (diff)
downloadchrome-ec-247fdaf13d7d317465d6d04b015a309721e599a9.tar.gz
Change host command params/response pointers to void *
This removes a bunch of unnecessary typecasts, since you can assign to/from void * without them. This also uncovered a few cases where const was being cast away for the input params; now fixed. BUG=none TEST=mkbp hash from u-boot console, and/or system boots ok Change-Id: Ic314b9d2ca06226ea8a09703ef5c1a912eb7146d Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/28500
-rw-r--r--chip/lm4/lpc.c13
-rw-r--r--chip/lm4/power_button.c3
-rw-r--r--chip/stm32/keyboard_scan.c3
-rw-r--r--common/charge_state.c3
-rw-r--r--common/flash_common.c24
-rw-r--r--common/gpio_commands.c11
-rw-r--r--common/host_command.c24
-rw-r--r--common/host_event_commands.c27
-rw-r--r--common/i2c_commands.c9
-rw-r--r--common/keyboard.c3
-rw-r--r--common/lightbar.c3
-rw-r--r--common/pstore_commands.c9
-rw-r--r--common/pwm_commands.c16
-rw-r--r--common/system_common.c9
-rw-r--r--common/temp_sensor_commands.c6
-rw-r--r--common/thermal_commands.c9
-rw-r--r--common/usb_charge_commands.c3
-rw-r--r--common/vboot.c6
-rw-r--r--common/vboot_hash.c6
-rw-r--r--common/x86_power.c4
-rw-r--r--include/host_command.h4
21 files changed, 69 insertions, 126 deletions
diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c
index 58bb1d4225..91ce43a198 100644
--- a/chip/lm4/lpc.c
+++ b/chip/lm4/lpc.c
@@ -141,7 +141,7 @@ static void lpc_send_response(struct host_cmd_handler_args *args)
size = 0;
}
- /* TODO(sjg@chromium.org): Really shold put flags in args too */
+ /* TODO(sjg@chromium.org): put flags in args? */
if (lpc_host_args->flags & EC_HOST_ARGS_FLAG_FROM_HOST) {
/* New-style response */
int csum;
@@ -151,19 +151,20 @@ static void lpc_send_response(struct host_cmd_handler_args *args)
(lpc_host_args->flags & ~EC_HOST_ARGS_FLAG_FROM_HOST) |
EC_HOST_ARGS_FLAG_TO_HOST;
- out = cmd_params;
- max_size = EC_HOST_PARAM_SIZE;
-
lpc_host_args->data_size = size;
csum = args->command + lpc_host_args->flags +
lpc_host_args->command_version +
lpc_host_args->data_size;
- for (i = 0; i < size; i++)
- csum += args->response[i];
+ for (i = 0, out = (uint8_t *)args->response; i < size;
+ i++, out++)
+ csum += *out;
lpc_host_args->checksum = (uint8_t)csum;
+
+ out = cmd_params;
+ max_size = EC_HOST_PARAM_SIZE;
} else {
/* Old-style response */
lpc_host_args->flags = 0;
diff --git a/chip/lm4/power_button.c b/chip/lm4/power_button.c
index 9d6185a869..1a7c462497 100644
--- a/chip/lm4/power_button.c
+++ b/chip/lm4/power_button.c
@@ -664,8 +664,7 @@ DECLARE_CONSOLE_COMMAND(mmapinfo, command_mmapinfo,
int switch_command_enable_backlight(struct host_cmd_handler_args *args)
{
- const struct ec_params_switch_enable_backlight *p =
- (const struct ec_params_switch_enable_backlight *)args->params;
+ const struct ec_params_switch_enable_backlight *p = args->params;
gpio_set_level(GPIO_ENABLE_BACKLIGHT, p->enabled);
return EC_RES_SUCCESS;
}
diff --git a/chip/stm32/keyboard_scan.c b/chip/stm32/keyboard_scan.c
index d25e9441fc..2df36fa9eb 100644
--- a/chip/stm32/keyboard_scan.c
+++ b/chip/stm32/keyboard_scan.c
@@ -440,8 +440,7 @@ DECLARE_HOST_COMMAND(EC_CMD_MKBP_STATE,
static int keyboard_get_info(struct host_cmd_handler_args *args)
{
- struct ec_response_mkbp_info *r =
- (struct ec_response_mkbp_info *)args->response;
+ struct ec_response_mkbp_info *r = args->response;
r->rows = 8;
r->cols = KB_OUTPUTS;
diff --git a/common/charge_state.c b/common/charge_state.c
index ad4ad419f7..ba666e965e 100644
--- a/common/charge_state.c
+++ b/common/charge_state.c
@@ -658,8 +658,7 @@ void charge_state_machine_task(void)
static int charge_command_force_idle(struct host_cmd_handler_args *args)
{
- const struct ec_params_force_idle *p =
- (const struct ec_params_force_idle *)args->params;
+ const struct ec_params_force_idle *p = args->params;
int rv;
if (system_is_locked())
diff --git a/common/flash_common.c b/common/flash_common.c
index fac124701a..b2cb5fbaf5 100644
--- a/common/flash_common.c
+++ b/common/flash_common.c
@@ -205,8 +205,7 @@ DECLARE_CONSOLE_COMMAND(flashwp, command_flash_wp,
static int flash_command_get_info(struct host_cmd_handler_args *args)
{
- struct ec_response_flash_info *r =
- (struct ec_response_flash_info *)args->response;
+ struct ec_response_flash_info *r = args->response;
r->flash_size = CONFIG_FLASH_SIZE;
r->write_block_size = CONFIG_FLASH_WRITE_SIZE;
@@ -221,8 +220,7 @@ DECLARE_HOST_COMMAND(EC_CMD_FLASH_INFO,
static int flash_command_read(struct host_cmd_handler_args *args)
{
- const struct ec_params_flash_read *p =
- (const struct ec_params_flash_read *)args->params;
+ const struct ec_params_flash_read *p = args->params;
if (flash_dataptr(p->offset, p->size, 1, (char **)&args->response) < 0)
return EC_RES_ERROR;
@@ -237,8 +235,7 @@ DECLARE_HOST_COMMAND(EC_CMD_FLASH_READ,
static int flash_command_write(struct host_cmd_handler_args *args)
{
- const struct ec_params_flash_write *p =
- (const struct ec_params_flash_write *)args->params;
+ const struct ec_params_flash_write *p = args->params;
if (p->size > sizeof(p->data))
return EC_RES_INVALID_PARAM;
@@ -257,8 +254,7 @@ DECLARE_HOST_COMMAND(EC_CMD_FLASH_WRITE,
static int flash_command_erase(struct host_cmd_handler_args *args)
{
- const struct ec_params_flash_erase *p =
- (const struct ec_params_flash_erase *)args->params;
+ const struct ec_params_flash_erase *p = args->params;
if (system_unsafe_to_overwrite(p->offset, p->size))
return EC_RES_ACCESS_DENIED;
@@ -274,10 +270,8 @@ DECLARE_HOST_COMMAND(EC_CMD_FLASH_ERASE,
static int flash_command_protect(struct host_cmd_handler_args *args)
{
- const struct ec_params_flash_protect *p =
- (const struct ec_params_flash_protect *)args->params;
- struct ec_response_flash_protect *r =
- (struct ec_response_flash_protect *)args->response;
+ const struct ec_params_flash_protect *p = args->params;
+ struct ec_response_flash_protect *r = args->response;
/*
* Handle requesting new flags. Note that we ignore the return code
@@ -335,10 +329,8 @@ DECLARE_HOST_COMMAND(EC_CMD_FLASH_PROTECT,
static int flash_command_region_info(struct host_cmd_handler_args *args)
{
- struct ec_params_flash_region_info *p =
- (struct ec_params_flash_region_info *)args->params;
- struct ec_response_flash_region_info *r =
- (struct ec_response_flash_region_info *)args->response;
+ const struct ec_params_flash_region_info *p = args->params;
+ struct ec_response_flash_region_info *r = args->response;
switch (p->region) {
case EC_FLASH_REGION_RO:
diff --git a/common/gpio_commands.c b/common/gpio_commands.c
index 67529dc86b..2768540115 100644
--- a/common/gpio_commands.c
+++ b/common/gpio_commands.c
@@ -128,10 +128,8 @@ DECLARE_CONSOLE_COMMAND(gpioset, command_gpio_set,
static int gpio_command_get(struct host_cmd_handler_args *args)
{
- struct ec_params_gpio_get *p =
- (struct ec_params_gpio_get *)args->params;
- struct ec_response_gpio_get *r =
- (struct ec_response_gpio_get *)args->response;
+ const struct ec_params_gpio_get *p = args->params;
+ struct ec_response_gpio_get *r = args->response;
int i;
if (system_is_locked())
@@ -150,10 +148,9 @@ DECLARE_HOST_COMMAND(EC_CMD_GPIO_GET, gpio_command_get, EC_VER_MASK(0));
static int gpio_command_set(struct host_cmd_handler_args *args)
{
- struct ec_params_gpio_set *p =
- (struct ec_params_gpio_set *)args->params;
- int i;
+ const struct ec_params_gpio_set *p = args->params;
const struct gpio_info *g;
+ int i;
if (system_is_locked())
return EC_RES_ACCESS_DENIED;
diff --git a/common/host_command.c b/common/host_command.c
index 212152efa1..515962d987 100644
--- a/common/host_command.c
+++ b/common/host_command.c
@@ -82,8 +82,7 @@ static const struct host_command *find_host_command(int command)
static int host_command_proto_version(struct host_cmd_handler_args *args)
{
- struct ec_response_proto_version *r =
- (struct ec_response_proto_version *)args->response;
+ struct ec_response_proto_version *r = args->response;
r->version = EC_PROTO_VERSION;
args->response_size = sizeof(*r);
@@ -96,10 +95,8 @@ DECLARE_HOST_COMMAND(EC_CMD_PROTO_VERSION,
static int host_command_hello(struct host_cmd_handler_args *args)
{
- const struct ec_params_hello *p =
- (const struct ec_params_hello *)args->params;
- struct ec_response_hello *r =
- (struct ec_response_hello *)args->response;
+ const struct ec_params_hello *p = args->params;
+ struct ec_response_hello *r = args->response;
uint32_t d = p->in_data;
r->out_data = d + 0x01020304;
@@ -113,10 +110,8 @@ DECLARE_HOST_COMMAND(EC_CMD_HELLO,
static int host_command_read_test(struct host_cmd_handler_args *args)
{
- const struct ec_params_read_test *p =
- (const struct ec_params_read_test *)args->params;
- struct ec_response_read_test *r =
- (struct ec_response_read_test *)args->response;
+ const struct ec_params_read_test *p = args->params;
+ struct ec_response_read_test *r = args->response;
int offset = p->offset;
int size = p->size / sizeof(uint32_t);
@@ -143,8 +138,7 @@ DECLARE_HOST_COMMAND(EC_CMD_READ_TEST,
*/
static int host_command_read_memmap(struct host_cmd_handler_args *args)
{
- const struct ec_params_read_memmap *p =
- (const struct ec_params_read_memmap *)args->params;
+ const struct ec_params_read_memmap *p = args->params;
/* Copy params out of data before we overwrite it with output */
uint8_t offset = p->offset;
@@ -166,10 +160,8 @@ DECLARE_HOST_COMMAND(EC_CMD_READ_MEMMAP,
static int host_command_get_cmd_versions(struct host_cmd_handler_args *args)
{
- const struct ec_params_get_cmd_versions *p =
- (const struct ec_params_get_cmd_versions *)args->params;
- struct ec_response_get_cmd_versions *r =
- (struct ec_response_get_cmd_versions *)args->response;
+ const struct ec_params_get_cmd_versions *p = args->params;
+ struct ec_response_get_cmd_versions *r = args->response;
const struct host_command *cmd = find_host_command(p->cmd);
diff --git a/common/host_event_commands.c b/common/host_event_commands.c
index 670212c430..1c13ee1377 100644
--- a/common/host_event_commands.c
+++ b/common/host_event_commands.c
@@ -138,8 +138,7 @@ DECLARE_CONSOLE_COMMAND(hostevent, command_host_event,
static int host_event_get_smi_mask(struct host_cmd_handler_args *args)
{
- struct ec_response_host_event_mask *r =
- (struct ec_response_host_event_mask *)args->response;
+ struct ec_response_host_event_mask *r = args->response;
r->mask = lpc_get_host_event_mask(LPC_HOST_EVENT_SMI);
args->response_size = sizeof(*r);
@@ -152,8 +151,7 @@ DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_GET_SMI_MASK,
static int host_event_get_sci_mask(struct host_cmd_handler_args *args)
{
- struct ec_response_host_event_mask *r =
- (struct ec_response_host_event_mask *)args->response;
+ struct ec_response_host_event_mask *r = args->response;
r->mask = lpc_get_host_event_mask(LPC_HOST_EVENT_SCI);
args->response_size = sizeof(*r);
@@ -166,8 +164,7 @@ DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_GET_SCI_MASK,
static int host_event_get_wake_mask(struct host_cmd_handler_args *args)
{
- struct ec_response_host_event_mask *r =
- (struct ec_response_host_event_mask *)args->response;
+ struct ec_response_host_event_mask *r = args->response;
r->mask = lpc_get_host_event_mask(LPC_HOST_EVENT_WAKE);
args->response_size = sizeof(*r);
@@ -180,8 +177,7 @@ DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_GET_WAKE_MASK,
static int host_event_set_smi_mask(struct host_cmd_handler_args *args)
{
- const struct ec_params_host_event_mask *p =
- (const struct ec_params_host_event_mask *)args->params;
+ const struct ec_params_host_event_mask *p = args->params;
lpc_set_host_event_mask(LPC_HOST_EVENT_SMI, p->mask);
return EC_RES_SUCCESS;
@@ -192,8 +188,7 @@ DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_SET_SMI_MASK,
static int host_event_set_sci_mask(struct host_cmd_handler_args *args)
{
- const struct ec_params_host_event_mask *p =
- (const struct ec_params_host_event_mask *)args->params;
+ const struct ec_params_host_event_mask *p = args->params;
lpc_set_host_event_mask(LPC_HOST_EVENT_SCI, p->mask);
return EC_RES_SUCCESS;
@@ -204,8 +199,7 @@ DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_SET_SCI_MASK,
static int host_event_set_wake_mask(struct host_cmd_handler_args *args)
{
- const struct ec_params_host_event_mask *p =
- (const struct ec_params_host_event_mask *)args->params;
+ const struct ec_params_host_event_mask *p = args->params;
lpc_set_host_event_mask(LPC_HOST_EVENT_WAKE, p->mask);
return EC_RES_SUCCESS;
@@ -218,8 +212,7 @@ DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_SET_WAKE_MASK,
static int host_event_get_b(struct host_cmd_handler_args *args)
{
- struct ec_response_host_event_mask *r =
- (struct ec_response_host_event_mask *)args->response;
+ struct ec_response_host_event_mask *r = args->response;
r->mask = events_copy_b;
args->response_size = sizeof(*r);
@@ -232,8 +225,7 @@ DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_GET_B,
static int host_event_clear(struct host_cmd_handler_args *args)
{
- const struct ec_params_host_event_mask *p =
- (const struct ec_params_host_event_mask *)args->params;
+ const struct ec_params_host_event_mask *p = args->params;
host_clear_events(p->mask);
return EC_RES_SUCCESS;
@@ -244,8 +236,7 @@ DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_CLEAR,
static int host_event_clear_b(struct host_cmd_handler_args *args)
{
- const struct ec_params_host_event_mask *p =
- (const struct ec_params_host_event_mask *)args->params;
+ const struct ec_params_host_event_mask *p = args->params;
host_clear_events_b(p->mask);
return EC_RES_SUCCESS;
diff --git a/common/i2c_commands.c b/common/i2c_commands.c
index 072df2f5b5..28779af945 100644
--- a/common/i2c_commands.c
+++ b/common/i2c_commands.c
@@ -11,10 +11,8 @@
int i2c_command_read(struct host_cmd_handler_args *args)
{
- const struct ec_params_i2c_read *p =
- (const struct ec_params_i2c_read *)args->params;
- struct ec_response_i2c_read *r =
- (struct ec_response_i2c_read *)args->response;
+ const struct ec_params_i2c_read *p = args->params;
+ struct ec_response_i2c_read *r = args->response;
int data, rv = -1;
if (system_is_locked())
@@ -36,8 +34,7 @@ DECLARE_HOST_COMMAND(EC_CMD_I2C_READ, i2c_command_read, EC_VER_MASK(0));
int i2c_command_write(struct host_cmd_handler_args *args)
{
- const struct ec_params_i2c_write *p =
- (const struct ec_params_i2c_write *)args->params;
+ const struct ec_params_i2c_write *p = args->params;
int rv = -1;
if (system_is_locked())
diff --git a/common/keyboard.c b/common/keyboard.c
index 76e2c4b2dd..49b9a01397 100644
--- a/common/keyboard.c
+++ b/common/keyboard.c
@@ -892,8 +892,7 @@ DECLARE_CONSOLE_COMMAND(kbd, command_keyboard,
static int mkbp_command_simulate_key(struct host_cmd_handler_args *args)
{
- const struct ec_params_mkbp_simulate_key *p =
- (const struct ec_params_mkbp_simulate_key *)args->params;
+ const struct ec_params_mkbp_simulate_key *p = args->params;
/* Only available on unlocked systems */
if (system_is_locked())
diff --git a/common/lightbar.c b/common/lightbar.c
index 9d2658ea7b..3b5f33279c 100644
--- a/common/lightbar.c
+++ b/common/lightbar.c
@@ -956,8 +956,7 @@ static void do_cmd_rgb(uint8_t led,
static int lpc_cmd_lightbar(struct host_cmd_handler_args *args)
{
- struct ec_params_lightbar_cmd *ptr =
- (struct ec_params_lightbar_cmd *)args->response;
+ struct ec_params_lightbar_cmd *ptr = args->response;
/*
* TODO: (crosbug.com/p/11277) Now that params and response are
diff --git a/common/pstore_commands.c b/common/pstore_commands.c
index 4b09c9bfcd..abc70ea8a8 100644
--- a/common/pstore_commands.c
+++ b/common/pstore_commands.c
@@ -12,8 +12,7 @@
int pstore_command_get_info(struct host_cmd_handler_args *args)
{
- struct ec_response_pstore_info *r =
- (struct ec_response_pstore_info *)args->response;
+ struct ec_response_pstore_info *r = args->response;
ASSERT(EEPROM_BLOCK_START_PSTORE + EEPROM_BLOCK_COUNT_PSTORE <=
eeprom_get_block_count());
@@ -29,8 +28,7 @@ DECLARE_HOST_COMMAND(EC_CMD_PSTORE_INFO,
int pstore_command_read(struct host_cmd_handler_args *args)
{
- const struct ec_params_pstore_read *p =
- (const struct ec_params_pstore_read *)args->params;
+ const struct ec_params_pstore_read *p = args->params;
char *dest = args->response;
int block_size = eeprom_get_block_size();
int block = p->offset / block_size + EEPROM_BLOCK_COUNT_PSTORE;
@@ -67,8 +65,7 @@ DECLARE_HOST_COMMAND(EC_CMD_PSTORE_READ,
int pstore_command_write(struct host_cmd_handler_args *args)
{
- const struct ec_params_pstore_write *p =
- (const struct ec_params_pstore_write *)args->params;
+ const struct ec_params_pstore_write *p = args->params;
const char *src = p->data;
int block_size = eeprom_get_block_size();
diff --git a/common/pwm_commands.c b/common/pwm_commands.c
index 0493bb9b5e..8cc4d8dc2d 100644
--- a/common/pwm_commands.c
+++ b/common/pwm_commands.c
@@ -12,8 +12,7 @@
int pwm_command_get_fan_target_rpm(struct host_cmd_handler_args *args)
{
- struct ec_response_pwm_get_fan_rpm *r =
- (struct ec_response_pwm_get_fan_rpm *)args->response;
+ struct ec_response_pwm_get_fan_rpm *r = args->response;
r->rpm = pwm_get_fan_target_rpm();
args->response_size = sizeof(*r);
@@ -26,8 +25,7 @@ DECLARE_HOST_COMMAND(EC_CMD_PWM_GET_FAN_TARGET_RPM,
int pwm_command_set_fan_target_rpm(struct host_cmd_handler_args *args)
{
- const struct ec_params_pwm_set_fan_target_rpm *p =
- (const struct ec_params_pwm_set_fan_target_rpm *)args->params;
+ const struct ec_params_pwm_set_fan_target_rpm *p = args->params;
#ifdef CONFIG_TASK_THERMAL
thermal_toggle_auto_fan_ctrl(0);
@@ -42,8 +40,7 @@ DECLARE_HOST_COMMAND(EC_CMD_PWM_SET_FAN_TARGET_RPM,
int pwm_command_fan_duty(struct host_cmd_handler_args *args)
{
- const struct ec_params_pwm_set_fan_duty *p =
- (const struct ec_params_pwm_set_fan_duty *)args->params;
+ const struct ec_params_pwm_set_fan_duty *p = args->params;
pwm_set_fan_duty(p->percent);
return EC_RES_SUCCESS;
@@ -54,8 +51,7 @@ DECLARE_HOST_COMMAND(EC_CMD_PWM_SET_FAN_DUTY,
int pwm_command_get_keyboard_backlight(struct host_cmd_handler_args *args)
{
- struct ec_response_pwm_get_keyboard_backlight *r =
- (struct ec_response_pwm_get_keyboard_backlight *)args->response;
+ struct ec_response_pwm_get_keyboard_backlight *r = args->response;
r->percent = pwm_get_keyboard_backlight();
r->enabled = pwm_get_keyboard_backlight_enabled();
@@ -69,9 +65,7 @@ DECLARE_HOST_COMMAND(EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT,
int pwm_command_set_keyboard_backlight(struct host_cmd_handler_args *args)
{
- const struct ec_params_pwm_set_keyboard_backlight *p =
- (const struct ec_params_pwm_set_keyboard_backlight *)
- args->params;
+ const struct ec_params_pwm_set_keyboard_backlight *p = args->params;
pwm_set_keyboard_backlight(p->percent);
diff --git a/common/system_common.c b/common/system_common.c
index 2fd978d6cd..c9c6384975 100644
--- a/common/system_common.c
+++ b/common/system_common.c
@@ -733,8 +733,7 @@ DECLARE_CONSOLE_COMMAND(syslock, command_system_lock,
static int host_command_get_version(struct host_cmd_handler_args *args)
{
- struct ec_response_get_version *r =
- (struct ec_response_get_version *)args->response;
+ struct ec_response_get_version *r = args->response;
strzcpy(r->version_string_ro, system_get_version(SYSTEM_IMAGE_RO),
sizeof(r->version_string_ro));
@@ -776,8 +775,7 @@ DECLARE_HOST_COMMAND(EC_CMD_GET_BUILD_INFO,
static int host_command_get_chip_info(struct host_cmd_handler_args *args)
{
- struct ec_response_get_chip_info *r =
- (struct ec_response_get_chip_info *)args->response;
+ struct ec_response_get_chip_info *r = args->response;
strzcpy(r->vendor, system_get_chip_vendor(), sizeof(r->vendor));
strzcpy(r->name, system_get_chip_name(), sizeof(r->name));
@@ -793,8 +791,7 @@ DECLARE_HOST_COMMAND(EC_CMD_GET_CHIP_INFO,
int host_command_get_board_version(struct host_cmd_handler_args *args)
{
- struct ec_response_board_version *r =
- (struct ec_response_board_version *)args->response;
+ struct ec_response_board_version *r = args->response;
r->board_version = (uint16_t) system_get_board_version();
diff --git a/common/temp_sensor_commands.c b/common/temp_sensor_commands.c
index 43b92385c7..987efa8505 100644
--- a/common/temp_sensor_commands.c
+++ b/common/temp_sensor_commands.c
@@ -18,10 +18,8 @@ extern const struct temp_sensor_t temp_sensors[TEMP_SENSOR_COUNT];
int temp_sensor_command_get_info(struct host_cmd_handler_args *args)
{
- const struct ec_params_temp_sensor_get_info *p =
- (const struct ec_params_temp_sensor_get_info *)args->params;
- struct ec_response_temp_sensor_get_info *r =
- (struct ec_response_temp_sensor_get_info *)args->response;
+ const struct ec_params_temp_sensor_get_info *p = args->params;
+ struct ec_response_temp_sensor_get_info *r = args->response;
int id = p->id;
if (id >= TEMP_SENSOR_COUNT)
diff --git a/common/thermal_commands.c b/common/thermal_commands.c
index 5e6e024f89..4638b60ac3 100644
--- a/common/thermal_commands.c
+++ b/common/thermal_commands.c
@@ -11,8 +11,7 @@
int thermal_command_set_threshold(struct host_cmd_handler_args *args)
{
- const struct ec_params_thermal_set_threshold *p =
- (const struct ec_params_thermal_set_threshold *)args->params;
+ const struct ec_params_thermal_set_threshold *p = args->params;
if (thermal_set_threshold(p->sensor_type, p->threshold_id, p->value))
return EC_RES_ERROR;
@@ -25,10 +24,8 @@ DECLARE_HOST_COMMAND(EC_CMD_THERMAL_SET_THRESHOLD,
int thermal_command_get_threshold(struct host_cmd_handler_args *args)
{
- const struct ec_params_thermal_get_threshold *p =
- (const struct ec_params_thermal_get_threshold *)args->params;
- struct ec_response_thermal_get_threshold *r =
- (struct ec_response_thermal_get_threshold *)args->response;
+ const struct ec_params_thermal_get_threshold *p = args->params;
+ struct ec_response_thermal_get_threshold *r = args->response;
int value = thermal_get_threshold(p->sensor_type, p->threshold_id);
if (value == -1)
diff --git a/common/usb_charge_commands.c b/common/usb_charge_commands.c
index 7be591f2d2..af22b12366 100644
--- a/common/usb_charge_commands.c
+++ b/common/usb_charge_commands.c
@@ -17,8 +17,7 @@
static int usb_charge_command_set_mode(struct host_cmd_handler_args *args)
{
- const struct ec_params_usb_charge_set_mode *p =
- (const struct ec_params_usb_charge_set_mode *)args->params;
+ const struct ec_params_usb_charge_set_mode *p = args->params;
int rv;
CPRINTF("[Setting USB port %d to mode %d]\n",
diff --git a/common/vboot.c b/common/vboot.c
index 08fdef8930..3d3518a942 100644
--- a/common/vboot.c
+++ b/common/vboot.c
@@ -20,10 +20,8 @@
static int host_cmd_vboot(struct host_cmd_handler_args *args)
{
- const struct ec_params_vboot_cmd *p =
- (const struct ec_params_vboot_cmd *)args->params;
- struct ec_params_vboot_cmd *r =
- (struct ec_params_vboot_cmd *)args->response;
+ const struct ec_params_vboot_cmd *p = args->params;
+ struct ec_params_vboot_cmd *r = args->response;
uint8_t v;
switch (p->in.cmd) {
diff --git a/common/vboot_hash.c b/common/vboot_hash.c
index 49e3e4797b..6f944622da 100644
--- a/common/vboot_hash.c
+++ b/common/vboot_hash.c
@@ -261,10 +261,8 @@ static void fill_response(struct ec_response_vboot_hash *r)
static int host_command_vboot_hash(struct host_cmd_handler_args *args)
{
- const struct ec_params_vboot_hash *p =
- (const struct ec_params_vboot_hash *)args->params;
- struct ec_response_vboot_hash *r =
- (struct ec_response_vboot_hash *)args->response;
+ const struct ec_params_vboot_hash *p = args->params;
+ struct ec_response_vboot_hash *r = args->response;
int rv;
switch (p->cmd) {
diff --git a/common/x86_power.c b/common/x86_power.c
index 1838643def..eb127c55ad 100644
--- a/common/x86_power.c
+++ b/common/x86_power.c
@@ -678,10 +678,10 @@ DECLARE_CONSOLE_COMMAND(x86shutdown, command_x86shutdown,
/*****************************************************************************/
/* Host commands */
+/* TODO: belongs in power_button.c since it owns switches? */
static int switch_command_enable_wireless(struct host_cmd_handler_args *args)
{
- const struct ec_params_switch_enable_wireless *p =
- (const struct ec_params_switch_enable_wireless *)args->params;
+ const struct ec_params_switch_enable_wireless *p = args->params;
gpio_set_level(GPIO_RADIO_ENABLE_WLAN,
p->enabled & EC_WIRELESS_SWITCH_WLAN);
diff --git a/include/host_command.h b/include/host_command.h
index 135f493737..5313277cab 100644
--- a/include/host_command.h
+++ b/include/host_command.h
@@ -23,14 +23,14 @@ struct host_cmd_handler_args {
uint8_t version; /* Version of command (0-31) */
uint8_t params_size; /* Size of input parameters in bytes */
uint8_t i2c_old_response; /* (for I2C) send an old-style response */
- const uint8_t *params; /* Input parameters */
+ const void *params; /* Input parameters */
/*
* Pointer to output response data buffer. On input to the handler,
* points to a buffer of size response_max. Command handler can change
* this to point to a different location instead of memcpy()'ing data
* into the provided buffer.
*/
- uint8_t *response;
+ void *response;
/*
* Maximum size of response buffer provided to command handler. If the
* handler changes response to point to its own larger buffer, it may