diff options
-rw-r--r-- | board/servo_v4p1/usb_sm.c | 2 | ||||
-rw-r--r-- | common/bluetooth_le.c | 6 | ||||
-rw-r--r-- | common/btle_hci_controller.c | 6 | ||||
-rw-r--r-- | common/btle_ll.c | 2 | ||||
-rw-r--r-- | common/hooks.c | 2 | ||||
-rw-r--r-- | common/memory_commands.c | 12 | ||||
-rw-r--r-- | common/printf.c | 21 | ||||
-rw-r--r-- | common/system.c | 2 | ||||
-rw-r--r-- | common/usbc/usb_sm.c | 2 | ||||
-rw-r--r-- | core/host/stack_trace.c | 1 | ||||
-rw-r--r-- | include/printf.h | 4 | ||||
-rw-r--r-- | test/printf.c | 43 | ||||
-rw-r--r-- | test/shmalloc.c | 8 | ||||
-rw-r--r-- | zephyr/shim/src/hooks.c | 2 |
14 files changed, 28 insertions, 85 deletions
diff --git a/board/servo_v4p1/usb_sm.c b/board/servo_v4p1/usb_sm.c index 1c94749c47..2016484bdd 100644 --- a/board/servo_v4p1/usb_sm.c +++ b/board/servo_v4p1/usb_sm.c @@ -115,7 +115,7 @@ void set_state(const int port, struct sm_ctx *const ctx, * intended state to transition into. */ if (internal->exit) { - CPRINTF("C%d: Ignoring set state to 0x%pP within 0x%pP", port, + CPRINTF("C%d: Ignoring set state to 0x%p within 0x%p", port, new_state, ctx->current); return; } diff --git a/common/bluetooth_le.c b/common/bluetooth_le.c index 4dc1aade45..631ab5d0e0 100644 --- a/common/bluetooth_le.c +++ b/common/bluetooth_le.c @@ -139,7 +139,7 @@ static void mem_dump(uint8_t *mem, int len) for (i = 0; i < len; i++) { value = mem[i]; if (i % 8 == 0) - CPRINTF("\n%pP: %02x", &mem[i], value); + CPRINTF("\n%p: %02x", &mem[i], value); else CPRINTF(" %02x", value); } @@ -160,7 +160,7 @@ void dump_ble_packet(struct ble_pdu *ble_p) int curr_offs; if (ble_p->header_type_adv) { - CPRINTF("BLE packet @ %pP: type %d, len %d, %s %s\n", ble_p, + CPRINTF("BLE packet @ %p: type %d, len %d, %s %s\n", ble_p, ble_p->header.adv.type, ble_p->header.adv.length, (ble_p->header.adv.txaddr ? " TXADDR" : ""), (ble_p->header.adv.rxaddr ? " RXADDR" : "")); @@ -187,7 +187,7 @@ void dump_ble_packet(struct ble_pdu *ble_p) mem_dump(ble_p->payload + curr_offs, ble_p->header.adv.length - curr_offs); } else { /* Data PDUs */ - CPRINTF("BLE data packet @%pP: LLID %d," + CPRINTF("BLE data packet @%p: LLID %d," " nesn %d, sn %d, md %d, length %d\n", ble_p, ble_p->header.data.llid, ble_p->header.data.nesn, ble_p->header.data.sn, ble_p->header.data.md, diff --git a/common/btle_hci_controller.c b/common/btle_hci_controller.c index 806eb7a2fa..72ffe26d63 100644 --- a/common/btle_hci_controller.c +++ b/common/btle_hci_controller.c @@ -467,7 +467,7 @@ static int command_ble_hci_cmd(int argc, char **argv) hci_cmd(hci_buf); - CPRINTS("hci cmd @%pP", hci_buf); + CPRINTS("hci cmd @%p", hci_buf); return EC_SUCCESS; } @@ -507,7 +507,7 @@ static int command_hcitool(int argc, char **argv) hci_cmd(hci_buf); - CPRINTS("hci cmd @%pP", hci_buf); + CPRINTS("hci cmd @%p", hci_buf); return EC_SUCCESS; } @@ -552,7 +552,7 @@ static int command_ble_hci_acl(int argc, char **argv) hci_cmd(hci_buf); - CPRINTS("hci acl @%pP", hci_buf); + CPRINTS("hci acl @%p", hci_buf); return EC_SUCCESS; } diff --git a/common/btle_ll.c b/common/btle_ll.c index 0ae0531c2d..d167541efc 100644 --- a/common/btle_ll.c +++ b/common/btle_ll.c @@ -765,7 +765,7 @@ void bluetooth_ll_task(void) case ADVERTISING: if (deadline.val == 0) { - CPRINTS("ADV @%pP", &ll_adv_pdu); + CPRINTS("ADV @%p", &ll_adv_pdu); deadline.val = get_time().val + (uint32_t)ll_adv_timeout_us; ll_adv_events = 0; diff --git a/common/hooks.c b/common/hooks.c index 61904eea59..d5e45a5324 100644 --- a/common/hooks.c +++ b/common/hooks.c @@ -196,7 +196,7 @@ void hook_task(void *u) */ __deferred_until[i] = 0; interrupt_enable(); - CPRINTS("hook call deferred 0x%pP", + CPRINTS("hook call deferred 0x%p", __deferred_funcs[i].routine); __deferred_funcs[i].routine(); interrupt_disable(); diff --git a/common/memory_commands.c b/common/memory_commands.c index 4a4812b696..506b385626 100644 --- a/common/memory_commands.c +++ b/common/memory_commands.c @@ -147,16 +147,16 @@ static int command_read_word(int argc, char **argv) if ((argc - argc_offs) < 3) { switch (access_size) { case 1: - ccprintf("read 0x%pP = 0x%02x\n", address, + ccprintf("read 0x%p = 0x%02x\n", address, *((uint8_t *)address)); break; case 2: - ccprintf("read 0x%pP = 0x%04x\n", address, + ccprintf("read 0x%p = 0x%04x\n", address, *((uint16_t *)address)); break; default: - ccprintf("read 0x%pP = 0x%08x\n", address, *address); + ccprintf("read 0x%p = 0x%08x\n", address, *address); break; } return EC_SUCCESS; @@ -169,17 +169,17 @@ static int command_read_word(int argc, char **argv) switch (access_size) { case 1: - ccprintf("write 0x%pP = 0x%02x\n", address, (uint8_t)value); + ccprintf("write 0x%p = 0x%02x\n", address, (uint8_t)value); cflush(); /* Flush before writing in case this crashes */ *((uint8_t *)address) = (uint8_t)value; break; case 2: - ccprintf("write 0x%pP = 0x%04x\n", address, (uint16_t)value); + ccprintf("write 0x%p = 0x%04x\n", address, (uint16_t)value); cflush(); *((uint16_t *)address) = (uint16_t)value; break; default: - ccprintf("write 0x%pP = 0x%02x\n", address, value); + ccprintf("write 0x%p = 0x%02x\n", address, value); cflush(); *address = value; break; diff --git a/common/printf.c b/common/printf.c index f25a5ac0b2..9a3e593cba 100644 --- a/common/printf.c +++ b/common/printf.c @@ -339,7 +339,6 @@ int vfnprintf(int (*addchar)(void *context, int c), void *context, int base = 10; uint64_t v; - int ptrspec; void *ptrval; /* @@ -390,23 +389,11 @@ int vfnprintf(int (*addchar)(void *context, int c), void *context, if (c == 'p') { c = -1; - ptrspec = *format++; ptrval = va_arg(args, void *); - /* - * %pP can accept null. - */ - if (ptrspec == 'P') { - /* %pP - Print a raw pointer. */ - v = (unsigned long)ptrval; - base = 16; - if (sizeof(unsigned long) == - sizeof(uint64_t)) - flags |= PF_64BIT; - - } else { - return EC_ERROR_INVAL; - } - + v = (unsigned long)ptrval; + base = 16; + if (sizeof(unsigned long) == sizeof(uint64_t)) + flags |= PF_64BIT; } else if (flags & PF_64BIT) { v = va_arg(args, uint64_t); } else { diff --git a/common/system.c b/common/system.c index 5e215a0b4f..1961f192e5 100644 --- a/common/system.c +++ b/common/system.c @@ -414,7 +414,7 @@ void system_disable_jump(void) */ ret = mpu_protect_data_ram(); if (ret == EC_SUCCESS) { - CPRINTS("data RAM locked. Exclusion %pP-%pP", + CPRINTS("data RAM locked. Exclusion %p-%p", &__iram_text_start, &__iram_text_end); } else { CPRINTS("Failed to lock data RAM (%d)", ret); diff --git a/common/usbc/usb_sm.c b/common/usbc/usb_sm.c index 11b2e604af..004a64321c 100644 --- a/common/usbc/usb_sm.c +++ b/common/usbc/usb_sm.c @@ -116,7 +116,7 @@ void set_state(const int port, struct sm_ctx *const ctx, * intended state to transition into. */ if (internal->exit) { - CPRINTF("C%d: Ignoring set state to 0x%pP within 0x%pP", port, + CPRINTF("C%d: Ignoring set state to 0x%p within 0x%p", port, new_state, ctx->current); return; } diff --git a/core/host/stack_trace.c b/core/host/stack_trace.c index 54163c66ad..41392e0e70 100644 --- a/core/host/stack_trace.c +++ b/core/host/stack_trace.c @@ -44,7 +44,6 @@ static void __attribute__((noinline)) _task_dump_trace_impl(int offset) for (i = 0; i < sz - offset; ++i) { fprintf(stderr, "#%-2d %s\n", i, messages[i]); - /* %p is correct (as opposed to %pP) since this is the host */ sprintf(buf, "addr2line %p -e %s", trace[i + offset], __get_prog_name()); file = popen(buf, "r"); diff --git a/include/printf.h b/include/printf.h index 48117042f9..b63208f84d 100644 --- a/include/printf.h +++ b/include/printf.h @@ -63,9 +63,7 @@ * - 'x' - unsigned integer, print as lower-case hexadecimal * - 'X' - unsigned integer, print as upper-case hexadecimal * - 'b' - unsigned integer, print as binary - * - * Special format codes: - * - '%pP' - raw pointer. + * - 'p' - pointer */ #ifndef HIDE_EC_STDLIB diff --git a/test/printf.c b/test/printf.c index 5b7f3de99e..3928185918 100644 --- a/test/printf.c +++ b/test/printf.c @@ -287,20 +287,7 @@ test_static int test_vsnprintf_pointers(void) { void *ptr = (void *)0x55005E00; - T(expect_success("55005e00", "%pP", ptr)); - T(expect_success(err_str, "%P", ptr)); - /* %p by itself is invalid */ - T(expect(EC_ERROR_INVAL, "", false, sizeof(output), "%p")); - /* %p with an unknown suffix is invalid */ - T(expect(EC_ERROR_INVAL, "", false, sizeof(output), "%p ")); - /* %p with an unknown suffix is invalid */ - T(expect(EC_ERROR_INVAL, "", false, sizeof(output), "%pQ")); - - /* - * Test %pb, which used to print binary, but is non-standard and no - * longer supported. - */ - T(expect(EC_ERROR_INVAL, "", false, sizeof(output), "%pb", 0xff)); + T(expect_success("55005e00", "%p", ptr)); return EC_SUCCESS; } @@ -341,19 +328,6 @@ test_static int test_vsnprintf_strings(void) return EC_SUCCESS; } -test_static int test_vsnprintf_timestamps(void) -{ - uint64_t ts = 0; - - /* - * Test %pT, which used to print timestamps, but is non-standard and no - * longer supported. - */ - T(expect(EC_ERROR_INVAL, "", false, sizeof(output), "%pT", &ts)); - - return EC_SUCCESS; -} - test_static int test_snprintf_timestamp(void) { char str[PRINTF_TIMESTAMP_BUF_SIZE]; @@ -412,19 +386,6 @@ test_static int test_snprintf_timestamp(void) return EC_SUCCESS; } -test_static int test_vsnprintf_hexdump(void) -{ - const char bytes[] = { 0x00, 0x5E }; - - /* - * Test %ph, which used to print buffers as hex, but is non-standard - * and no longer supported. - */ - T(expect(EC_ERROR_INVAL, "", false, sizeof(output), "%ph", - HEX_BUF(bytes, 2))); - return EC_SUCCESS; -} - test_static int test_snprintf_hex_buffer(void) { const uint8_t bytes[] = { 0xAB, 0x5E }; @@ -597,8 +558,6 @@ void run_test(int argc, char **argv) RUN_TEST(test_vsnprintf_pointers); RUN_TEST(test_vsnprintf_chars); RUN_TEST(test_vsnprintf_strings); - RUN_TEST(test_vsnprintf_timestamps); - RUN_TEST(test_vsnprintf_hexdump); RUN_TEST(test_vsnprintf_combined); RUN_TEST(test_uint64_to_str); RUN_TEST(test_snprintf_timestamp); diff --git a/test/shmalloc.c b/test/shmalloc.c index b77f720ac9..31696b2a27 100644 --- a/test/shmalloc.c +++ b/test/shmalloc.c @@ -111,7 +111,7 @@ static int check_for_overlaps(void) } } if (!allocation_match) { - ccprintf("missing match %pP!\n", allocations[i].buf); + ccprintf("missing match %p!\n", allocations[i].buf); return 0; } } @@ -136,7 +136,7 @@ static int shmem_is_ok(int line) struct shm_buffer *pbuf = free_buf_chain; if (pbuf && pbuf->prev_buffer) { - ccprintf("Bad free buffer list start %pP\n", pbuf); + ccprintf("Bad free buffer list start %p\n", pbuf); goto bailout; } @@ -152,13 +152,13 @@ static int shmem_is_ok(int line) if (pbuf->next_buffer) { if (top >= pbuf->next_buffer) { ccprintf("%s:%d" - " - inconsistent buffer size at %pP\n", + " - inconsistent buffer size at %p\n", __func__, __LINE__, pbuf); goto bailout; } if (pbuf->next_buffer->prev_buffer != pbuf) { ccprintf("%s:%d" - " - inconsistent next buffer at %pP\n", + " - inconsistent next buffer at %p\n", __func__, __LINE__, pbuf); goto bailout; } diff --git a/zephyr/shim/src/hooks.c b/zephyr/shim/src/hooks.c index 392f046c85..ddb48278b5 100644 --- a/zephyr/shim/src/hooks.c +++ b/zephyr/shim/src/hooks.c @@ -52,7 +52,7 @@ static void work_queue_error(const void *data, int rv) { cprints(CC_HOOK, "Warning: deferred call not submitted, " - "deferred_data=0x%pP, err=%d", + "deferred_data=0x%p, err=%d", data, rv); } |