Commit d2561626 authored by Lu Baolu's avatar Lu Baolu Committed by Greg Kroah-Hartman

usb: xhci: refine xhci_decode_trb()

Replace 'TRB_FIELD_TO_TYPE(field3)' with 'type' to simplify
code.
Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 96d9a6eb
...@@ -2137,7 +2137,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, ...@@ -2137,7 +2137,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2,
sprintf(str, sprintf(str,
"LINK %08x%08x intr %d type '%s' flags %c:%c:%c:%c", "LINK %08x%08x intr %d type '%s' flags %c:%c:%c:%c",
field1, field0, GET_INTR_TARGET(field2), field1, field0, GET_INTR_TARGET(field2),
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
field3 & TRB_IOC ? 'I' : 'i', field3 & TRB_IOC ? 'I' : 'i',
field3 & TRB_CHAIN ? 'C' : 'c', field3 & TRB_CHAIN ? 'C' : 'c',
field3 & TRB_TC ? 'T' : 't', field3 & TRB_TC ? 'T' : 't',
...@@ -2158,7 +2158,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, ...@@ -2158,7 +2158,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2,
EVENT_TRB_LEN(field2), TRB_TO_SLOT_ID(field3), EVENT_TRB_LEN(field2), TRB_TO_SLOT_ID(field3),
/* Macro decrements 1, maybe it shouldn't?!? */ /* Macro decrements 1, maybe it shouldn't?!? */
TRB_TO_EP_INDEX(field3) + 1, TRB_TO_EP_INDEX(field3) + 1,
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
field3 & EVENT_DATA ? 'E' : 'e', field3 & EVENT_DATA ? 'E' : 'e',
field3 & TRB_CYCLE ? 'C' : 'c'); field3 & TRB_CYCLE ? 'C' : 'c');
...@@ -2175,7 +2175,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, ...@@ -2175,7 +2175,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2,
(field1 & 0xff0000) >> 16, (field1 & 0xff0000) >> 16,
TRB_LEN(field2), GET_TD_SIZE(field2), TRB_LEN(field2), GET_TD_SIZE(field2),
GET_INTR_TARGET(field2), GET_INTR_TARGET(field2),
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
field3 & TRB_IDT ? 'I' : 'i', field3 & TRB_IDT ? 'I' : 'i',
field3 & TRB_IOC ? 'I' : 'i', field3 & TRB_IOC ? 'I' : 'i',
field3 & TRB_CYCLE ? 'C' : 'c'); field3 & TRB_CYCLE ? 'C' : 'c');
...@@ -2184,7 +2184,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, ...@@ -2184,7 +2184,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2,
sprintf(str, "Buffer %08x%08x length %d TD size %d intr %d type '%s' flags %c:%c:%c:%c:%c:%c:%c", sprintf(str, "Buffer %08x%08x length %d TD size %d intr %d type '%s' flags %c:%c:%c:%c:%c:%c:%c",
field1, field0, TRB_LEN(field2), GET_TD_SIZE(field2), field1, field0, TRB_LEN(field2), GET_TD_SIZE(field2),
GET_INTR_TARGET(field2), GET_INTR_TARGET(field2),
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
field3 & TRB_IDT ? 'I' : 'i', field3 & TRB_IDT ? 'I' : 'i',
field3 & TRB_IOC ? 'I' : 'i', field3 & TRB_IOC ? 'I' : 'i',
field3 & TRB_CHAIN ? 'C' : 'c', field3 & TRB_CHAIN ? 'C' : 'c',
...@@ -2197,7 +2197,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, ...@@ -2197,7 +2197,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2,
sprintf(str, "Buffer %08x%08x length %d TD size %d intr %d type '%s' flags %c:%c:%c:%c", sprintf(str, "Buffer %08x%08x length %d TD size %d intr %d type '%s' flags %c:%c:%c:%c",
field1, field0, TRB_LEN(field2), GET_TD_SIZE(field2), field1, field0, TRB_LEN(field2), GET_TD_SIZE(field2),
GET_INTR_TARGET(field2), GET_INTR_TARGET(field2),
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
field3 & TRB_IOC ? 'I' : 'i', field3 & TRB_IOC ? 'I' : 'i',
field3 & TRB_CHAIN ? 'C' : 'c', field3 & TRB_CHAIN ? 'C' : 'c',
field3 & TRB_ENT ? 'E' : 'e', field3 & TRB_ENT ? 'E' : 'e',
...@@ -2211,7 +2211,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, ...@@ -2211,7 +2211,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2,
"Buffer %08x%08x length %d TD size %d intr %d type '%s' flags %c:%c:%c:%c:%c:%c:%c:%c", "Buffer %08x%08x length %d TD size %d intr %d type '%s' flags %c:%c:%c:%c:%c:%c:%c:%c",
field1, field0, TRB_LEN(field2), GET_TD_SIZE(field2), field1, field0, TRB_LEN(field2), GET_TD_SIZE(field2),
GET_INTR_TARGET(field2), GET_INTR_TARGET(field2),
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
field3 & TRB_BEI ? 'B' : 'b', field3 & TRB_BEI ? 'B' : 'b',
field3 & TRB_IDT ? 'I' : 'i', field3 & TRB_IDT ? 'I' : 'i',
field3 & TRB_IOC ? 'I' : 'i', field3 & TRB_IOC ? 'I' : 'i',
...@@ -2226,21 +2226,21 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, ...@@ -2226,21 +2226,21 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2,
case TRB_ENABLE_SLOT: case TRB_ENABLE_SLOT:
sprintf(str, sprintf(str,
"%s: flags %c", "%s: flags %c",
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
field3 & TRB_CYCLE ? 'C' : 'c'); field3 & TRB_CYCLE ? 'C' : 'c');
break; break;
case TRB_DISABLE_SLOT: case TRB_DISABLE_SLOT:
case TRB_NEG_BANDWIDTH: case TRB_NEG_BANDWIDTH:
sprintf(str, sprintf(str,
"%s: slot %d flags %c", "%s: slot %d flags %c",
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
TRB_TO_SLOT_ID(field3), TRB_TO_SLOT_ID(field3),
field3 & TRB_CYCLE ? 'C' : 'c'); field3 & TRB_CYCLE ? 'C' : 'c');
break; break;
case TRB_ADDR_DEV: case TRB_ADDR_DEV:
sprintf(str, sprintf(str,
"%s: ctx %08x%08x slot %d flags %c:%c", "%s: ctx %08x%08x slot %d flags %c:%c",
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
field1, field0, field1, field0,
TRB_TO_SLOT_ID(field3), TRB_TO_SLOT_ID(field3),
field3 & TRB_BSR ? 'B' : 'b', field3 & TRB_BSR ? 'B' : 'b',
...@@ -2249,7 +2249,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, ...@@ -2249,7 +2249,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2,
case TRB_CONFIG_EP: case TRB_CONFIG_EP:
sprintf(str, sprintf(str,
"%s: ctx %08x%08x slot %d flags %c:%c", "%s: ctx %08x%08x slot %d flags %c:%c",
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
field1, field0, field1, field0,
TRB_TO_SLOT_ID(field3), TRB_TO_SLOT_ID(field3),
field3 & TRB_DC ? 'D' : 'd', field3 & TRB_DC ? 'D' : 'd',
...@@ -2258,7 +2258,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, ...@@ -2258,7 +2258,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2,
case TRB_EVAL_CONTEXT: case TRB_EVAL_CONTEXT:
sprintf(str, sprintf(str,
"%s: ctx %08x%08x slot %d flags %c", "%s: ctx %08x%08x slot %d flags %c",
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
field1, field0, field1, field0,
TRB_TO_SLOT_ID(field3), TRB_TO_SLOT_ID(field3),
field3 & TRB_CYCLE ? 'C' : 'c'); field3 & TRB_CYCLE ? 'C' : 'c');
...@@ -2266,7 +2266,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, ...@@ -2266,7 +2266,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2,
case TRB_RESET_EP: case TRB_RESET_EP:
sprintf(str, sprintf(str,
"%s: ctx %08x%08x slot %d ep %d flags %c", "%s: ctx %08x%08x slot %d ep %d flags %c",
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
field1, field0, field1, field0,
TRB_TO_SLOT_ID(field3), TRB_TO_SLOT_ID(field3),
/* Macro decrements 1, maybe it shouldn't?!? */ /* Macro decrements 1, maybe it shouldn't?!? */
...@@ -2276,7 +2276,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, ...@@ -2276,7 +2276,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2,
case TRB_STOP_RING: case TRB_STOP_RING:
sprintf(str, sprintf(str,
"%s: slot %d sp %d ep %d flags %c", "%s: slot %d sp %d ep %d flags %c",
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
TRB_TO_SLOT_ID(field3), TRB_TO_SLOT_ID(field3),
TRB_TO_SUSPEND_PORT(field3), TRB_TO_SUSPEND_PORT(field3),
/* Macro decrements 1, maybe it shouldn't?!? */ /* Macro decrements 1, maybe it shouldn't?!? */
...@@ -2286,7 +2286,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, ...@@ -2286,7 +2286,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2,
case TRB_SET_DEQ: case TRB_SET_DEQ:
sprintf(str, sprintf(str,
"%s: deq %08x%08x stream %d slot %d ep %d flags %c", "%s: deq %08x%08x stream %d slot %d ep %d flags %c",
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
field1, field0, field1, field0,
TRB_TO_STREAM_ID(field2), TRB_TO_STREAM_ID(field2),
TRB_TO_SLOT_ID(field3), TRB_TO_SLOT_ID(field3),
...@@ -2297,14 +2297,14 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, ...@@ -2297,14 +2297,14 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2,
case TRB_RESET_DEV: case TRB_RESET_DEV:
sprintf(str, sprintf(str,
"%s: slot %d flags %c", "%s: slot %d flags %c",
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
TRB_TO_SLOT_ID(field3), TRB_TO_SLOT_ID(field3),
field3 & TRB_CYCLE ? 'C' : 'c'); field3 & TRB_CYCLE ? 'C' : 'c');
break; break;
case TRB_FORCE_EVENT: case TRB_FORCE_EVENT:
sprintf(str, sprintf(str,
"%s: event %08x%08x vf intr %d vf id %d flags %c", "%s: event %08x%08x vf intr %d vf id %d flags %c",
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
field1, field0, field1, field0,
TRB_TO_VF_INTR_TARGET(field2), TRB_TO_VF_INTR_TARGET(field2),
TRB_TO_VF_ID(field3), TRB_TO_VF_ID(field3),
...@@ -2313,14 +2313,14 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, ...@@ -2313,14 +2313,14 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2,
case TRB_SET_LT: case TRB_SET_LT:
sprintf(str, sprintf(str,
"%s: belt %d flags %c", "%s: belt %d flags %c",
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
TRB_TO_BELT(field3), TRB_TO_BELT(field3),
field3 & TRB_CYCLE ? 'C' : 'c'); field3 & TRB_CYCLE ? 'C' : 'c');
break; break;
case TRB_GET_BW: case TRB_GET_BW:
sprintf(str, sprintf(str,
"%s: ctx %08x%08x slot %d speed %d flags %c", "%s: ctx %08x%08x slot %d speed %d flags %c",
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
field1, field0, field1, field0,
TRB_TO_SLOT_ID(field3), TRB_TO_SLOT_ID(field3),
TRB_TO_DEV_SPEED(field3), TRB_TO_DEV_SPEED(field3),
...@@ -2329,7 +2329,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, ...@@ -2329,7 +2329,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2,
case TRB_FORCE_HEADER: case TRB_FORCE_HEADER:
sprintf(str, sprintf(str,
"%s: info %08x%08x%08x pkt type %d roothub port %d flags %c", "%s: info %08x%08x%08x pkt type %d roothub port %d flags %c",
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
field2, field1, field0 & 0xffffffe0, field2, field1, field0 & 0xffffffe0,
TRB_TO_PACKET_TYPE(field0), TRB_TO_PACKET_TYPE(field0),
TRB_TO_ROOTHUB_PORT(field3), TRB_TO_ROOTHUB_PORT(field3),
...@@ -2338,7 +2338,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, ...@@ -2338,7 +2338,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2,
default: default:
sprintf(str, sprintf(str,
"type '%s' -> raw %08x %08x %08x %08x", "type '%s' -> raw %08x %08x %08x %08x",
xhci_trb_type_string(TRB_FIELD_TO_TYPE(field3)), xhci_trb_type_string(type),
field0, field1, field2, field3); field0, field1, field2, field3);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment