diff options
author | Anton Staaf <robotboy@chromium.org> | 2016-03-23 12:45:28 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-04-18 17:32:40 -0700 |
commit | 068cd0850684ee28a5a514e5a270edce2edb3979 (patch) | |
tree | e84f2316e37baa72f1c9611e665749d91a3ce8fd /common/battery.c | |
parent | 1e7c280491232110e1006d545f9a61ca05d469d5 (diff) | |
download | chrome-ec-068cd0850684ee28a5a514e5a270edce2edb3979.tar.gz |
Deferred: Use deferred_data instead of function pointer
Previously calls to hook_call_deferred were passed the function to call,
which was then looked up in the .rodata.deferred section with a linear
search. This linear search can be replaced with a subtract by passing
the pointer to the deferred_data object created when DECLARE_DEFERRED
was invoked.
Signed-off-by: Anton Staaf <robotboy@chromium.org>
BRANCH=None
BUG=None
CQ-DEPEND=CL:*255812
TEST=make buildall -j
Change-Id: I951dd1541302875b102dd086154cf05591694440
Reviewed-on: https://chromium-review.googlesource.com/334315
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'common/battery.c')
-rw-r--r-- | common/battery.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/battery.c b/common/battery.c index 408ae92c46..ae3d548676 100644 --- a/common/battery.c +++ b/common/battery.c @@ -294,7 +294,7 @@ static void clear_pending_cutoff(void) { if (extpower_is_present()) { battery_cutoff_state = BATTERY_CUTOFF_STATE_NORMAL; - hook_call_deferred(pending_cutoff_deferred, -1); + hook_call_deferred(&pending_cutoff_deferred_data, -1); } } DECLARE_HOOK(HOOK_AC_CHANGE, clear_pending_cutoff, HOOK_PRIO_DEFAULT); @@ -331,7 +331,7 @@ static void check_pending_cutoff(void) if (battery_cutoff_state == BATTERY_CUTOFF_STATE_PENDING) { CPRINTF("[%T Cutting off battery in %d second(s)]\n", CONFIG_BATTERY_CUTOFF_DELAY_US / SECOND); - hook_call_deferred(pending_cutoff_deferred, + hook_call_deferred(&pending_cutoff_deferred_data, CONFIG_BATTERY_CUTOFF_DELAY_US); } } |