diff options
author | Aseda Aboagye <aaboagye@google.com> | 2015-07-01 09:31:26 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-07-13 18:43:56 +0000 |
commit | fbc84dc56566f31d897b420232088ba341810ea2 (patch) | |
tree | e3e9bf5cf66e28ceb55d3ff27a845d2553a80735 /common | |
parent | 41b538d4c6df5311fbf76495c187a4781938ae49 (diff) | |
download | chrome-ec-fbc84dc56566f31d897b420232088ba341810ea2.tar.gz |
hooks: Move HOOK_INIT to after task switching.
This commit changes the way in which tasks are started. Instead of
having all tasks marked as ready to run upon initialization, only the
hooks task is marked as ready to run. HOOK_INITs are now run at the
beginning of the hooks task. After the HOOK_INITs, the hooks task calls
back to enable the rest of the tasks, reschedules, and proceeds as
usual. This also allows the removal of checks for task_start_called().
BUG=chrome-os-partner:27226
BRANCH=None
TEST=Built and flash EC image for samus and verified that EC boot was
successful as well as AP boot. Additionally, verified that charging,
keyboard, tap-for-battery were all still functional.
TEST=make -j buildall tests
Change-Id: Iea53670222c803c2985e9c86c96974386888a4fe
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/283657
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/hooks.c | 11 | ||||
-rw-r--r-- | common/main.c | 3 |
2 files changed, 6 insertions, 8 deletions
diff --git a/common/hooks.c b/common/hooks.c index c07a3d1d1c..6cca00c914 100644 --- a/common/hooks.c +++ b/common/hooks.c @@ -131,11 +131,6 @@ void hook_notify(enum hook_type type) #endif } -void hook_init(void) -{ - hook_notify(HOOK_INIT); -} - int hook_call_deferred(void (*routine)(void), int us) { const struct deferred_data *p; @@ -180,6 +175,12 @@ void hook_task(void) hook_task_started = 1; + /* Call HOOK_INIT hooks. */ + hook_notify(HOOK_INIT); + + /* Now, enable the rest of the tasks. */ + task_enable_all_tasks(); + while (1) { uint64_t t = get_time().val; int next = 0; diff --git a/common/main.c b/common/main.c index a2f86abdee..d70d987d43 100644 --- a/common/main.c +++ b/common/main.c @@ -160,9 +160,6 @@ test_mockable __keep int main(void) check_rw_signature(); #endif - /* Initialize the hook library. This calls HOOK_INIT hooks. */ - hook_init(); - /* * Print the init time. Not completely accurate because it can't take * into account the time before timer_init(), but it'll at least catch |