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 /driver/regulator_ir357x.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 'driver/regulator_ir357x.c')
-rw-r--r-- | driver/regulator_ir357x.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/driver/regulator_ir357x.c b/driver/regulator_ir357x.c index c6966b7e31..89b1f9f2ee 100644 --- a/driver/regulator_ir357x.c +++ b/driver/regulator_ir357x.c @@ -15,7 +15,7 @@ /* Console output macros */ #define CPUTS(outstr) cputs(CC_CHIPSET, outstr) -#define CPRINTF(format, args...) cprintf(CC_CHIPSET, format, ## args) +#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args) /* 8-bit I2C address */ #define IR357x_I2C_ADDR (0x8 << 1) @@ -113,7 +113,7 @@ static void ir357x_write(uint8_t reg, uint8_t val) res = i2c_write8(I2C_PORT_REGULATOR, IR357x_I2C_ADDR, reg, val); if (res) - CPRINTF("[%T IR I2C write failed]\n"); + CPRINTF("IR I2C write failed"); } static int ir357x_get_version(void) @@ -151,12 +151,12 @@ static void ir357x_prog(void) for (; settings->reg; settings++) ir357x_write(settings->reg, settings->value); } else { - CPRINTF("[%T IR%d chip unsupported. Skip writing settings!\n", + CPRINTF("IR%d chip unsupported. Skip writing settings!", ir357x_get_version()); return; } - CPRINTF("[%T IR%d registers UPDATED]\n", ir357x_get_version()); + CPRINTF("IR%d registers UPDATED", ir357x_get_version()); } static void ir357x_dump(void) |