summaryrefslogtreecommitdiff
path: root/include/hooks.h
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-10-23 14:12:25 -0700
committerGerrit <chrome-bot@google.com>2012-10-23 16:49:29 -0700
commite72788ef96e83ef9d6ac0b2593c7edd8139c9376 (patch)
tree8eab899042c277b835310e9c35d9ee8180b14837 /include/hooks.h
parent7cd4d4391d3abbd2272bf9b7459677a4fa99cd0c (diff)
downloadchrome-ec-e72788ef96e83ef9d6ac0b2593c7edd8139c9376.tar.gz
Hook functions no longer return values
Previously, all hook functions returned EC_SUCCESS, which was meaningless because nothing ever looked at the return value. Changing the return value to void saves ~100 bytes of code size and an equal amount of source code size. BUG=none BRANCH=none TEST=code still builds; link still boots Change-Id: I2a636339894e5a804831244967a9c9d134df7d13 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36372
Diffstat (limited to 'include/hooks.h')
-rw-r--r--include/hooks.h34
1 files changed, 19 insertions, 15 deletions
diff --git a/include/hooks.h b/include/hooks.h
index a3b35385a3..8124257877 100644
--- a/include/hooks.h
+++ b/include/hooks.h
@@ -23,7 +23,6 @@ enum hook_priority {
HOOK_PRIO_INIT_CHIPSET = HOOK_PRIO_FIRST + 2,
};
-
enum hook_type {
HOOK_INIT = 0, /* System init */
HOOK_FREQ_CHANGE, /* System clock changed frequency */
@@ -50,26 +49,31 @@ enum hook_type {
* state, not raw lid GPIO input. */
};
-
struct hook_data {
- /* Hook processing routine; returns EC error code. */
- int (*routine)(void);
+ /* Hook processing routine. */
+ void (*routine)(void);
/* Priority; low numbers = higher priority. */
int priority;
};
+/**
+ * Call all the hook routines of a specified type.
+ *
+ * @param type Type of hook routines to call.
+ */
+void hook_notify(enum hook_type type);
-/* Call all the hook routines of a specified type. If stop_on_error, stops on
- * the first non-EC_SUCCESS return code. Returns the first non-EC_SUCCESS
- * return code, if any, or EC_SUCCESS if all hooks returned EC_SUCCESS. */
-int hook_notify(enum hook_type type, int stop_on_error);
-
-
-/* Register a hook routine. <hooktype> should be one of enum hook_type.
- * <routine> should be int routine(void), and should return an error code or
- * EC_SUCCESS if no error. <priority> should be between HOOK_PRIO_FIRST and
- * HOOK_PRIO_LAST, and should be HOOK_PRIO_DEFAULT unless there's a compelling
- * reason to care about the order in which hooks are called. */
+/**
+ * Register a hook routine.
+ *
+ * @param hooktype Type of hook for routine (enum hook_type)
+ * @param routine Hook routine, with prototype void routine(void)
+ * @param priority Priority for determining when routine is called vs.
+ * other hook routines; should be between HOOK_PRIO_FIRST
+ * and HOOK_PRIO_LAST, and should be HOOK_PRIO_DEFAULT
+ * unless there's a compelling reason to care about the
+ * order in which hooks are called.
+ */
#define DECLARE_HOOK(hooktype, routine, priority) \
const struct hook_data __hook_##hooktype##_##routine \
__attribute__((section(".rodata." #hooktype))) \