summaryrefslogtreecommitdiff
path: root/driver/battery/smart.c
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2014-05-19 15:03:27 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-05-21 20:32:17 +0000
commitffac23c0ea1bd4ff4568f5bd709a98f912b833a7 (patch)
tree362dd0ba205731aa07be97dd35b44b237799b23b /driver/battery/smart.c
parent478361de694b1fb45abf3c38dafbbf7fd1aa5f71 (diff)
downloadchrome-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/battery/smart.c')
-rw-r--r--driver/battery/smart.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/driver/battery/smart.c b/driver/battery/smart.c
index 4f6c2f349d..52e61a8699 100644
--- a/driver/battery/smart.c
+++ b/driver/battery/smart.c
@@ -15,7 +15,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_CHARGER, outstr);
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
#define BATTERY_WAIT_TIMEOUT (2800*MSEC)
#define BATTERY_NO_RESPONSE_TIMEOUT (1000*MSEC)
@@ -322,7 +322,7 @@ int battery_wait_for_stable(void)
got_response = 0;
- CPRINTF("[%T Wait for battery stabilized during %d]\n",
+ CPRINTS("Wait for battery stabilized during %d",
BATTERY_WAIT_TIMEOUT);
while (get_time().val < wait_timeout) {
/* Starting pinging battery */
@@ -330,19 +330,19 @@ int battery_wait_for_stable(void)
got_response = 1;
/* Battery is stable */
if (status & STATUS_INITIALIZED) {
- CPRINTF("[%T battery initialized]\n");
+ CPRINTS("battery initialized");
return EC_SUCCESS;
}
}
/* Assume no battery connected if no response for a while */
else if (!got_response &&
get_time().val > no_response_timeout) {
- CPRINTF("[%T battery not responding]\n");
+ CPRINTS("battery not responding");
return EC_ERROR_NOT_POWERED;
}
msleep(25); /* clock stretching could hold 25ms */
}
- CPRINTF("[%T battery wait stable timeout]\n");
+ CPRINTS("battery wait stable timeout");
return EC_ERROR_TIMEOUT;
}