From 068cd0850684ee28a5a514e5a270edce2edb3979 Mon Sep 17 00:00:00 2001 From: Anton Staaf Date: Wed, 23 Mar 2016 12:45:28 -0700 Subject: 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 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 Tested-by: Bill Richardson Reviewed-by: Bill Richardson --- common/inductive_charging.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'common/inductive_charging.c') diff --git a/common/inductive_charging.c b/common/inductive_charging.c index 8b92394c8c..793f535afe 100644 --- a/common/inductive_charging.c +++ b/common/inductive_charging.c @@ -73,8 +73,9 @@ void inductive_charging_interrupt(enum gpio_signal signal) * looking at CHARGE_DONE. */ if (!monitor_charge_done) - hook_call_deferred(inductive_charging_monitor_charge, - SECOND); + hook_call_deferred( + &inductive_charging_monitor_charge_data, + SECOND); } } @@ -93,7 +94,8 @@ static void inductive_charging_lid_update(void) * unaligned. Delay here to give the coils time to align before * we try to clear CHARGE_DONE. */ - hook_call_deferred(inductive_charging_deferred_update, 5 * SECOND); + hook_call_deferred(&inductive_charging_deferred_update_data, + 5 * SECOND); } DECLARE_HOOK(HOOK_LID_CHANGE, inductive_charging_lid_update, HOOK_PRIO_DEFAULT); -- cgit v1.2.1