summaryrefslogtreecommitdiff
path: root/common/host_command.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 /common/host_command.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 'common/host_command.c')
-rw-r--r--common/host_command.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/common/host_command.c b/common/host_command.c
index 05a1c199a6..36344ac7ec 100644
--- a/common/host_command.c
+++ b/common/host_command.c
@@ -19,7 +19,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_HOSTCMD, outstr)
-#define CPRINTF(format, args...) cprintf(CC_HOSTCMD, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_HOSTCMD, format, ## args)
#define TASK_EVENT_CMD_PENDING TASK_EVENT_CUSTOM(1)
@@ -99,7 +99,7 @@ test_mockable void host_send_response(struct host_cmd_handler_args *args)
* the completion of that command, so stash the result
* code.
*/
- CPRINTF("[%T HC pending done, size=%d, result=%d]\n",
+ CPRINTS("HC pending done, size=%d, result=%d",
args->response_size, args->result);
/*
@@ -121,7 +121,7 @@ test_mockable void host_send_response(struct host_cmd_handler_args *args)
} else if (args->result == EC_RES_IN_PROGRESS) {
command_pending = 1;
- CPRINTF("[HC pending]\n");
+ CPRINTS("HC pending");
}
}
#endif
@@ -362,7 +362,7 @@ static void host_command_init(void)
*host_get_memmap(EC_MEMMAP_EVENTS_VERSION) = 1;
host_set_single_event(EC_HOST_EVENT_INTERFACE_READY);
- CPRINTF("[%T hostcmd init 0x%x]\n", host_get_events());
+ CPRINTS("hostcmd init 0x%x", host_get_events());
}
void host_command_task(void)
@@ -512,10 +512,10 @@ static void host_command_debug_request(struct host_cmd_handler_args *args)
}
if (hcdebug >= HCDEBUG_PARAMS && args->params_size)
- CPRINTF("[%T HC 0x%02x.%d:%.*h]\n", args->command,
+ CPRINTS("HC 0x%02x.%d:%.*h", args->command,
args->version, args->params_size, args->params);
else
- CPRINTF("[%T HC 0x%02x]\n", args->command);
+ CPRINTS("HC 0x%02x", args->command);
}
enum ec_status host_command_process(struct host_cmd_handler_args *args)
@@ -534,10 +534,10 @@ enum ec_status host_command_process(struct host_cmd_handler_args *args)
rv = cmd->handler(args);
if (rv != EC_RES_SUCCESS)
- CPRINTF("[%T HC err %d]\n", rv);
+ CPRINTS("HC err %d", rv);
if (hcdebug >= HCDEBUG_PARAMS && args->response_size)
- CPRINTF("[%T HC resp:%.*h]\n", args->response_size,
+ CPRINTS("HC resp:%.*h", args->response_size,
args->response);
return rv;