summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-10-23 14:12:25 -0700
committerGerrit <chrome-bot@google.com>2012-10-23 16:49:29 -0700
commite72788ef96e83ef9d6ac0b2593c7edd8139c9376 (patch)
tree8eab899042c277b835310e9c35d9ee8180b14837
parent7cd4d4391d3abbd2272bf9b7459677a4fa99cd0c (diff)
downloadchrome-ec-e72788ef96e83ef9d6ac0b2593c7edd8139c9376.tar.gz
Hook functions no longer return values
Previously, all hook functions returned EC_SUCCESS, which was meaningless because nothing ever looked at the return value. Changing the return value to void saves ~100 bytes of code size and an equal amount of source code size. BUG=none BRANCH=none TEST=code still builds; link still boots Change-Id: I2a636339894e5a804831244967a9c9d134df7d13 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36372
-rw-r--r--board/snow/board.c11
-rw-r--r--board/spring/board.c8
-rw-r--r--chip/lm4/adc.c4
-rw-r--r--chip/lm4/chip_temp_sensor.c14
-rw-r--r--chip/lm4/clock.c9
-rw-r--r--chip/lm4/gpio.c6
-rw-r--r--chip/lm4/hwtimer.c4
-rw-r--r--chip/lm4/i2c.c14
-rw-r--r--chip/lm4/lpc.c18
-rw-r--r--chip/lm4/onewire.c7
-rw-r--r--chip/lm4/peci.c11
-rw-r--r--chip/lm4/power_button.c11
-rw-r--r--chip/lm4/pwm.c17
-rw-r--r--chip/lm4/watchdog.c6
-rw-r--r--chip/stm32/adc.c6
-rw-r--r--chip/stm32/flash-stm32f100.c3
-rw-r--r--chip/stm32/gpio-stm32f100.c8
-rw-r--r--chip/stm32/gpio-stm32l15x.c8
-rw-r--r--chip/stm32/i2c.c6
-rw-r--r--common/charge_state.c3
-rw-r--r--common/gaia_power.c10
-rw-r--r--common/hooks.c21
-rw-r--r--common/ir357x.c6
-rw-r--r--common/keyboard.c16
-rw-r--r--common/lightbar.c16
-rw-r--r--common/main.c2
-rw-r--r--common/pmu_tps65090.c21
-rw-r--r--common/pmu_tps65090_charger.c5
-rw-r--r--common/system_common.c9
-rw-r--r--common/thermal.c3
-rw-r--r--common/tmp006.c10
-rw-r--r--common/usb_charge.c15
-rw-r--r--common/x86_power.c29
-rw-r--r--core/cortex-m/timer.c6
-rw-r--r--include/hooks.h34
35 files changed, 134 insertions, 243 deletions
diff --git a/board/snow/board.c b/board/snow/board.c
index c1423c316e..cf5ac61ab4 100644
--- a/board/snow/board.c
+++ b/board/snow/board.c
@@ -4,7 +4,6 @@
*/
/* Snow board-specific configuration */
-#include "board.h"
#include "chipset.h"
#include "common.h"
#include "console.h"
@@ -240,7 +239,7 @@ enum {
*/
static char i2c_claimed_by_ec;
-static int board_pre_init_hook(void)
+static void board_pre_init_hook(void)
{
#ifdef CONFIG_ARBITRATE_I2C
gpio_set_flags(GPIO_AP_CLAIM, GPIO_PULL_UP);
@@ -248,18 +247,16 @@ static int board_pre_init_hook(void)
gpio_set_flags(GPIO_EC_CLAIM, GPIO_OUTPUT);
usleep(BUS_SLEW_DELAY_US);
#endif
- return 0;
}
DECLARE_HOOK(HOOK_CHIPSET_PRE_INIT, board_pre_init_hook, HOOK_PRIO_DEFAULT);
-static int board_startup_hook(void)
+static void board_startup_hook(void)
{
gpio_set_flags(GPIO_SUSPEND_L, INT_BOTH_PULL_UP);
- return 0;
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_startup_hook, HOOK_PRIO_DEFAULT);
-static int board_shutdown_hook(void)
+static void board_shutdown_hook(void)
{
/* Disable pull-up on SUSPEND_L during shutdown to prevent leakage */
gpio_set_flags(GPIO_SUSPEND_L, INT_BOTH_FLOATING);
@@ -268,11 +265,9 @@ static int board_shutdown_hook(void)
gpio_set_flags(GPIO_AP_CLAIM, GPIO_INPUT);
gpio_set_flags(GPIO_EC_CLAIM, GPIO_INPUT);
#endif
- return 0;
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_shutdown_hook, HOOK_PRIO_DEFAULT);
-
#ifdef CONFIG_ARBITRATE_I2C
int board_i2c_claim(int port)
diff --git a/board/spring/board.c b/board/spring/board.c
index c19a61de08..5542f2354f 100644
--- a/board/spring/board.c
+++ b/board/spring/board.c
@@ -5,7 +5,6 @@
/* Spring board-specific configuration */
#include "adc.h"
-#include "board.h"
#include "chipset.h"
#include "common.h"
#include "console.h"
@@ -181,7 +180,7 @@ void board_keyboard_suppress_noise(void)
gpio_set_level(GPIO_CODEC_INT, 1);
}
-static int board_startup_hook(void)
+static void board_startup_hook(void)
{
gpio_set_flags(GPIO_SUSPEND_L, INT_BOTH_PULL_UP);
@@ -190,12 +189,11 @@ static int board_startup_hook(void)
pmu_enable_fet(FET_LCD_PANEL, 1, NULL);
/* Enable backlight power */
pmu_enable_fet(FET_BACKLIGHT, 1, NULL);
- return 0;
#endif /* CONFIG_PMU_FORCE_FET */
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_startup_hook, HOOK_PRIO_DEFAULT);
-static int board_shutdown_hook(void)
+static void board_shutdown_hook(void)
{
#ifdef CONFIG_PMU_FORCE_FET
/* Power off backlight power */
@@ -206,8 +204,6 @@ static int board_shutdown_hook(void)
/* Disable pull-up on SUSPEND_L during shutdown to prevent leakage */
gpio_set_flags(GPIO_SUSPEND_L, INT_BOTH_FLOATING);
-
- return 0;
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_shutdown_hook, HOOK_PRIO_DEFAULT);
diff --git a/chip/lm4/adc.c b/chip/lm4/adc.c
index 57604d1204..254b0903af 100644
--- a/chip/lm4/adc.c
+++ b/chip/lm4/adc.c
@@ -205,7 +205,7 @@ DECLARE_CONSOLE_COMMAND(adc, command_adc,
/*****************************************************************************/
/* Initialization */
-static int adc_init(void)
+static void adc_init(void)
{
int i;
const struct adc_t *adc;
@@ -252,7 +252,5 @@ static int adc_init(void)
adc = adc_channels + i;
lm4_adc_configure(adc->sequencer, adc->channel, adc->flag);
}
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_INIT, adc_init, HOOK_PRIO_DEFAULT);
diff --git a/chip/lm4/chip_temp_sensor.c b/chip/lm4/chip_temp_sensor.c
index 54e8a3c6ea..077806ba73 100644
--- a/chip/lm4/chip_temp_sensor.c
+++ b/chip/lm4/chip_temp_sensor.c
@@ -6,12 +6,12 @@
/* Temperature sensor module for Chrome EC */
#include "adc.h"
-#include "config.h"
-#include "hooks.h"
+#include "common.h"
#include "lm4_adc.h"
#include "temp_sensor.h"
-static int last_val;
+/* Initialize temperature reading to a sane value (27 C) */
+static int last_val = 300;
int chip_temp_sensor_poll(void)
{
@@ -29,11 +29,3 @@ int chip_temp_sensor_get_val(int idx, int *temp_ptr)
return EC_SUCCESS;
}
-
-static int chip_temp_sensor_init(void)
-{
- /* Initialize temperature reading to a sane value. */
- last_val = 300; /* 27 C */
- return EC_SUCCESS;
-}
-DECLARE_HOOK(HOOK_INIT, chip_temp_sensor_init, HOOK_PRIO_DEFAULT);
diff --git a/chip/lm4/clock.c b/chip/lm4/clock.c
index 65dc62d069..c23dc68b29 100644
--- a/chip/lm4/clock.c
+++ b/chip/lm4/clock.c
@@ -63,7 +63,6 @@ static void enable_pll(void)
freq = PLL_CLOCK;
}
-
int clock_enable_pll(int enable, int notify)
{
if (enable)
@@ -72,9 +71,11 @@ int clock_enable_pll(int enable, int notify)
disable_pll();
/* Notify modules of frequency change */
- return notify ? hook_notify(HOOK_FREQ_CHANGE, 0) : EC_SUCCESS;
-}
+ if (notify)
+ hook_notify(HOOK_FREQ_CHANGE);
+ return EC_SUCCESS;
+}
void clock_wait_cycles(uint32_t cycles)
{
@@ -230,7 +231,7 @@ static int command_pll(int argc, char **argv)
freq = INTERNAL_CLOCK / div;
/* Notify modules of frequency change */
- hook_notify(HOOK_FREQ_CHANGE, 0);
+ hook_notify(HOOK_FREQ_CHANGE);
}
}
diff --git a/chip/lm4/gpio.c b/chip/lm4/gpio.c
index f5eca38a79..23cedd52c3 100644
--- a/chip/lm4/gpio.c
+++ b/chip/lm4/gpio.c
@@ -88,8 +88,7 @@ int gpio_pre_init(void)
return EC_SUCCESS;
}
-
-static int gpio_init(void)
+static void gpio_init(void)
{
/* Enable IRQs now that pins are set up */
task_enable_irq(LM4_IRQ_GPIOA);
@@ -109,12 +108,9 @@ static int gpio_init(void)
#endif
task_enable_irq(LM4_IRQ_GPIOP);
task_enable_irq(LM4_IRQ_GPIOQ);
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_INIT, gpio_init, HOOK_PRIO_DEFAULT);
-
void gpio_set_alternate_function(int port, int mask, int func)
{
int port_index = find_gpio_port_index(port);
diff --git a/chip/lm4/hwtimer.c b/chip/lm4/hwtimer.c
index 9c23cbf961..45166f2194 100644
--- a/chip/lm4/hwtimer.c
+++ b/chip/lm4/hwtimer.c
@@ -64,13 +64,11 @@ static void __hw_clock_source_irq(void)
DECLARE_IRQ(LM4_IRQ_TIMERW0A, __hw_clock_source_irq, 1);
-static int update_prescaler(void)
+static void update_prescaler(void)
{
/* Set the prescaler to increment every microsecond. This takes
* effect immediately, because the TAILD bit in TAMR is clear. */
LM4_TIMER_TAPR(6) = clock_get_freq() / US_PER_SECOND;
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_FREQ_CHANGE, update_prescaler, HOOK_PRIO_DEFAULT);
diff --git a/chip/lm4/i2c.c b/chip/lm4/i2c.c
index 94ae391712..de04bcf727 100644
--- a/chip/lm4/i2c.c
+++ b/chip/lm4/i2c.c
@@ -5,15 +5,15 @@
/* I2C port module for Chrome EC */
-#include "board.h"
#include "clock.h"
+#include "common.h"
#include "console.h"
#include "gpio.h"
#include "hooks.h"
#include "i2c.h"
+#include "registers.h"
#include "task.h"
#include "timer.h"
-#include "registers.h"
#include "util.h"
#define CPUTS(outstr) cputs(CC_I2C, outstr)
@@ -279,8 +279,7 @@ exit:
return rv;
}
-
-static int i2c_freq_changed(void)
+static void i2c_freq_changed(void)
{
int freq = clock_get_freq();
int i;
@@ -308,8 +307,6 @@ static int i2c_freq_changed(void)
LM4_I2C_MTPR(i2c_ports[i].port) = tpr;
}
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_FREQ_CHANGE, i2c_freq_changed, HOOK_PRIO_DEFAULT + 1);
@@ -475,8 +472,7 @@ static void configure_gpio(void)
#endif
}
-
-static int i2c_init(void)
+static void i2c_init(void)
{
volatile uint32_t scratch __attribute__((unused));
uint32_t mask = 0;
@@ -510,7 +506,5 @@ static int i2c_init(void)
task_enable_irq(LM4_IRQ_I2C3);
task_enable_irq(LM4_IRQ_I2C4);
task_enable_irq(LM4_IRQ_I2C5);
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_INIT, i2c_init, HOOK_PRIO_DEFAULT);
diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c
index c22b967661..d34793cc80 100644
--- a/chip/lm4/lpc.c
+++ b/chip/lm4/lpc.c
@@ -607,13 +607,13 @@ static void lpc_interrupt(void)
DECLARE_IRQ(LM4_IRQ_LPC, lpc_interrupt, 2);
-/* Preserve event masks across a sysjump */
-static int lpc_sysjump(void)
+/**
+ * Preserve event masks across a sysjump.
+ */
+static void lpc_sysjump(void)
{
system_add_jump_tag(LPC_SYSJUMP_TAG, 1,
sizeof(event_mask), event_mask);
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_SYSJUMP, lpc_sysjump, HOOK_PRIO_DEFAULT);
@@ -632,8 +632,7 @@ static void lpc_post_sysjump(void)
memcpy(event_mask, prev_mask, sizeof(event_mask));
}
-
-static int lpc_init(void)
+static void lpc_init(void)
{
volatile uint32_t scratch __attribute__((unused));
@@ -784,8 +783,6 @@ static int lpc_init(void)
/* Update host events now that we can copy them to memmap */
update_host_event_status();
-
- return EC_SUCCESS;
}
/*
* Set prio to higher than default so other inits can initialize their
@@ -793,8 +790,7 @@ static int lpc_init(void)
*/
DECLARE_HOOK(HOOK_INIT, lpc_init, HOOK_PRIO_INIT_LPC);
-
-static int lpc_resume(void)
+static void lpc_resume(void)
{
/* Mask all host events until the host unmasks them itself. */
lpc_set_host_event_mask(LPC_HOST_EVENT_SMI, 0);
@@ -803,8 +799,6 @@ static int lpc_resume(void)
/* Store port 80 event so we know where resume happened */
port_80_write(PORT_80_EVENT_RESUME);
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, lpc_resume, HOOK_PRIO_DEFAULT);
diff --git a/chip/lm4/onewire.c b/chip/lm4/onewire.c
index d505ff5c08..08fa66a372 100644
--- a/chip/lm4/onewire.c
+++ b/chip/lm4/onewire.c
@@ -5,7 +5,7 @@
/* 1-wire interface module for Chrome EC */
-#include "board.h"
+#include "common.h"
#include "gpio.h"
#include "hooks.h"
#include "registers.h"
@@ -131,12 +131,9 @@ static void configure_gpio(void)
LM4_GPIO_ODR(LM4_GPIO_H) |= ONEWIRE_PIN;
}
-
-static int onewire_init(void)
+static void onewire_init(void)
{
/* Configure GPIOs */
configure_gpio();
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_INIT, onewire_init, HOOK_PRIO_DEFAULT);
diff --git a/chip/lm4/peci.c b/chip/lm4/peci.c
index ddbb1a9a6c..ff56f7ec47 100644
--- a/chip/lm4/peci.c
+++ b/chip/lm4/peci.c
@@ -7,7 +7,7 @@
#include "chipset.h"
#include "clock.h"
-#include "config.h"
+#include "common.h"
#include "console.h"
#include "gpio.h"
#include "hooks.h"
@@ -93,8 +93,7 @@ int peci_temp_sensor_get_val(int idx, int *temp_ptr)
return EC_SUCCESS;
}
-
-static int peci_freq_changed(void)
+static void peci_freq_changed(void)
{
int freq = clock_get_freq();
int baud;
@@ -115,8 +114,6 @@ static int peci_freq_changed(void)
LM4_PECI_CTL = ((PECI_TJMAX + 273) << 22) | 0x0001 |
(PECI_RETRY_COUNT << 12) |
(PECI_ERROR_BYPASS << 11);
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_FREQ_CHANGE, peci_freq_changed, HOOK_PRIO_DEFAULT - 1);
@@ -141,7 +138,7 @@ DECLARE_CONSOLE_COMMAND(pecitemp, command_peci_temp,
/*****************************************************************************/
/* Initialization */
-static int peci_init(void)
+static void peci_init(void)
{
volatile uint32_t scratch __attribute__((unused));
int i;
@@ -159,7 +156,5 @@ static int peci_init(void)
/* Initialize temperature reading buffer to a sane value. */
for (i = 0; i < TEMP_AVG_LENGTH; ++i)
temp_vals[i] = 300; /* 27 C */
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_INIT, peci_init, HOOK_PRIO_DEFAULT);
diff --git a/chip/lm4/power_button.c b/chip/lm4/power_button.c
index a928f4895b..12e02e96b5 100644
--- a/chip/lm4/power_button.c
+++ b/chip/lm4/power_button.c
@@ -216,7 +216,7 @@ static void lid_switch_open(uint64_t tnow)
CPRINTF("[%T PB lid open]\n");
debounced_lid_open = 1;
*memmap_switches |= EC_SWITCH_LID_OPEN;
- hook_notify(HOOK_LID_CHANGE, 0);
+ hook_notify(HOOK_LID_CHANGE);
update_backlight();
host_set_single_event(EC_HOST_EVENT_LID_OPEN);
@@ -242,7 +242,7 @@ static void lid_switch_close(uint64_t tnow)
CPRINTF("[%T PB lid close]\n");
debounced_lid_open = 0;
*memmap_switches &= ~EC_SWITCH_LID_OPEN;
- hook_notify(HOOK_LID_CHANGE, 0);
+ hook_notify(HOOK_LID_CHANGE);
update_backlight();
host_set_single_event(EC_HOST_EVENT_LID_CLOSED);
}
@@ -462,7 +462,7 @@ void power_button_task(void)
/* Handle AC state changes */
if (ac_changed) {
ac_changed = 0;
- hook_notify(HOOK_AC_CHANGE, 0);
+ hook_notify(HOOK_AC_CHANGE);
}
/* Handle debounce timeouts for power button and lid switch */
@@ -522,7 +522,7 @@ void power_button_task(void)
/*****************************************************************************/
/* Hooks */
-static int power_button_init(void)
+static void power_button_init(void)
{
/* Set up memory-mapped switch positions */
memmap_switches = host_get_memmap(EC_MEMMAP_SWITCHES);
@@ -545,12 +545,9 @@ static int power_button_init(void)
gpio_enable_interrupt(GPIO_POWER_BUTTONn);
gpio_enable_interrupt(GPIO_RECOVERYn);
gpio_enable_interrupt(GPIO_WRITE_PROTECT);
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_INIT, power_button_init, HOOK_PRIO_DEFAULT);
-
void power_button_interrupt(enum gpio_signal signal)
{
/* Reset debounce time for the changed signal */
diff --git a/chip/lm4/pwm.c b/chip/lm4/pwm.c
index c3c8be73a4..1ed448b74e 100644
--- a/chip/lm4/pwm.c
+++ b/chip/lm4/pwm.c
@@ -308,7 +308,7 @@ DECLARE_CONSOLE_COMMAND(kblight, command_kblight,
/*****************************************************************************/
/* Initialization */
-static int pwm_init(void)
+static void pwm_init(void)
{
volatile uint32_t scratch __attribute__((unused));
const struct pwm_state *prev;
@@ -378,12 +378,10 @@ static int pwm_init(void)
mapped = (uint16_t *)host_get_memmap(EC_MEMMAP_FAN);
for (i = 0; i < EC_FAN_SPEED_ENTRIES; i++)
mapped[i] = EC_FAN_SPEED_NOT_PRESENT;
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_INIT, pwm_init, HOOK_PRIO_DEFAULT);
-static int pwm_preserve_state(void)
+static void pwm_preserve_state(void)
{
struct pwm_state state;
@@ -394,30 +392,25 @@ static int pwm_preserve_state(void)
system_add_jump_tag(PWM_SYSJUMP_TAG, PWM_HOOK_VERSION,
sizeof(state), &state);
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_SYSJUMP, pwm_preserve_state, HOOK_PRIO_DEFAULT);
-static int pwm_resume(void)
+static void pwm_resume(void)
{
pwm_enable_fan(1);
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, pwm_resume, HOOK_PRIO_DEFAULT);
-static int pwm_suspend(void)
+static void pwm_suspend(void)
{
pwm_enable_fan(0);
pwm_set_fan_target_rpm(0);
pwm_set_keyboard_backlight(0);
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, pwm_suspend, HOOK_PRIO_DEFAULT);
-static int pwm_shutdown(void)
+static void pwm_shutdown(void)
{
pwm_set_keyboard_backlight(0);
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, pwm_shutdown, HOOK_PRIO_DEFAULT);
diff --git a/chip/lm4/watchdog.c b/chip/lm4/watchdog.c
index e86cb15852..58cabf80f9 100644
--- a/chip/lm4/watchdog.c
+++ b/chip/lm4/watchdog.c
@@ -80,20 +80,16 @@ void watchdog_reload(void)
LM4_WATCHDOG_LOCK(0) = 0xdeaddead;
}
-
-static int watchdog_freq_changed(void)
+static void watchdog_freq_changed(void)
{
/* Set the timeout period */
watchdog_period = WATCHDOG_PERIOD_MS * (clock_get_freq() / 1000);
/* Reload the watchdog timer now */
watchdog_reload();
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_FREQ_CHANGE, watchdog_freq_changed, HOOK_PRIO_DEFAULT);
-
int watchdog_init(void)
{
volatile uint32_t scratch __attribute__((unused));
diff --git a/chip/stm32/adc.c b/chip/stm32/adc.c
index 12247477b9..c91a5148cb 100644
--- a/chip/stm32/adc.c
+++ b/chip/stm32/adc.c
@@ -4,7 +4,7 @@
*/
#include "adc.h"
-#include "board.h"
+#include "common.h"
#include "console.h"
#include "dma.h"
#include "hooks.h"
@@ -141,7 +141,7 @@ int adc_read_all_channels(int *data)
return EC_SUCCESS;
}
-static int adc_init(void)
+static void adc_init(void)
{
/*
* Enable ADC clock.
@@ -174,8 +174,6 @@ static int adc_init(void)
*/
STM32_ADC_SMPR1 = 0;
STM32_ADC_SMPR2 = 0;
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_INIT, adc_init, HOOK_PRIO_DEFAULT);
diff --git a/chip/stm32/flash-stm32f100.c b/chip/stm32/flash-stm32f100.c
index 2d2b3647b3..88284d247d 100644
--- a/chip/stm32/flash-stm32f100.c
+++ b/chip/stm32/flash-stm32f100.c
@@ -696,7 +696,7 @@ DECLARE_CONSOLE_COMMAND(fakewp, command_set_fake_wp,
/*****************************************************************************/
/* Hooks */
-static int flash_preserve_state(void)
+static void flash_preserve_state(void)
{
struct flash_wp_state state;
@@ -704,6 +704,5 @@ static int flash_preserve_state(void)
system_add_jump_tag(FLASH_SYSJUMP_TAG, FLASH_HOOK_VERSION,
sizeof(state), &state);
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_SYSJUMP, flash_preserve_state, HOOK_PRIO_DEFAULT);
diff --git a/chip/stm32/gpio-stm32f100.c b/chip/stm32/gpio-stm32f100.c
index 2641db612c..5d91ff343e 100644
--- a/chip/stm32/gpio-stm32f100.c
+++ b/chip/stm32/gpio-stm32f100.c
@@ -5,7 +5,7 @@
/* GPIO module for Chrome EC */
-#include "board.h"
+#include "config.h"
#include "console.h"
#include "gpio.h"
#include "hooks.h"
@@ -136,8 +136,7 @@ int gpio_pre_init(void)
return EC_SUCCESS;
}
-
-int gpio_init(void)
+void gpio_init(void)
{
/* Enable IRQs now that pins are set up */
task_enable_irq(STM32_IRQ_EXTI0);
@@ -147,12 +146,9 @@ int gpio_init(void)
task_enable_irq(STM32_IRQ_EXTI4);
task_enable_irq(STM32_IRQ_EXTI9_5);
task_enable_irq(STM32_IRQ_EXTI15_10);
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_INIT, gpio_init, HOOK_PRIO_DEFAULT);
-
uint16_t *gpio_get_level_reg(enum gpio_signal signal, uint32_t *mask)
{
*mask = gpio_list[signal].mask;
diff --git a/chip/stm32/gpio-stm32l15x.c b/chip/stm32/gpio-stm32l15x.c
index fcf2a66e13..3984eccaf6 100644
--- a/chip/stm32/gpio-stm32l15x.c
+++ b/chip/stm32/gpio-stm32l15x.c
@@ -5,7 +5,7 @@
/* GPIO module for Chrome EC */
-#include "board.h"
+#include "common.h"
#include "console.h"
#include "gpio.h"
#include "hooks.h"
@@ -94,8 +94,7 @@ int gpio_pre_init(void)
return EC_SUCCESS;
}
-
-static int gpio_init(void)
+static void gpio_init(void)
{
/* Enable IRQs now that pins are set up */
task_enable_irq(STM32_IRQ_EXTI0);
@@ -105,12 +104,9 @@ static int gpio_init(void)
task_enable_irq(STM32_IRQ_EXTI4);
task_enable_irq(STM32_IRQ_EXTI9_5);
task_enable_irq(STM32_IRQ_EXTI15_10);
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_INIT, gpio_init, HOOK_PRIO_DEFAULT);
-
void gpio_set_alternate_function(int port, int mask, int func)
{
int bit;
diff --git a/chip/stm32/i2c.c b/chip/stm32/i2c.c
index 5acd5c40f9..fe8655968c 100644
--- a/chip/stm32/i2c.c
+++ b/chip/stm32/i2c.c
@@ -3,13 +3,11 @@
* found in the LICENSE file.
*/
-#include "board.h"
#include "chipset.h"
#include "clock.h"
#include "common.h"
#include "console.h"
#include "dma.h"
-#include "ec_commands.h"
#include "gpio.h"
#include "hooks.h"
#include "host_command.h"
@@ -496,7 +494,7 @@ static int i2c_init_port(unsigned int port)
return EC_SUCCESS;
}
-static int i2c_init(void)
+static void i2c_init(void)
{
int rc = 0;
@@ -511,8 +509,6 @@ static int i2c_init(void)
task_enable_irq(STM32_IRQ_I2C2_EV);
task_enable_irq(STM32_IRQ_I2C2_ER);
}
-
- return rc;
}
DECLARE_HOOK(HOOK_INIT, i2c_init, HOOK_PRIO_DEFAULT);
diff --git a/common/charge_state.c b/common/charge_state.c
index 3aaad3b153..a09c664c0b 100644
--- a/common/charge_state.c
+++ b/common/charge_state.c
@@ -792,11 +792,10 @@ void charge_state_machine_task(void)
* This is triggered when the AC state changes or the system boots, so that
* we can update our charging state.
*/
-static int charge_hook(void)
+static void charge_hook(void)
{
/* Wake up the task now */
task_wake(TASK_ID_POWERSTATE);
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, charge_hook, HOOK_PRIO_DEFAULT);
DECLARE_HOOK(HOOK_AC_CHANGE, charge_hook, HOOK_PRIO_DEFAULT);
diff --git a/common/gaia_power.c b/common/gaia_power.c
index ab40cdc560..922b07afbb 100644
--- a/common/gaia_power.c
+++ b/common/gaia_power.c
@@ -226,10 +226,10 @@ void gaia_suspend_event(enum gpio_signal signal)
else
powerled_set_state(POWERLED_STATE_OFF);
/* Call hooks here since we don't know it prior to AP suspend */
- hook_notify(HOOK_CHIPSET_SUSPEND, 0);
+ hook_notify(HOOK_CHIPSET_SUSPEND);
} else {
powerled_set_state(POWERLED_STATE_ON);
- hook_notify(HOOK_CHIPSET_RESUME, 0);
+ hook_notify(HOOK_CHIPSET_RESUME);
}
}
@@ -362,7 +362,7 @@ static int power_on(void)
if (gpio_get_level(GPIO_SOC1V8_XPSHOLD) == 0) {
/* Initialize non-AP components */
- hook_notify(HOOK_CHIPSET_PRE_INIT, 0);
+ hook_notify(HOOK_CHIPSET_PRE_INIT);
/*
* Initiate PMIC power-on sequence only if cold booting AP to
@@ -396,7 +396,7 @@ static int power_on(void)
powerled_set_state(POWERLED_STATE_ON);
/* Call hooks now that AP is running */
- hook_notify(HOOK_CHIPSET_STARTUP, 0);
+ hook_notify(HOOK_CHIPSET_STARTUP);
CPRINTF("[%T AP running ...]\n");
return 0;
@@ -449,7 +449,7 @@ static void power_off(void)
int pmu_shutdown_retries = 3;
/* Call hooks before we drop power rails */
- hook_notify(HOOK_CHIPSET_SHUTDOWN, 0);
+ hook_notify(HOOK_CHIPSET_SHUTDOWN);
/* switch off all rails */
gpio_set_level(GPIO_EN_PP3300, 0);
gpio_set_level(GPIO_EN_PP1350, 0);
diff --git a/common/hooks.c b/common/hooks.c
index e51503ed31..81d84b3d00 100644
--- a/common/hooks.c
+++ b/common/hooks.c
@@ -14,8 +14,10 @@ struct hook_ptrs {
const struct hook_data *end;
};
-/* Hook data start and end pointers for each type of hook. Must be in same
- * order as enum hook_type. */
+/*
+ * Hook data start and end pointers for each type of hook. Must be in same
+ * order as enum hook_type.
+ */
static const struct hook_ptrs hook_list[] = {
{__hooks_init, __hooks_init_end},
{__hooks_freq_change, __hooks_freq_change_end},
@@ -29,13 +31,11 @@ static const struct hook_ptrs hook_list[] = {
{__hooks_lid_change, __hooks_lid_change_end},
};
-
-int hook_notify(enum hook_type type, int stop_on_error)
+void hook_notify(enum hook_type type)
{
const struct hook_data *start, *end, *p;
int count, called = 0;
int last_prio = HOOK_PRIO_FIRST - 1, prio;
- int rv_error = EC_SUCCESS, rv;
start = hook_list[type].start;
end = hook_list[type].end;
@@ -54,17 +54,8 @@ int hook_notify(enum hook_type type, int stop_on_error)
for (p = start; p < end; p++) {
if (p->priority == prio) {
called++;
- rv = p->routine();
- if (rv != EC_SUCCESS) {
- if (stop_on_error)
- return rv;
- else if (rv_error == EC_SUCCESS)
- rv_error = rv;
- }
+ p->routine();
}
}
}
-
- /* Return the first error seen, if any */
- return rv_error;
}
diff --git a/common/ir357x.c b/common/ir357x.c
index 02c6dcc5cf..c6966b7e31 100644
--- a/common/ir357x.c
+++ b/common/ir357x.c
@@ -5,7 +5,7 @@
* IR357x driver.
*/
-#include "board.h"
+#include "common.h"
#include "console.h"
#include "hooks.h"
#include "i2c.h"
@@ -239,11 +239,9 @@ DECLARE_CONSOLE_COMMAND(ir357x, command_ir357x,
"IR357x core regulator control",
NULL);
-static int ir357x_hot_settings(void)
+static void ir357x_hot_settings(void)
{
/* dynamically apply settings to workaround issue */
ir357x_prog();
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, ir357x_hot_settings, HOOK_PRIO_DEFAULT);
diff --git a/common/keyboard.c b/common/keyboard.c
index 059e41b389..38535df1bd 100644
--- a/common/keyboard.c
+++ b/common/keyboard.c
@@ -941,7 +941,8 @@ DECLARE_HOST_COMMAND(EC_CMD_MKBP_SIMULATE_KEY,
/*****************************************************************************/
/* Hooks */
-/* Preserves the states of keyboard controller to keep the initialized states
+/**
+ * Preserve the states of keyboard controller to keep the initialized states
* between reboot_ec commands. Saving info include:
*
* - code set
@@ -950,7 +951,7 @@ DECLARE_HOST_COMMAND(EC_CMD_MKBP_SIMULATE_KEY,
* - KB/TP disabled
* - KB/TP IRQ enabled
*/
-static int keyboard_preserve_state(void)
+static void keyboard_preserve_state(void)
{
struct kb_state state;
@@ -959,14 +960,13 @@ static int keyboard_preserve_state(void)
system_add_jump_tag(KB_SYSJUMP_TAG, KB_HOOK_VERSION,
sizeof(state), &state);
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_SYSJUMP, keyboard_preserve_state, HOOK_PRIO_DEFAULT);
-
-/* Restores the keyboard states after reboot_ec command. See above function. */
-static int keyboard_restore_state(void)
+/**
+ * Restore the keyboard states after reboot_ec command. See above function.
+ */
+static void keyboard_restore_state(void)
{
const struct kb_state *prev;
int version, size;
@@ -978,7 +978,5 @@ static int keyboard_restore_state(void)
scancode_set = prev->codeset;
update_ctl_ram(0, prev->ctlram);
}
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_INIT, keyboard_restore_state, HOOK_PRIO_DEFAULT);
diff --git a/common/lightbar.c b/common/lightbar.c
index bdf3211304..c6e971e77a 100644
--- a/common/lightbar.c
+++ b/common/lightbar.c
@@ -219,10 +219,9 @@ static const struct lightbar_params default_params = {
};
#define LB_SYSJUMP_TAG 0x4c42 /* "LB" */
-static int lb_preserve_state(void)
+static void lb_preserve_state(void)
{
system_add_jump_tag(LB_SYSJUMP_TAG, 0, sizeof(st), &st);
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_SYSJUMP, lb_preserve_state, HOOK_PRIO_DEFAULT);
@@ -1029,35 +1028,30 @@ void lightbar_sequence(enum lightbar_sequence num)
/****************************************************************************/
/* Get notifications from other parts of the system */
-static int lightbar_startup(void)
+static void lightbar_startup(void)
{
lightbar_sequence(LIGHTBAR_S5S3);
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, lightbar_startup, HOOK_PRIO_DEFAULT);
-static int lightbar_resume(void)
+static void lightbar_resume(void)
{
lightbar_sequence(LIGHTBAR_S3S0);
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, lightbar_resume, HOOK_PRIO_DEFAULT);
-static int lightbar_suspend(void)
+static void lightbar_suspend(void)
{
lightbar_sequence(LIGHTBAR_S0S3);
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, lightbar_suspend, HOOK_PRIO_DEFAULT);
-static int lightbar_shutdown(void)
+static void lightbar_shutdown(void)
{
lightbar_sequence(LIGHTBAR_S3S5);
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, lightbar_shutdown, HOOK_PRIO_DEFAULT);
-
/****************************************************************************/
/* Generic command-handling (should work the same for both console & LPC) */
/****************************************************************************/
diff --git a/common/main.c b/common/main.c
index b38b862f91..eb02ce8005 100644
--- a/common/main.c
+++ b/common/main.c
@@ -122,7 +122,7 @@ int main(void)
* Non-driver modules with tasks do their inits from their task
* functions, not here.
*/
- hook_notify(HOOK_INIT, 0);
+ hook_notify(HOOK_INIT);
/*
* Print the init time. Not completely accurate because it can't take
diff --git a/common/pmu_tps65090.c b/common/pmu_tps65090.c
index 2afe7aa585..d825cd028c 100644
--- a/common/pmu_tps65090.c
+++ b/common/pmu_tps65090.c
@@ -5,7 +5,6 @@
* TI TPS65090 PMU driver.
*/
-#include "board.h"
#include "clock.h"
#include "console.h"
#include "common.h"
@@ -433,7 +432,7 @@ int pmu_shutdown(void)
* Fill all of the pmu registers with known good values, this allows the
* pmu to recover by rebooting the system if its registers were trashed.
*/
-static int pmu_init_registers(void)
+static void pmu_init_registers(void)
{
const struct {
uint8_t index;
@@ -460,15 +459,14 @@ static int pmu_init_registers(void)
{AD_CTRL, 0x00},
{IRQ1_REG, 0x00}
};
- uint8_t i, rv;
+ uint8_t i;
- for (i = 0; i < ARRAY_SIZE(reg); i++) {
- rv = pmu_write(reg[i].index, reg[i].value);
- if (rv)
- return rv;
- }
-
- return EC_SUCCESS;
+ /*
+ * Write all PMU registers. Ignore return value from pmu_write()
+ * because there's nothing we can reasonably do if it fails.
+ */
+ for (i = 0; i < ARRAY_SIZE(reg); i++)
+ pmu_write(reg[i].index, reg[i].value);
}
DECLARE_HOOK(HOOK_CHIPSET_PRE_INIT, pmu_init_registers, HOOK_PRIO_DEFAULT);
@@ -531,10 +529,9 @@ void pmu_init(void)
/* Initializes PMU when power is turned on. This is necessary because the TPS'
* 3.3V rail is not powered until the power is turned on. */
-static int pmu_chipset_startup(void)
+static void pmu_chipset_startup(void)
{
pmu_init();
- return 0;
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, pmu_chipset_startup, HOOK_PRIO_DEFAULT);
diff --git a/common/pmu_tps65090_charger.c b/common/pmu_tps65090_charger.c
index d710262954..cfc218d7e5 100644
--- a/common/pmu_tps65090_charger.c
+++ b/common/pmu_tps65090_charger.c
@@ -5,9 +5,9 @@
* TI TPS65090 PMU charging task.
*/
-#include "board.h"
#include "clock.h"
#include "chipset.h"
+#include "common.h"
#include "console.h"
#include "hooks.h"
#include "gpio.h"
@@ -482,10 +482,9 @@ void pmu_charger_task(void)
}
/* Wake charging task on chipset events */
-static int pmu_chipset_events(void)
+static void pmu_chipset_events(void)
{
task_wake(TASK_ID_PMU_TPS65090_CHARGER);
- return 0;
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, pmu_chipset_events, HOOK_PRIO_DEFAULT);
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, pmu_chipset_events, HOOK_PRIO_DEFAULT);
diff --git a/common/system_common.c b/common/system_common.c
index 979e934a12..7db000758d 100644
--- a/common/system_common.c
+++ b/common/system_common.c
@@ -5,9 +5,8 @@
/* System module for Chrome EC : common functions */
-#include "board.h"
#include "clock.h"
-#include "config.h"
+#include "common.h"
#include "console.h"
#include "ec_commands.h"
#include "flash.h"
@@ -323,7 +322,7 @@ static void jump_to_image(uint32_t init_addr)
jdata->struct_size = sizeof(struct jump_data);
/* Call other hooks; these may add tags */
- hook_notify(HOOK_SYSJUMP, 0);
+ hook_notify(HOOK_SYSJUMP);
/* Jump to the reset vector */
resetvec();
@@ -559,9 +558,9 @@ static int handle_pending_reboot(enum ec_reboot_cmd cmd)
/*****************************************************************************/
/* Hooks */
-static int system_common_shutdown(void)
+static void system_common_shutdown(void)
{
- return handle_pending_reboot(reboot_at_shutdown);
+ handle_pending_reboot(reboot_at_shutdown);
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, system_common_shutdown, HOOK_PRIO_DEFAULT);
diff --git a/common/thermal.c b/common/thermal.c
index 6aa8209848..780b9c2042 100644
--- a/common/thermal.c
+++ b/common/thermal.c
@@ -210,11 +210,10 @@ void thermal_task(void)
}
}
-static int thermal_shutdown(void)
+static void thermal_shutdown(void)
{
/* Take back fan control when the processor shuts down */
thermal_control_fan(1);
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, thermal_shutdown, HOOK_PRIO_DEFAULT);
diff --git a/common/tmp006.c b/common/tmp006.c
index 42d21e75d6..cd1bdb0c10 100644
--- a/common/tmp006.c
+++ b/common/tmp006.c
@@ -5,8 +5,7 @@
/* TMP006 temperature sensor module for Chrome EC */
-#include "board.h"
-#include "config.h"
+#include "common.h"
#include "console.h"
#include "gpio.h"
#include "hooks.h"
@@ -248,7 +247,10 @@ int tmp006_poll(void)
return rv1;
}
-static int tmp006_init(void)
+/*****************************************************************************/
+/* Hooks */
+
+static void tmp006_init(void)
{
int i;
@@ -263,8 +265,6 @@ static int tmp006_init(void)
tdata->b1 = B1;
tdata->b2 = B2;
}
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_INIT, tmp006_init, HOOK_PRIO_DEFAULT);
diff --git a/common/usb_charge.c b/common/usb_charge.c
index 6f95d91101..c7332fab49 100644
--- a/common/usb_charge.c
+++ b/common/usb_charge.c
@@ -168,7 +168,7 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_CHARGE_SET_MODE,
/*****************************************************************************/
/* Hooks */
-static int usb_charge_preserve_state(void)
+static void usb_charge_preserve_state(void)
{
struct usb_state state;
@@ -177,11 +177,10 @@ static int usb_charge_preserve_state(void)
system_add_jump_tag(USB_SYSJUMP_TAG, USB_HOOK_VERSION,
sizeof(state), &state);
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_SYSJUMP, usb_charge_preserve_state, HOOK_PRIO_DEFAULT);
-static int usb_charge_init(void)
+static void usb_charge_init(void)
{
const struct usb_state *prev;
int version, size;
@@ -194,25 +193,19 @@ static int usb_charge_init(void)
}
else
usb_charge_all_ports_off();
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_INIT, usb_charge_init, HOOK_PRIO_DEFAULT);
-
-static int usb_charge_resume(void)
+static void usb_charge_resume(void)
{
/* Turn on USB ports on as we go into S0 from S3 or S5. */
usb_charge_all_ports_on();
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, usb_charge_resume, HOOK_PRIO_DEFAULT);
-
-static int usb_charge_shutdown(void)
+static void usb_charge_shutdown(void)
{
/* Turn on USB ports off as we go back to S5. */
usb_charge_all_ports_off();
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, usb_charge_shutdown, HOOK_PRIO_DEFAULT);
diff --git a/common/x86_power.c b/common/x86_power.c
index 567af54f77..829139ea10 100644
--- a/common/x86_power.c
+++ b/common/x86_power.c
@@ -318,32 +318,31 @@ void chipset_throttle_cpu(int throttle)
/*****************************************************************************/
/* Hooks */
-/* Hook notified when lid state changes. */
-static int x86_lid_change(void)
+/**
+ * Hook notified when lid state changes.
+ */
+static void x86_lid_change(void)
{
/* Wake up the task to update power state */
task_wake(TASK_ID_X86POWER);
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_LID_CHANGE, x86_lid_change, HOOK_PRIO_DEFAULT);
-/* Hook notified when AC state changes. */
-static int x86_power_ac_change(void)
+/**
+ * Hook notified when AC state changes.
+ */
+static void x86_power_ac_change(void)
{
if (power_ac_present()) {
CPRINTF("[%T x86 AC on]\n");
- /* TODO: (crosbug.com/p/9609) re-enable turbo? */
} else {
CPRINTF("[%T x86 AC off]\n");
- /* TODO: (crosbug.com/p/9609) disable turbo */
if (state == X86_G3) {
last_shutdown_time = get_time().val;
task_wake(TASK_ID_X86POWER);
}
}
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_AC_CHANGE, x86_power_ac_change, HOOK_PRIO_DEFAULT);
@@ -362,7 +361,7 @@ void x86_power_interrupt(enum gpio_signal signal)
/*****************************************************************************/
/* Initialization */
-static int x86_power_init(void)
+static void x86_power_init(void)
{
/* Update input state */
update_in_signals();
@@ -412,8 +411,6 @@ static int x86_power_init(void)
gpio_enable_interrupt(GPIO_PGOOD_VCCP);
gpio_enable_interrupt(GPIO_PGOOD_VCCSA);
gpio_enable_interrupt(GPIO_PGOOD_VGFX_CORE);
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_INIT, x86_power_init, HOOK_PRIO_INIT_CHIPSET);
@@ -551,7 +548,7 @@ void x86_power_task(void)
gpio_set_level(GPIO_ENABLE_TOUCHPAD, 1);
/* Call hooks now that rails are up */
- hook_notify(HOOK_CHIPSET_STARTUP, 0);
+ hook_notify(HOOK_CHIPSET_STARTUP);
state = X86_S3;
break;
@@ -582,7 +579,7 @@ void x86_power_task(void)
gpio_set_level(GPIO_ENABLE_VCORE, 1);
/* Call hooks now that rails are up */
- hook_notify(HOOK_CHIPSET_RESUME, 0);
+ hook_notify(HOOK_CHIPSET_RESUME);
/* Wait 99ms after all voltages good */
usleep(99000);
@@ -601,7 +598,7 @@ void x86_power_task(void)
case X86_S0S3:
/* Call hooks before we remove power rails */
- hook_notify(HOOK_CHIPSET_SUSPEND, 0);
+ hook_notify(HOOK_CHIPSET_SUSPEND);
/* Clear PCH_PWROK */
gpio_set_level(GPIO_PCH_PWROK, 0);
@@ -631,7 +628,7 @@ void x86_power_task(void)
case X86_S3S5:
/* Call hooks before we remove power rails */
- hook_notify(HOOK_CHIPSET_SHUTDOWN, 0);
+ hook_notify(HOOK_CHIPSET_SHUTDOWN);
/* Disable touchpad power */
gpio_set_level(GPIO_ENABLE_TOUCHPAD, 0);
diff --git a/core/cortex-m/timer.c b/core/cortex-m/timer.c
index 10370aeeb6..d3eaae7efb 100644
--- a/core/cortex-m/timer.c
+++ b/core/cortex-m/timer.c
@@ -250,18 +250,14 @@ DECLARE_CONSOLE_COMMAND(timerinfo, command_timer_info,
#define TIMER_SYSJUMP_TAG 0x4d54 /* "TM" */
-
/* Preserve time across a sysjump */
-static int timer_sysjump(void)
+static void timer_sysjump(void)
{
timestamp_t ts = get_time();
system_add_jump_tag(TIMER_SYSJUMP_TAG, 1, sizeof(ts), &ts);
-
- return EC_SUCCESS;
}
DECLARE_HOOK(HOOK_SYSJUMP, timer_sysjump, HOOK_PRIO_DEFAULT);
-
int timer_init(void)
{
const timestamp_t *ts;
diff --git a/include/hooks.h b/include/hooks.h
index a3b35385a3..8124257877 100644
--- a/include/hooks.h
+++ b/include/hooks.h
@@ -23,7 +23,6 @@ enum hook_priority {
HOOK_PRIO_INIT_CHIPSET = HOOK_PRIO_FIRST + 2,
};
-
enum hook_type {
HOOK_INIT = 0, /* System init */
HOOK_FREQ_CHANGE, /* System clock changed frequency */
@@ -50,26 +49,31 @@ enum hook_type {
* state, not raw lid GPIO input. */
};
-
struct hook_data {
- /* Hook processing routine; returns EC error code. */
- int (*routine)(void);
+ /* Hook processing routine. */
+ void (*routine)(void);
/* Priority; low numbers = higher priority. */
int priority;
};
+/**
+ * Call all the hook routines of a specified type.
+ *
+ * @param type Type of hook routines to call.
+ */
+void hook_notify(enum hook_type type);
-/* Call all the hook routines of a specified type. If stop_on_error, stops on
- * the first non-EC_SUCCESS return code. Returns the first non-EC_SUCCESS
- * return code, if any, or EC_SUCCESS if all hooks returned EC_SUCCESS. */
-int hook_notify(enum hook_type type, int stop_on_error);
-
-
-/* Register a hook routine. <hooktype> should be one of enum hook_type.
- * <routine> should be int routine(void), and should return an error code or
- * EC_SUCCESS if no error. <priority> should be between HOOK_PRIO_FIRST and
- * HOOK_PRIO_LAST, and should be HOOK_PRIO_DEFAULT unless there's a compelling
- * reason to care about the order in which hooks are called. */
+/**
+ * Register a hook routine.
+ *
+ * @param hooktype Type of hook for routine (enum hook_type)
+ * @param routine Hook routine, with prototype void routine(void)
+ * @param priority Priority for determining when routine is called vs.
+ * other hook routines; should be between HOOK_PRIO_FIRST
+ * and HOOK_PRIO_LAST, and should be HOOK_PRIO_DEFAULT
+ * unless there's a compelling reason to care about the
+ * order in which hooks are called.
+ */
#define DECLARE_HOOK(hooktype, routine, priority) \
const struct hook_data __hook_##hooktype##_##routine \
__attribute__((section(".rodata." #hooktype))) \