summaryrefslogtreecommitdiff
path: root/common/ap_hang_detect.c
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2016-03-23 12:45:28 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-04-18 17:32:40 -0700
commit068cd0850684ee28a5a514e5a270edce2edb3979 (patch)
treee84f2316e37baa72f1c9611e665749d91a3ce8fd /common/ap_hang_detect.c
parent1e7c280491232110e1006d545f9a61ca05d469d5 (diff)
downloadchrome-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/ap_hang_detect.c')
-rw-r--r--common/ap_hang_detect.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/common/ap_hang_detect.c b/common/ap_hang_detect.c
index 2957365211..08bcff036a 100644
--- a/common/ap_hang_detect.c
+++ b/common/ap_hang_detect.c
@@ -28,6 +28,9 @@ static int timeout_will_reboot; /* Will the deferred call reboot the AP? */
/**
* Handle the hang detect timer expiring.
*/
+static void hang_detect_deferred(void);
+DECLARE_DEFERRED(hang_detect_deferred);
+
static void hang_detect_deferred(void)
{
/* If we're no longer active, nothing to do */
@@ -51,7 +54,7 @@ static void hang_detect_deferred(void)
if (hdparams.warm_reboot_timeout_msec) {
CPRINTS("hang detect continuing (for reboot)");
timeout_will_reboot = 1;
- hook_call_deferred(hang_detect_deferred,
+ hook_call_deferred(&hang_detect_deferred_data,
(hdparams.warm_reboot_timeout_msec -
hdparams.host_event_timeout_msec) * MSEC);
} else {
@@ -59,7 +62,6 @@ static void hang_detect_deferred(void)
active = 0;
}
}
-DECLARE_DEFERRED(hang_detect_deferred);
/**
* Start the hang detect timers.
@@ -74,13 +76,13 @@ static void hang_detect_start(const char *why)
CPRINTS("hang detect started on %s (for event)", why);
timeout_will_reboot = 0;
active = 1;
- hook_call_deferred(hang_detect_deferred,
+ hook_call_deferred(&hang_detect_deferred_data,
hdparams.host_event_timeout_msec * MSEC);
} else if (hdparams.warm_reboot_timeout_msec) {
CPRINTS("hang detect started on %s (for reboot)", why);
timeout_will_reboot = 1;
active = 1;
- hook_call_deferred(hang_detect_deferred,
+ hook_call_deferred(&hang_detect_deferred_data,
hdparams.warm_reboot_timeout_msec * MSEC);
}
}