diff options
author | Eric Caruso <ejcaruso@chromium.org> | 2014-09-30 14:59:03 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-10-01 06:53:22 +0000 |
commit | fcdbcfe5e0d80137414a32b336b0011d1a6a6e00 (patch) | |
tree | 156df64edd965334d835434622f783de6d4ad7a7 /common/lightbar.c | |
parent | baf3bac6d818e0ea96b6cefdf6088e22315fff5a (diff) | |
download | chrome-ec-fcdbcfe5e0d80137414a32b336b0011d1a6a6e00.tar.gz |
lightbar: simplify JUMP, SET_DELAY_TIME opcode execution
We do some unnecessary work here. All we are trying to do is decode,
and decode already does all the error checking we want. Saves
20 bytes.
BUG=None
BRANCH=ToT
TEST=Run programs with JUMP and SET_DELAY_TIME opcodes in simulator
and on hardware.
Change-Id: Ia55f9010da50fe748bda565e069359162cc92b4f
Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/220630
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'common/lightbar.c')
-rw-r--r-- | common/lightbar.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/common/lightbar.c b/common/lightbar.c index e903cc5a5b..86600d4d5e 100644 --- a/common/lightbar.c +++ b/common/lightbar.c @@ -1017,12 +1017,7 @@ static inline uint32_t decode_32(uint32_t *dest) */ static uint32_t lightbyte_JUMP(void) { - uint8_t new_pc; - if (decode_8(&new_pc) != EC_SUCCESS) - return EC_RES_INVALID_PARAM; - - pc = new_pc; - return EC_SUCCESS; + return decode_8(&pc); } /* DELAY xx xx xx xx - yield processor for some time @@ -1115,12 +1110,7 @@ static uint32_t lightbyte_SET_COLOR(void) */ static uint32_t lightbyte_SET_DELAY_TIME(void) { - uint32_t delay_us; - if (decode_32(&delay_us) != EC_SUCCESS) - return EC_RES_INVALID_PARAM; - - lb_ramp_delay = delay_us; - return EC_SUCCESS; + return decode_32(&lb_ramp_delay); } static inline int get_interp_value(int led, int color, int interp) |