summaryrefslogtreecommitdiff
path: root/common/keyboard_scan.c
diff options
context:
space:
mode:
authorEvan Green <evgreen@chromium.org>2019-07-19 16:20:45 -0700
committerCommit Bot <commit-bot@chromium.org>2019-10-05 00:47:36 +0000
commit0128582fe62b51a74a4c6c5a91e9c5118e70e376 (patch)
tree7d8d96c756da853b87d36497ba649b1fc8dad398 /common/keyboard_scan.c
parenta41fea6b7df1c83072140c0da9e07f09a8b032e4 (diff)
downloadchrome-ec-0128582fe62b51a74a4c6c5a91e9c5118e70e376.tar.gz
printf: Convert %T to %pT
In order to be more compliant to standards, and ultimately turn on compile-time printf format validation, switch the non-standard %T into %pT, which takes a pointer to a 64-bit timestamp as an argument. For convenience, define PRINTF_TIMESTAMP_NOW, which will use the current time as the timestamp value, rather than forcing everyone to pass a pointer to get_time().val. For a couple of instances, simply use CPRINTS instead. BUG=chromium:984041 TEST=make -j buildall BRANCH=None Cq-Depend:chrome-internal:1473305 Change-Id: I83e45b55a95ea27256dc147544ae3f7e39acc5dd Signed-off-by: Evan Green <evgreen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704216 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'common/keyboard_scan.c')
-rw-r--r--common/keyboard_scan.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/keyboard_scan.c b/common/keyboard_scan.c
index b4dd719784..7f7d44ceec 100644
--- a/common/keyboard_scan.c
+++ b/common/keyboard_scan.c
@@ -151,7 +151,7 @@ static void print_state(const uint8_t *state, const char *msg)
{
int c;
- CPRINTF("[%T KB %s:", msg);
+ CPRINTF("[%pT KB %s:", PRINTF_TIMESTAMP_NOW, msg);
for (c = 0; c < keyboard_cols; c++) {
if (state[c])
CPRINTF(" %02x", state[c]);
@@ -529,7 +529,7 @@ static int check_keys_changed(uint8_t *state)
#ifdef CONFIG_KEYBOARD_PRINT_SCAN_TIMES
/* Print delta times from now back to each previous scan */
- CPRINTF("[%T kb deltaT");
+ CPRINTF("[%pT kb deltaT", PRINTF_TIMESTAMP_NOW);
for (i = 0; i < SCAN_TIME_COUNT; i++) {
int tnew = scan_time[
(SCAN_TIME_COUNT + scan_time_index - i) %