From 4ba7a1502dabc4728d8e68572642dafafbd54692 Mon Sep 17 00:00:00 2001 From: Louis Yung-Chieh Lo Date: Fri, 2 May 2014 12:22:24 -0700 Subject: cleanup: add square brackets to make test parser easier This may not contain all. I filtered out possible code by the following command: find . -name "*.h*" -o -name "*.c*" | xargs grep -n CPRINTF | \ grep -v "\[" | grep -v define | less BUG=none BRANCH=none TEST=make buildall tuntests Change-Id: I674f84f5966b34aeb8d4321d22629b450627a120 Signed-off-by: Louis Yung-Chieh Lo Reviewed-on: https://chromium-review.googlesource.com/197997 --- chip/stm32/gpio-stm32f.c | 2 +- chip/stm32/gpio-stm32f0.c | 2 +- chip/stm32/gpio-stm32l.c | 2 +- chip/stm32/i2c-stm32f.c | 14 ++++++++------ chip/stm32/i2c-stm32f0.c | 2 +- chip/stm32/usb_pd_phy.c | 8 ++++---- common/button.c | 2 +- common/hooks.c | 2 +- common/i2c.c | 4 ++-- common/keyboard_mkbp.c | 2 +- common/keyboard_scan.c | 3 ++- common/pmu_tps65090.c | 2 +- common/pmu_tps65090_charger.c | 2 +- common/usb_pd_protocol.c | 34 ++++++++++++++++++---------------- driver/usb_switch_tsu6721.c | 6 +++--- 15 files changed, 46 insertions(+), 41 deletions(-) diff --git a/chip/stm32/gpio-stm32f.c b/chip/stm32/gpio-stm32f.c index eb733e470b..564ffbb56f 100644 --- a/chip/stm32/gpio-stm32f.c +++ b/chip/stm32/gpio-stm32f.c @@ -209,7 +209,7 @@ int gpio_enable_interrupt(enum gpio_signal signal) bit = 31 - __builtin_clz(g->mask); if (exti_events[bit]) { - CPRINTF("Overriding %s with %s on EXTI%d\n", + CPRINTF("[%T Overriding %s with %s on EXTI%d]\n", exti_events[bit]->name, g->name, bit); } exti_events[bit] = g; diff --git a/chip/stm32/gpio-stm32f0.c b/chip/stm32/gpio-stm32f0.c index a6d1b7b87c..0f11a65c15 100644 --- a/chip/stm32/gpio-stm32f0.c +++ b/chip/stm32/gpio-stm32f0.c @@ -210,7 +210,7 @@ int gpio_enable_interrupt(enum gpio_signal signal) bit = 31 - __builtin_clz(g->mask); if (exti_events[bit]) { - CPRINTF("Overriding %s with %s on EXTI%d\n", + CPRINTF("[%T Overriding %s with %s on EXTI%d]\n", exti_events[bit]->name, g->name, bit); } exti_events[bit] = g; diff --git a/chip/stm32/gpio-stm32l.c b/chip/stm32/gpio-stm32l.c index edc2fba652..d3aae2e31f 100644 --- a/chip/stm32/gpio-stm32l.c +++ b/chip/stm32/gpio-stm32l.c @@ -214,7 +214,7 @@ int gpio_enable_interrupt(enum gpio_signal signal) bit = 31 - __builtin_clz(g->mask); if (exti_events[bit]) { - CPRINTF("Overriding %s with %s on EXTI%d\n", + CPRINTF("[%T Overriding %s with %s on EXTI%d]\n", exti_events[bit]->name, g->name, bit); } exti_events[bit] = g; diff --git a/chip/stm32/i2c-stm32f.c b/chip/stm32/i2c-stm32f.c index 851209557b..b2d775d992 100644 --- a/chip/stm32/i2c-stm32f.c +++ b/chip/stm32/i2c-stm32f.c @@ -256,7 +256,9 @@ static void i2c_event_handler(int port) /* Confirm that you are not in master mode */ if (STM32_I2C_SR2(port) & (1 << 0)) { - CPRINTF("I2C slave ISR triggered in master mode, ignoring.\n"); + CPRINTF( + "[%T I2C slave ISR triggered in " + "master mode, ignoring]\n"); return; } @@ -314,9 +316,9 @@ static void i2c_error_handler(int port) /* ACK failed (NACK); expected when AP reads final byte. * Software must clear AF bit. */ } else { - CPRINTF("%s: I2C_SR1(%d): 0x%04x\n", + CPRINTF("[%T %s: I2C_SR1(%d): 0x%04x]\n", __func__, port, i2c_sr1[port]); - CPRINTF("%s: I2C_SR2(%d): 0x%04x\n", + CPRINTF("[%T %s: I2C_SR2(%d): 0x%04x]\n", __func__, port, STM32_I2C_SR2(port)); } @@ -550,7 +552,7 @@ static void handle_i2c_error(int port, int rv) /* EC_ERROR_TIMEOUT may have a code specifying where the timeout was */ if ((rv & 0xff) == EC_ERROR_TIMEOUT) { #ifdef CONFIG_I2C_DEBUG - CPRINTF("Wait_status() timeout type: %d\n", (rv >> 8)); + CPRINTF("[%T Wait_status() timeout type: %d]\n", (rv >> 8)); #endif rv = EC_ERROR_TIMEOUT; } @@ -572,7 +574,7 @@ static void handle_i2c_error(int port, int rv) * (Probably a stray pulse on the line got it out of sync with * the actual bytes) so reset it. */ - CPRINTF("Unable to send START, resetting i2c.\n"); + CPRINTF("[%T Unable to send START, resetting i2c]\n"); i2c_init_port(port); goto cr_cleanup; } else if (rv == EC_ERROR_TIMEOUT && !(r & 2)) { @@ -581,7 +583,7 @@ static void handle_i2c_error(int port, int rv) * It seems that this can be happen very briefly while sending * a 1. We've not actually seen this, but just to be safe. */ - CPRINTF("Bad BUSY bit detected.\n"); + CPRINTF("[%T Bad BUSY bit detected]\n"); master_stop(port); } diff --git a/chip/stm32/i2c-stm32f0.c b/chip/stm32/i2c-stm32f0.c index 1cc0c04412..3bb5419cf3 100644 --- a/chip/stm32/i2c-stm32f0.c +++ b/chip/stm32/i2c-stm32f0.c @@ -72,7 +72,7 @@ static void i2c_set_freq_port(const struct i2c_port_t *p) STM32_I2C_TIMINGR(port) = 0xB0420F13; break; default: /* unknown speed, defaults to 100kBps */ - CPRINTF("Unsupported speed %d kBps\n", p->kbps); + CPRINTF("[%T I2C bad speed %d kBps]\n", p->kbps); STM32_I2C_TIMINGR(port) = 0xB0420F13; } /* Enable port */ diff --git a/chip/stm32/usb_pd_phy.c b/chip/stm32/usb_pd_phy.c index 4a4e63b51b..bb402ee703 100644 --- a/chip/stm32/usb_pd_phy.c +++ b/chip/stm32/usb_pd_phy.c @@ -84,7 +84,7 @@ static int wait_bits(int nb) && !(STM32_TIM_SR(TIM_RX) & 4)) ; /* optimized for latency, not CPU usage ... */ if (dma_bytes_done(rx, PD_MAX_RAW_SIZE) < nb) { - CPRINTF("TMOUT RX %d/%d\n", + CPRINTF("[%T PD TMOUT RX %d/%d]\n", dma_bytes_done(rx, PD_MAX_RAW_SIZE), nb); return -1; } @@ -131,7 +131,7 @@ int pd_dequeue_bits(void *ctxt, int off, int len, uint32_t *val) return -1; } stream_err: - CPRINTF("Invalid %d @%d\n", cnt, off); + CPRINTF("[%T PD Invalid %d @%d]\n", cnt, off); return -1; } @@ -155,7 +155,7 @@ int pd_find_preamble(void *ctxt) !(STM32_TIM_SR(TIM_RX) & 4)) ; if (STM32_TIM_SR(TIM_RX) & 4) { - CPRINTF("TMOUT RX %d/%d\n", + CPRINTF("[%T PD TMOUT RX %d/%d]\n", PD_MAX_RAW_SIZE - rx->cndtr, bit); return -1; } @@ -524,7 +524,7 @@ void *pd_hw_init(void) STM32_EXTI_IMR |= EXTI_COMP_MASK; task_enable_irq(IRQ_COMP); - CPRINTF("USB PD initialized\n"); + CPRINTF("[%T USB PD initialized]\n"); return raw_samples; } diff --git a/common/button.c b/common/button.c index 32f2bd255b..ea17cea88f 100644 --- a/common/button.c +++ b/common/button.c @@ -44,7 +44,7 @@ static void button_init(void) { int i; - CPRINTF("[%T (re)initializing buttons and interrupts.]\n"); + CPRINTF("[%T (re)initializing buttons and interrupts]\n"); next_deferred_time = 0; for (i = 0; i < CONFIG_BUTTON_COUNT; i++) { state[i].debounced_pressed = raw_button_pressed(&buttons[i]); diff --git a/common/hooks.c b/common/hooks.c index 3d6ccb695f..b7086a866b 100644 --- a/common/hooks.c +++ b/common/hooks.c @@ -83,7 +83,7 @@ static void record_hook_delay(uint64_t now, uint64_t last, uint64_t interval, /* Warn if delayed by more than 10% */ if (delayed * 10 > interval) - CPRINTF("Hook at interval %d us delayed by %d us\n", + CPRINTF("[%T Hook at interval %d us delayed by %d us]\n", (uint32_t)interval, (uint32_t)delayed); } #endif diff --git a/common/i2c.c b/common/i2c.c index 8667bff1cf..e90644e51a 100644 --- a/common/i2c.c +++ b/common/i2c.c @@ -269,7 +269,7 @@ int i2c_unwedge(int port) * If we get here, a slave is holding the clock low and there * is nothing we can do. */ - CPRINTF("[%T I2C unwedge failed, SCL is being held low.]\n"); + CPRINTF("[%T I2C unwedge failed, SCL is being held low]\n"); ret = EC_ERROR_UNKNOWN; goto unwedge_done; } @@ -277,7 +277,7 @@ int i2c_unwedge(int port) if (i2c_raw_get_sda(port)) goto unwedge_done; - CPRINTF("[%T I2C unwedge called with SDA held low.]\n"); + CPRINTF("[%T I2C unwedge called with SDA held low]\n"); /* Keep trying to unwedge the SDA line until we run out of attempts. */ for (i = 0; i < UNWEDGE_SDA_ATTEMPTS; i++) { diff --git a/common/keyboard_mkbp.c b/common/keyboard_mkbp.c index d5343cdf36..4b1f479d5f 100644 --- a/common/keyboard_mkbp.c +++ b/common/keyboard_mkbp.c @@ -111,7 +111,7 @@ void keyboard_clear_buffer(void) { int i; - CPRINTF("clearing keyboard fifo\n"); + CPRINTF("[clearing keyboard fifo]\n"); kb_fifo_start = 0; kb_fifo_end = 0; diff --git a/common/keyboard_scan.c b/common/keyboard_scan.c index 6214f0934e..9007f4dff6 100644 --- a/common/keyboard_scan.c +++ b/common/keyboard_scan.c @@ -438,13 +438,14 @@ static int check_keys_changed(uint8_t *state) #ifdef PRINT_SCAN_TIMES /* Print delta times from now back to each previous scan */ + CPRINTF("[%T kb deltaT"); for (i = 0; i < SCAN_TIME_COUNT; i++) { int tnew = scan_time[ (SCAN_TIME_COUNT + scan_time_index - i) % SCAN_TIME_COUNT]; CPRINTF(" %d", tnow - tnew); } - CPRINTF("\n"); + CPRINTF("]\n"); #endif /* Swallow special keys */ diff --git a/common/pmu_tps65090.c b/common/pmu_tps65090.c index cf075c62d0..05b446eb4c 100644 --- a/common/pmu_tps65090.c +++ b/common/pmu_tps65090.c @@ -153,7 +153,7 @@ static int pmu_get_event(int *event) *event = irq1 | (irq2 << 8); if (prev_event != *event) { - CPRINTF("pmu event: %016b\n", *event); + CPRINTF("[%T pmu event: %016b]\n", *event); prev_event = *event; } diff --git a/common/pmu_tps65090_charger.c b/common/pmu_tps65090_charger.c index 69ce2a9c26..374371a109 100644 --- a/common/pmu_tps65090_charger.c +++ b/common/pmu_tps65090_charger.c @@ -573,6 +573,6 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, pmu_chipset_events, HOOK_PRIO_DEFAULT); void pmu_irq_handler(enum gpio_signal signal) { pmu_task_throttled_wake(); - CPRINTF("Charger IRQ received.\n"); + CPRINTF("[%T Charger IRQ received]\n"); } diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index eee328f046..08381dcf2f 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -312,13 +312,14 @@ static int send_validate_message(void *ctxt, uint16_t header, uint8_t cnt, udelay(10); return bit_len; } else { - /* CPRINTF("ERR ACK/%d %04x\n", id, head); */ + /* CPRINTF("[%T PD ERR ACK/%d %04x]\n", + id, head); */ } } } /* we failed all the re-transmissions */ /* TODO: try HardReset */ - CPRINTF("TX NO ACK %04x/%d\n", header, cnt); + CPRINTF("[%T PD TX NO ACK %04x/%d]\n", header, cnt); return -1; } @@ -329,7 +330,7 @@ static int send_control(void *ctxt, int type) bit_len = send_validate_message(ctxt, header, 0, NULL); - CPRINTF("CTRL[%d]>%d\n", type, bit_len); + CPRINTF("[%T PD CTRL[%d]>%d]\n", type, bit_len); return bit_len; } @@ -351,7 +352,7 @@ static int send_source_cap(void *ctxt) bit_len = send_validate_message(ctxt, header, pd_src_pdo_cnt, pd_src_pdo); - CPRINTF("srcCAP>%d\n", bit_len); + CPRINTF("[%T PD srcCAP>%d]\n", bit_len); return bit_len; } @@ -365,7 +366,7 @@ static void send_sink_cap(void *ctxt) bit_len = send_validate_message(ctxt, header, pd_snk_pdo_cnt, pd_snk_pdo); - CPRINTF("snkCAP>%d\n", bit_len); + CPRINTF("[%T PD snkCAP>%d]\n", bit_len); } static int send_request(void *ctxt, uint32_t rdo) @@ -374,7 +375,7 @@ static int send_request(void *ctxt, uint32_t rdo) uint16_t header = PD_HEADER(PD_DATA_REQUEST, pd_role, pd_message_id, 1); bit_len = send_validate_message(ctxt, header, 1, &rdo); - CPRINTF("REQ%d>\n", bit_len); + CPRINTF("[%T PD REQ%d>]\n", bit_len); return bit_len; } @@ -387,14 +388,14 @@ static int send_bist(void *ctxt) uint16_t header = PD_HEADER(PD_DATA_BIST, pd_role, pd_message_id, 1); bit_len = send_validate_message(ctxt, header, 1, &bdo); - CPRINTF("BIST>%d\n", bit_len); + CPRINTF("[%T PD BIST>%d]\n", bit_len); return bit_len; } static void handle_vdm_request(void *ctxt, int cnt, uint32_t *payload) { - CPRINTF("Unhandled VDM VID %04x CMD %04x\n", payload[0] >> 16, + CPRINTF("[%T PD Unhandled VDM VID %04x CMD %04x]\n", payload[0] >> 16, payload[0] & 0xFFFF); } @@ -438,7 +439,7 @@ static void handle_data_request(void *ctxt, uint16_t head, uint32_t *payload) send_control(ctxt, PD_CTRL_REJECT); break; case PD_DATA_BIST: - CPRINTF("BIST not supported\n"); + CPRINTF("[%T PD BIST not supported]\n"); break; case PD_DATA_SINK_CAP: break; @@ -446,7 +447,7 @@ static void handle_data_request(void *ctxt, uint16_t head, uint32_t *payload) handle_vdm_request(ctxt, cnt, payload); break; default: - CPRINTF("Unhandled data message type %d\n", type); + CPRINTF("[%T PD unhandled data message type %d]\n", type); } } @@ -484,7 +485,7 @@ static void handle_ctrl_request(void *ctxt, uint16_t head, uint32_t *payload) case PD_CTRL_WAIT: case PD_CTRL_SOFT_RESET: default: - CPRINTF("Unhandled ctrl message type %d\n", type); + CPRINTF("[%T PD unhandled ctrl message type %d]\n", type); } } @@ -497,10 +498,10 @@ static void handle_request(void *ctxt, uint16_t head, uint32_t *payload) send_goodcrc(ctxt, PD_HEADER_ID(head)); /* dump received packet content */ - CPRINTF("RECV %04x/%d ", head, cnt); + CPRINTF("[%T PD RECV %04x/%d ", head, cnt); for (p = 0; p < cnt; p++) CPRINTF("[%d]%08x ", p, payload[p]); - CPRINTF("\n"); + CPRINTF("]\n"); if (cnt) handle_data_request(ctxt, head, payload); @@ -590,7 +591,8 @@ static int analyze_rx(uint32_t *payload) msg = "CRC"; if (pcrc != ccrc) bit = PD_ERR_CRC; - /* DEBUG */CPRINTF("CRC %08x <> %08x\n", pcrc, crc32_result()); + /* DEBUG */ + CPRINTF("[%T PD CRC %08x <> %08x]\n", pcrc, crc32_result()); goto packet_err; } @@ -608,7 +610,7 @@ packet_err: if (debug_dump) pd_dump_packet(ctxt, msg); else - CPRINTF("RX ERR (%d)\n", bit); + CPRINTF("[%T PD RX ERR (%d)]\n", bit); return bit; } @@ -622,7 +624,7 @@ static void execute_hard_reset(void) pd_task_state = PD_STATE_SRC_DISCONNECTED; #endif pd_power_supply_reset(); - CPRINTF("HARD RESET!\n"); + CPRINTF("[%T PD HARD RESET!]\n"); } void pd_task(void) diff --git a/driver/usb_switch_tsu6721.c b/driver/usb_switch_tsu6721.c index f31641aeb4..2335df6051 100644 --- a/driver/usb_switch_tsu6721.c +++ b/driver/usb_switch_tsu6721.c @@ -102,7 +102,7 @@ void tsu6721_reset(void) for (i = 0; i < TSU6721_SW_RESET_RETRY; ++i) { if (i != 0) { - CPRINTF("[%T TSU6721 init failed. Retrying.]\n"); + CPRINTF("[%T TSU6721 init failed. Retrying]\n"); msleep(500); } if (tsu6721_write(TSU6721_REG_RESET, 0x1)) @@ -127,7 +127,7 @@ int tsu6721_mux(enum tsu6721_mux sel) * something known on the ID pin */ if (sel != TSU6721_MUX_AUTO && (id == 0x1f) && !vbus1 && !vbus3) { - CPRINTF("TSU6721 cannot use manual mode: no VBUS or ID\n"); + CPRINTF("[%T TSU6721 cannot use manual mode: no VBUS or ID]\n"); return EC_ERROR_INVAL; } @@ -148,7 +148,7 @@ int tsu6721_init(void) int res = 0; if ((dev_id != 0x0a) && (dev_id != 0x12)) { - CPRINTF("TSU6721 invalid device ID 0x%02x\n", dev_id); + CPRINTF("[%T TSU6721 invalid device ID 0x%02x]\n", dev_id); return EC_ERROR_UNKNOWN; } -- cgit v1.2.1