diff options
Diffstat (limited to 'drivers/usb/cdns3/cdnsp-debug.h')
| -rw-r--r-- | drivers/usb/cdns3/cdnsp-debug.h | 105 |
1 files changed, 53 insertions, 52 deletions
diff --git a/drivers/usb/cdns3/cdnsp-debug.h b/drivers/usb/cdns3/cdnsp-debug.h index a8776df2d4e0..86860686d836 100644 --- a/drivers/usb/cdns3/cdnsp-debug.h +++ b/drivers/usb/cdns3/cdnsp-debug.h @@ -131,8 +131,6 @@ static inline const char *cdnsp_trb_type_string(u8 type) return "Endpoint Not ready"; case TRB_HALT_ENDPOINT: return "Halt Endpoint"; - case TRB_FLUSH_ENDPOINT: - return "FLush Endpoint"; default: return "UNKNOWN"; } @@ -182,14 +180,14 @@ static inline const char *cdnsp_decode_trb(char *str, size_t size, u32 field0, int ep_id = TRB_TO_EP_INDEX(field3) - 1; int type = TRB_FIELD_TO_TYPE(field3); unsigned int ep_num; - int ret = 0; + int ret; u32 temp; ep_num = DIV_ROUND_UP(ep_id, 2); switch (type) { case TRB_LINK: - ret += snprintf(str, size, + ret = scnprintf(str, size, "LINK %08x%08x intr %ld type '%s' flags %c:%c:%c:%c", field1, field0, GET_INTR_TARGET(field2), cdnsp_trb_type_string(type), @@ -202,7 +200,7 @@ static inline const char *cdnsp_decode_trb(char *str, size_t size, u32 field0, case TRB_COMPLETION: case TRB_PORT_STATUS: case TRB_HC_EVENT: - ret += snprintf(str, size, + ret = scnprintf(str, size, "ep%d%s(%d) type '%s' TRB %08x%08x status '%s'" " len %ld slot %ld flags %c:%c", ep_num, ep_id % 2 ? "out" : "in", @@ -214,12 +212,12 @@ static inline const char *cdnsp_decode_trb(char *str, size_t size, u32 field0, field3 & TRB_CYCLE ? 'C' : 'c'); break; case TRB_MFINDEX_WRAP: - ret += snprintf(str, size, "%s: flags %c", + ret = scnprintf(str, size, "%s: flags %c", cdnsp_trb_type_string(type), field3 & TRB_CYCLE ? 'C' : 'c'); break; case TRB_SETUP: - ret += snprintf(str, size, + ret = scnprintf(str, size, "type '%s' bRequestType %02x bRequest %02x " "wValue %02x%02x wIndex %02x%02x wLength %d " "length %ld TD size %ld intr %ld Setup ID %ld " @@ -241,7 +239,7 @@ static inline const char *cdnsp_decode_trb(char *str, size_t size, u32 field0, field3 & TRB_CYCLE ? 'C' : 'c'); break; case TRB_DATA: - ret += snprintf(str, size, + ret = scnprintf(str, size, "type '%s' Buffer %08x%08x length %ld TD size %ld " "intr %ld flags %c:%c:%c:%c:%c:%c:%c", cdnsp_trb_type_string(type), @@ -257,7 +255,7 @@ static inline const char *cdnsp_decode_trb(char *str, size_t size, u32 field0, field3 & TRB_CYCLE ? 'C' : 'c'); break; case TRB_STATUS: - ret += snprintf(str, size, + ret = scnprintf(str, size, "Buffer %08x%08x length %ld TD size %ld intr" "%ld type '%s' flags %c:%c:%c:%c", field1, field0, TRB_LEN(field2), @@ -273,7 +271,7 @@ static inline const char *cdnsp_decode_trb(char *str, size_t size, u32 field0, case TRB_ISOC: case TRB_EVENT_DATA: case TRB_TR_NOOP: - ret += snprintf(str, size, + ret = scnprintf(str, size, "type '%s' Buffer %08x%08x length %ld " "TD size %ld intr %ld " "flags %c:%c:%c:%c:%c:%c:%c:%c:%c", @@ -293,18 +291,18 @@ static inline const char *cdnsp_decode_trb(char *str, size_t size, u32 field0, break; case TRB_CMD_NOOP: case TRB_ENABLE_SLOT: - ret += snprintf(str, size, "%s: flags %c", + ret = scnprintf(str, size, "%s: flags %c", cdnsp_trb_type_string(type), field3 & TRB_CYCLE ? 'C' : 'c'); break; case TRB_DISABLE_SLOT: - ret += snprintf(str, size, "%s: slot %ld flags %c", + ret = scnprintf(str, size, "%s: slot %ld flags %c", cdnsp_trb_type_string(type), TRB_TO_SLOT_ID(field3), field3 & TRB_CYCLE ? 'C' : 'c'); break; case TRB_ADDR_DEV: - ret += snprintf(str, size, + ret = scnprintf(str, size, "%s: ctx %08x%08x slot %ld flags %c:%c", cdnsp_trb_type_string(type), field1, field0, TRB_TO_SLOT_ID(field3), @@ -312,7 +310,7 @@ static inline const char *cdnsp_decode_trb(char *str, size_t size, u32 field0, field3 & TRB_CYCLE ? 'C' : 'c'); break; case TRB_CONFIG_EP: - ret += snprintf(str, size, + ret = scnprintf(str, size, "%s: ctx %08x%08x slot %ld flags %c:%c", cdnsp_trb_type_string(type), field1, field0, TRB_TO_SLOT_ID(field3), @@ -320,7 +318,7 @@ static inline const char *cdnsp_decode_trb(char *str, size_t size, u32 field0, field3 & TRB_CYCLE ? 'C' : 'c'); break; case TRB_EVAL_CONTEXT: - ret += snprintf(str, size, + ret = scnprintf(str, size, "%s: ctx %08x%08x slot %ld flags %c", cdnsp_trb_type_string(type), field1, field0, TRB_TO_SLOT_ID(field3), @@ -328,17 +326,17 @@ static inline const char *cdnsp_decode_trb(char *str, size_t size, u32 field0, break; case TRB_RESET_EP: case TRB_HALT_ENDPOINT: - case TRB_FLUSH_ENDPOINT: - ret += snprintf(str, size, - "%s: ep%d%s(%d) ctx %08x%08x slot %ld flags %c", + ret = scnprintf(str, size, + "%s: ep%d%s(%d) ctx %08x%08x slot %ld flags %c %c", cdnsp_trb_type_string(type), ep_num, ep_id % 2 ? "out" : "in", TRB_TO_EP_INDEX(field3), field1, field0, TRB_TO_SLOT_ID(field3), - field3 & TRB_CYCLE ? 'C' : 'c'); + field3 & TRB_CYCLE ? 'C' : 'c', + field3 & TRB_ESP ? 'P' : 'p'); break; case TRB_STOP_RING: - ret += snprintf(str, size, + ret = scnprintf(str, size, "%s: ep%d%s(%d) slot %ld sp %d flags %c", cdnsp_trb_type_string(type), ep_num, ep_id % 2 ? "out" : "in", @@ -348,7 +346,7 @@ static inline const char *cdnsp_decode_trb(char *str, size_t size, u32 field0, field3 & TRB_CYCLE ? 'C' : 'c'); break; case TRB_SET_DEQ: - ret += snprintf(str, size, + ret = scnprintf(str, size, "%s: ep%d%s(%d) deq %08x%08x stream %ld slot %ld flags %c", cdnsp_trb_type_string(type), ep_num, ep_id % 2 ? "out" : "in", @@ -358,15 +356,15 @@ static inline const char *cdnsp_decode_trb(char *str, size_t size, u32 field0, field3 & TRB_CYCLE ? 'C' : 'c'); break; case TRB_RESET_DEV: - ret += snprintf(str, size, "%s: slot %ld flags %c", + ret = scnprintf(str, size, "%s: slot %ld flags %c", cdnsp_trb_type_string(type), TRB_TO_SLOT_ID(field3), field3 & TRB_CYCLE ? 'C' : 'c'); break; case TRB_ENDPOINT_NRDY: - temp = TRB_TO_HOST_STREAM(field2); + temp = TRB_TO_HOST_STREAM(field2); - ret += snprintf(str, size, + ret = scnprintf(str, size, "%s: ep%d%s(%d) H_SID %x%s%s D_SID %lx flags %c:%c", cdnsp_trb_type_string(type), ep_num, ep_id % 2 ? "out" : "in", @@ -378,12 +376,15 @@ static inline const char *cdnsp_decode_trb(char *str, size_t size, u32 field0, field3 & TRB_CYCLE ? 'C' : 'c'); break; default: - ret += snprintf(str, size, + ret = scnprintf(str, size, "type '%s' -> raw %08x %08x %08x %08x", cdnsp_trb_type_string(type), field0, field1, field2, field3); } + if (ret == size - 1) + pr_info("CDNSP: buffer may be truncated.\n"); + return str; } @@ -465,32 +466,32 @@ static inline const char *cdnsp_decode_portsc(char *str, size_t size, { int ret; - ret = snprintf(str, size, "%s %s %s Link:%s PortSpeed:%d ", - portsc & PORT_POWER ? "Powered" : "Powered-off", - portsc & PORT_CONNECT ? "Connected" : "Not-connected", - portsc & PORT_PED ? "Enabled" : "Disabled", - cdnsp_portsc_link_state_string(portsc), - DEV_PORT_SPEED(portsc)); + ret = scnprintf(str, size, "%s %s %s Link:%s PortSpeed:%d ", + portsc & PORT_POWER ? "Powered" : "Powered-off", + portsc & PORT_CONNECT ? "Connected" : "Not-connected", + portsc & PORT_PED ? "Enabled" : "Disabled", + cdnsp_portsc_link_state_string(portsc), + DEV_PORT_SPEED(portsc)); if (portsc & PORT_RESET) - ret += snprintf(str + ret, size - ret, "In-Reset "); + ret += scnprintf(str + ret, size - ret, "In-Reset "); - ret += snprintf(str + ret, size - ret, "Change: "); + ret += scnprintf(str + ret, size - ret, "Change: "); if (portsc & PORT_CSC) - ret += snprintf(str + ret, size - ret, "CSC "); + ret += scnprintf(str + ret, size - ret, "CSC "); if (portsc & PORT_WRC) - ret += snprintf(str + ret, size - ret, "WRC "); + ret += scnprintf(str + ret, size - ret, "WRC "); if (portsc & PORT_RC) - ret += snprintf(str + ret, size - ret, "PRC "); + ret += scnprintf(str + ret, size - ret, "PRC "); if (portsc & PORT_PLC) - ret += snprintf(str + ret, size - ret, "PLC "); + ret += scnprintf(str + ret, size - ret, "PLC "); if (portsc & PORT_CEC) - ret += snprintf(str + ret, size - ret, "CEC "); - ret += snprintf(str + ret, size - ret, "Wake: "); + ret += scnprintf(str + ret, size - ret, "CEC "); + ret += scnprintf(str + ret, size - ret, "Wake: "); if (portsc & PORT_WKCONN_E) - ret += snprintf(str + ret, size - ret, "WCE "); + ret += scnprintf(str + ret, size - ret, "WCE "); if (portsc & PORT_WKDISC_E) - ret += snprintf(str + ret, size - ret, "WDE "); + ret += scnprintf(str + ret, size - ret, "WDE "); return str; } @@ -562,20 +563,20 @@ static inline const char *cdnsp_decode_ep_context(char *str, size_t size, avg = EP_AVG_TRB_LENGTH(tx_info); - ret = snprintf(str, size, "State %s mult %d max P. Streams %d %s", - cdnsp_ep_state_string(ep_state), mult, - max_pstr, lsa ? "LSA " : ""); + ret = scnprintf(str, size, "State %s mult %d max P. Streams %d %s", + cdnsp_ep_state_string(ep_state), mult, + max_pstr, lsa ? "LSA " : ""); - ret += snprintf(str + ret, size - ret, - "interval %d us max ESIT payload %d CErr %d ", - (1 << interval) * 125, esit, cerr); + ret += scnprintf(str + ret, size - ret, + "interval %d us max ESIT payload %d CErr %d ", + (1 << interval) * 125, esit, cerr); - ret += snprintf(str + ret, size - ret, - "Type %s %sburst %d maxp %d deq %016llx ", - cdnsp_ep_type_string(ep_type), hid ? "HID" : "", - burst, maxp, deq); + ret += scnprintf(str + ret, size - ret, + "Type %s %sburst %d maxp %d deq %016llx ", + cdnsp_ep_type_string(ep_type), hid ? "HID" : "", + burst, maxp, deq); - ret += snprintf(str + ret, size - ret, "avg trb len %d", avg); + ret += scnprintf(str + ret, size - ret, "avg trb len %d", avg); return str; } |
