diff options
author | Tom Hughes <tomhughes@chromium.org> | 2022-07-08 13:14:15 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-07-12 17:04:22 +0000 |
commit | ebbbdf1a29296004acaa87b57de2059c146e3a3e (patch) | |
tree | 61c28e3aaa4519a74f48f5c9c307fb598d201093 /common | |
parent | c0f4b8bec7ccb755fb1151b01816d6cf5d26fdfa (diff) | |
download | chrome-ec-ebbbdf1a29296004acaa87b57de2059c146e3a3e.tar.gz |
tree: Remove non-standard %pb printf format
The binary printf format doesn't provide much over printing hex, so
change existing binary prints to hex. Using standard format specifiers
makes it easier to switch between the "builtin" EC standard library and
the C standard library provided by the toolchain (or Zephyr).
BRANCH=none
BUG=b:238433667, b:234181908
TEST=make buildall
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I55153f0ea1a4864e7819cee0e0f35368baa3f682
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3756176
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/charger.c | 2 | ||||
-rw-r--r-- | common/printf.c | 14 |
2 files changed, 3 insertions, 13 deletions
diff --git a/common/charger.c b/common/charger.c index c3f032f908..307e04dd8c 100644 --- a/common/charger.c +++ b/common/charger.c @@ -146,7 +146,7 @@ void print_charger_debug(int chgnum) /* option */ print_item_name("Option:"); if (check_print_error(charger_get_option(&d))) - ccprintf("%pb (0x%04x)\n", BINARY_VALUE(d, 16), d); + ccprintf("(0x%04x)\n", d); /* manufacturer id */ print_item_name("Man id:"); diff --git a/common/printf.c b/common/printf.c index 610a2da94f..f19e6d3b21 100644 --- a/common/printf.c +++ b/common/printf.c @@ -273,8 +273,8 @@ int vfnprintf(int (*addchar)(void *context, int c), void *context, ptrspec = *format++; ptrval = va_arg(args, void *); /* - * Avoid null pointer dereference for %ph and - * %pb. %pT and %pP can accept null. + * Avoid null pointer dereference for %ph. + * %pT and %pP can accept null. */ if (ptrval == NULL && ptrspec != 'T' && ptrspec != 'P') @@ -322,16 +322,6 @@ int vfnprintf(int (*addchar)(void *context, int c), void *context, sizeof(uint64_t)) flags |= PF_64BIT; - } else if (ptrspec == 'b') { - /* %pb - Print a binary integer */ - struct binary_print_params *binary = - ptrval; - - v = binary->value; - pad_width = binary->count; - flags |= PF_PADZERO; - base = 2; - } else { return EC_ERROR_INVAL; } |