diff options
author | Vic Yang <victoryang@chromium.org> | 2014-05-19 15:03:27 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-05-21 20:32:17 +0000 |
commit | ffac23c0ea1bd4ff4568f5bd709a98f912b833a7 (patch) | |
tree | 362dd0ba205731aa07be97dd35b44b237799b23b /common/extpower_spring.c | |
parent | 478361de694b1fb45abf3c38dafbbf7fd1aa5f71 (diff) | |
download | chrome-ec-ffac23c0ea1bd4ff4568f5bd709a98f912b833a7.tar.gz |
Add cprints() and ccprints()
Our code base contains a lot of debug messages in this pattern:
CPRINTF("[%T xxx]\n") or ccprintf("[%T xxx]\n")
The strings are taking up spaces in the EC binaries, so let's refactor
this by adding cprints() and ccprints().
cprints() is just like cprintf(), except that it adds the brackets
and the timestamp. ccprints() is equivalent to cprints(CC_CONSOLE, ...)
This saves us hundreds of bytes in EC binaries.
BUG=chromium:374575
TEST=Build and check flash size
BRANCH=None
Change-Id: Ifafe8dc1b80e698b28ed42b70518c7917b49ee51
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/200490
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/extpower_spring.c')
-rw-r--r-- | common/extpower_spring.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/common/extpower_spring.c b/common/extpower_spring.c index 0acaca4256..63735deab5 100644 --- a/common/extpower_spring.c +++ b/common/extpower_spring.c @@ -35,6 +35,7 @@ /* Console output macros */ #define CPUTS(outstr) cputs(CC_USBCHARGE, outstr) #define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args) +#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args) /* ILIM pin control */ enum ilim_config { @@ -463,14 +464,14 @@ static void usb_detect_overcurrent(int dev_type) } if (power_removed_type[idx] == dev_type) { if (oc_detect_retry[idx] > 0) { - CPRINTF("[%T USB overcurrent: Retry (%d)]\n", + CPRINTS("USB overcurrent: Retry (%d)", oc_detect_retry[idx]); oc_detect_retry[idx]--; return; } over_current_pwm_duty = power_removed_pwm_duty[idx] + PWM_CTRL_OC_BACK_OFF; - CPRINTF("[%T USB overcurrent: Limited to %d%%]\n", + CPRINTS("USB overcurrent: Limited to %d%%", over_current_pwm_duty); } } @@ -784,12 +785,12 @@ static void pwm_tweak(void) */ if (pwm_check_vbus_low(vbus, current)) { set_pwm_duty_cycle(current_pwm_duty + PWM_CTRL_STEP_UP); - CPRINTF("[%T PWM duty up %d%%]\n", current_pwm_duty); + CPRINTS("PWM duty up %d%%", current_pwm_duty); } else if (pwm_check_vbus_high(vbus)) { next = pwm_get_next_lower(); if (next >= 0) { set_pwm_duty_cycle(next); - CPRINTF("[%T PWM duty down %d%%]\n", current_pwm_duty); + CPRINTS("PWM duty down %d%%", current_pwm_duty); } } } @@ -850,7 +851,7 @@ static void usb_charger_redetect(void) return; if (timestamp_expired(charger_redetection_time, NULL)) { - CPRINTF("[%T USB Redetecting]\n"); + CPRINTS("USB Redetecting"); /* * TSU6721 doesn't update device type if power or ID pin * is present. Therefore, if the device type is the same, |