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 /board/big/battery.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 'board/big/battery.c')
-rw-r--r-- | board/big/battery.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/board/big/battery.c b/board/big/battery.c index aa6191f2c0..4979085e96 100644 --- a/board/big/battery.c +++ b/board/big/battery.c @@ -13,7 +13,7 @@ #include "console.h" /* Console output macros */ -#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args) +#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args) /* These 2 defines are for cut_off command for 3S battery */ #define SB_SHIP_MODE_ADDR 0x3a @@ -274,16 +274,16 @@ const struct battery_info *battery_get_info(void) int design_mv; if (battery_manufacturer_name(manuf, sizeof(manuf))) { - CPRINTF("[%T Failed to get MANUF name]\n"); + CPRINTS("Failed to get MANUF name"); return &info_precharge; } if (battery_device_name(device, sizeof(device))) { - CPRINTF("[%T Failed to get DEVICE name]\n"); + CPRINTS("Failed to get DEVICE name"); return &info_precharge; } if (battery_design_voltage((int *)&design_mv)) { - CPRINTF("[%T Failed to get DESIGN_VOLTAGE]\n"); + CPRINTS("Failed to get DESIGN_VOLTAGE"); return &info_precharge; } @@ -291,7 +291,7 @@ const struct battery_info *battery_get_info(void) if ((strcasecmp(support_batteries[i].manuf, manuf) == 0) && (strcasecmp(support_batteries[i].device, device) == 0) && (support_batteries[i].design_mv == design_mv)) { - CPRINTF("[%T battery Manuf:%s, Device=%s, design=%u]\n", + CPRINTS("battery Manuf:%s, Device=%s, design=%u", manuf, device, design_mv); support_cut_off = support_batteries[i].support_cut_off; battery_info = support_batteries[i].battery_info; @@ -299,7 +299,7 @@ const struct battery_info *battery_get_info(void) } } - CPRINTF("[%T un-recognized battery Manuf:%s, Device:%s]\n", + CPRINTS("un-recognized battery Manuf:%s, Device:%s", manuf, device); return &info_precharge; } |