summaryrefslogtreecommitdiff
path: root/common/battery.c
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2019-12-18 13:59:21 +0800
committerCommit Bot <commit-bot@chromium.org>2019-12-18 20:20:21 +0000
commit3e6d03b01f79b6a808a496fc8808a64e9757fe1e (patch)
treeeedef25de3be2a7935167035dee17087755f7fa1 /common/battery.c
parent0ecc66ea725372db174fb5ac125b4f856f76cfce (diff)
downloadchrome-ec-3e6d03b01f79b6a808a496fc8808a64e9757fe1e.tar.gz
battery: combine strings to reduce code size
TEST=see kodama's RW flash space shrank by 44 bytes. BUG=chromium:1034518 BRANCH=kukui Change-Id: Ia21b31d08090dca1b91965f47a90120f0dfbde11 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1972999 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'common/battery.c')
-rw-r--r--common/battery.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/common/battery.c b/common/battery.c
index 67d08b4150..d55d4d393e 100644
--- a/common/battery.c
+++ b/common/battery.c
@@ -20,6 +20,7 @@
#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CUTOFFPRINTS(info) CPRINTS("%s %s", "Battery cut off", info)
/* See config.h for details */
const static int batt_full_factor = CONFIG_BATT_FULL_FACTOR;
@@ -305,9 +306,9 @@ static void pending_cutoff_deferred(void)
rv = board_cut_off_battery();
if (rv == EC_RES_SUCCESS)
- CPRINTS("Battery cut off succeeded.");
+ CUTOFFPRINTS("succeeded.");
else
- CPRINTS("Battery cut off failed!");
+ CUTOFFPRINTS("failed!");
}
DECLARE_DEFERRED(pending_cutoff_deferred);
@@ -329,17 +330,17 @@ static enum ec_status battery_command_cutoff(struct host_cmd_handler_args *args)
p = args->params;
if (p->flags & EC_BATTERY_CUTOFF_FLAG_AT_SHUTDOWN) {
battery_cutoff_state = BATTERY_CUTOFF_STATE_PENDING;
- CPRINTS("Battery cut off at-shutdown is scheduled");
+ CUTOFFPRINTS("at-shutdown is scheduled");
return EC_RES_SUCCESS;
}
}
rv = board_cut_off_battery();
if (rv == EC_RES_SUCCESS) {
- CPRINTS("Battery cut off is successful.");
+ CUTOFFPRINTS("is successful.");
battery_cutoff_state = BATTERY_CUTOFF_STATE_CUT_OFF;
} else {
- CPRINTS("Battery cut off has failed.");
+ CUTOFFPRINTS("has failed.");
}
return rv;