summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/hooks.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/common/hooks.c b/common/hooks.c
index 492ccd98b4..3d6ccb695f 100644
--- a/common/hooks.c
+++ b/common/hooks.c
@@ -52,6 +52,7 @@ static const struct hook_ptrs hook_list[] = {
/* Times for deferrable functions */
static uint64_t defer_until[DEFERRABLE_MAX_COUNT];
static int defer_new_call;
+static int hook_task_started;
#ifdef CONFIG_HOOK_DEBUG
/* Stats for hooks */
@@ -161,8 +162,10 @@ int hook_call_deferred(void (*routine)(void), int us)
* loop one more time before sleeping.
*/
defer_new_call = 1;
+
/* Wake task so it can re-sleep for the proper time */
- task_wake(TASK_ID_HOOKS);
+ if (hook_task_started)
+ task_wake(TASK_ID_HOOKS);
}
return EC_SUCCESS;
@@ -174,6 +177,8 @@ void hook_task(void)
static uint64_t last_second = -SECOND;
static uint64_t last_tick = -HOOK_TICK_INTERVAL;
+ hook_task_started = 1;
+
while (1) {
uint64_t t = get_time().val;
int next = 0;