usb: host: xhci: combine event TRB completion debugging messages
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 23 Jan 2017 12:20:18 +0000 (14:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Jan 2017 10:00:01 +0000 (11:00 +0100)
If we just provide a helper to convert completion code to string, we can
combine all debugging messages into a single print.

[keep the old debug messages, for warn and grep -Mathias]
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci.h

index aa63e386b51de3cbd600ad5013fe4e7a03bb4c45..ebdd920fc9584f544967e69e581f1afa5a528fe4 100644 (file)
@@ -1097,6 +1097,86 @@ struct xhci_transfer_event {
 #define COMP_SECONDARY_BANDWIDTH_ERROR         35
 #define COMP_SPLIT_TRANSACTION_ERROR           36
 
+static inline const char *xhci_trb_comp_code_string(u8 status)
+{
+       switch (status) {
+       case COMP_INVALID:
+               return "Invalid";
+       case COMP_SUCCESS:
+               return "Success";
+       case COMP_DATA_BUFFER_ERROR:
+               return "Data Buffer Error";
+       case COMP_BABBLE_DETECTED_ERROR:
+               return "Babble Detected";
+       case COMP_USB_TRANSACTION_ERROR:
+               return "USB Transaction Error";
+       case COMP_TRB_ERROR:
+               return "TRB Error";
+       case COMP_STALL_ERROR:
+               return "Stall Error";
+       case COMP_RESOURCE_ERROR:
+               return "Resource Error";
+       case COMP_BANDWIDTH_ERROR:
+               return "Bandwidth Error";
+       case COMP_NO_SLOTS_AVAILABLE_ERROR:
+               return "No Slots Available Error";
+       case COMP_INVALID_STREAM_TYPE_ERROR:
+               return "Invalid Stream Type Error";
+       case COMP_SLOT_NOT_ENABLED_ERROR:
+               return "Slot Not Enabled Error";
+       case COMP_ENDPOINT_NOT_ENABLED_ERROR:
+               return "Endpoint Not Enabled Error";
+       case COMP_SHORT_PACKET:
+               return "Short Packet";
+       case COMP_RING_UNDERRUN:
+               return "Ring Underrun";
+       case COMP_RING_OVERRUN:
+               return "Ring Overrun";
+       case COMP_VF_EVENT_RING_FULL_ERROR:
+               return "VF Event Ring Full Error";
+       case COMP_PARAMETER_ERROR:
+               return "Parameter Error";
+       case COMP_BANDWIDTH_OVERRUN_ERROR:
+               return "Bandwidth Overrun Error";
+       case COMP_CONTEXT_STATE_ERROR:
+               return "Context State Error";
+       case COMP_NO_PING_RESPONSE_ERROR:
+               return "No Ping Response Error";
+       case COMP_EVENT_RING_FULL_ERROR:
+               return "Event Ring Full Error";
+       case COMP_INCOMPATIBLE_DEVICE_ERROR:
+               return "Incompatible Device Error";
+       case COMP_MISSED_SERVICE_ERROR:
+               return "Missed Service Error";
+       case COMP_COMMAND_RING_STOPPED:
+               return "Command Ring Stopped";
+       case COMP_COMMAND_ABORTED:
+               return "Command Aborted";
+       case COMP_STOPPED:
+               return "Stopped";
+       case COMP_STOPPED_LENGTH_INVALID:
+               return "Stopped - Length Invalid";
+       case COMP_STOPPED_SHORT_PACKET:
+               return "Stopped - Short Packet";
+       case COMP_MAX_EXIT_LATENCY_TOO_LARGE_ERROR:
+               return "Max Exit Latency Too Large Error";
+       case COMP_ISOCH_BUFFER_OVERRUN:
+               return "Isoch Buffer Overrun";
+       case COMP_EVENT_LOST_ERROR:
+               return "Event Lost Error";
+       case COMP_UNDEFINED_ERROR:
+               return "Undefined Error";
+       case COMP_INVALID_STREAM_ID_ERROR:
+               return "Invalid Stream ID Error";
+       case COMP_SECONDARY_BANDWIDTH_ERROR:
+               return "Secondary Bandwidth Error";
+       case COMP_SPLIT_TRANSACTION_ERROR:
+               return "Split Transaction Error";
+       default:
+               return "Unknown!!";
+       }
+}
+
 struct xhci_link_trb {
        /* 64-bit segment pointer*/
        __le64 segment_ptr;