From e72788ef96e83ef9d6ac0b2593c7edd8139c9376 Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Tue, 23 Oct 2012 14:12:25 -0700 Subject: 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 Reviewed-on: https://gerrit.chromium.org/gerrit/36372 --- common/hooks.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'common/hooks.c') diff --git a/common/hooks.c b/common/hooks.c index e51503ed31..81d84b3d00 100644 --- a/common/hooks.c +++ b/common/hooks.c @@ -14,8 +14,10 @@ struct hook_ptrs { const struct hook_data *end; }; -/* Hook data start and end pointers for each type of hook. Must be in same - * order as enum hook_type. */ +/* + * Hook data start and end pointers for each type of hook. Must be in same + * order as enum hook_type. + */ static const struct hook_ptrs hook_list[] = { {__hooks_init, __hooks_init_end}, {__hooks_freq_change, __hooks_freq_change_end}, @@ -29,13 +31,11 @@ static const struct hook_ptrs hook_list[] = { {__hooks_lid_change, __hooks_lid_change_end}, }; - -int hook_notify(enum hook_type type, int stop_on_error) +void hook_notify(enum hook_type type) { const struct hook_data *start, *end, *p; int count, called = 0; int last_prio = HOOK_PRIO_FIRST - 1, prio; - int rv_error = EC_SUCCESS, rv; start = hook_list[type].start; end = hook_list[type].end; @@ -54,17 +54,8 @@ int hook_notify(enum hook_type type, int stop_on_error) for (p = start; p < end; p++) { if (p->priority == prio) { called++; - rv = p->routine(); - if (rv != EC_SUCCESS) { - if (stop_on_error) - return rv; - else if (rv_error == EC_SUCCESS) - rv_error = rv; - } + p->routine(); } } } - - /* Return the first error seen, if any */ - return rv_error; } -- cgit v1.2.1