diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-10-23 14:12:25 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-10-23 16:49:29 -0700 |
commit | e72788ef96e83ef9d6ac0b2593c7edd8139c9376 (patch) | |
tree | 8eab899042c277b835310e9c35d9ee8180b14837 /common/hooks.c | |
parent | 7cd4d4391d3abbd2272bf9b7459677a4fa99cd0c (diff) | |
download | chrome-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 'common/hooks.c')
-rw-r--r-- | common/hooks.c | 21 |
1 files changed, 6 insertions, 15 deletions
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; } |