State machines implemented using deferred functions need to be able to
kick off deferred function from a HOOK_INIT handler. But tasks aren't
running in HOOK_INIT, so task_wake() fails.
Instead, hook_call_deferred() should check to see if the hook task has
had a chance to run yet. If it hasn't, then there's no need to wake
it; it'll get run eventually anyway.
BUG=chrome-os-partner:24892
BRANCH=rambi
TEST=Add a call to hook_call_deferred() in a HOOK_INIT handler. It shouldn't
crash, and the deferred function should be called.
Change-Id: I5c8077b636ae030a668a211fd8238549b6bcfa54
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181953
Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>