xhci: add port status tracing
authorMathias Nyman <mathias.nyman@linux.intel.com>
Wed, 16 Aug 2017 11:23:24 +0000 (14:23 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Aug 2017 22:26:26 +0000 (15:26 -0700)
Track the port status in a human readble way each time we get a
port status change event

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-ring.c
drivers/usb/host/xhci-trace.h

index 52a6650..a944365 100644 (file)
@@ -1638,6 +1638,8 @@ static void handle_port_status(struct xhci_hcd *xhci,
                        port_id);
        portsc = readl(port_array[faked_port_index]);
 
+       trace_xhci_handle_port_status(faked_port_index, portsc);
+
        if (hcd->state == HC_STATE_SUSPENDED) {
                xhci_dbg(xhci, "resume root hub\n");
                usb_hcd_resume_root_hub(hcd);
index 8ce96de..f20753b 100644 (file)
@@ -453,6 +453,29 @@ DEFINE_EVENT(xhci_log_ring, xhci_inc_deq,
        TP_PROTO(struct xhci_ring *ring),
        TP_ARGS(ring)
 );
+
+DECLARE_EVENT_CLASS(xhci_log_portsc,
+                   TP_PROTO(u32 portnum, u32 portsc),
+                   TP_ARGS(portnum, portsc),
+                   TP_STRUCT__entry(
+                                    __field(u32, portnum)
+                                    __field(u32, portsc)
+                                    ),
+                   TP_fast_assign(
+                                  __entry->portnum = portnum;
+                                  __entry->portsc = portsc;
+                                  ),
+                   TP_printk("port-%d: %s",
+                             __entry->portnum,
+                             xhci_decode_portsc(__entry->portsc)
+                             )
+);
+
+DEFINE_EVENT(xhci_log_portsc, xhci_handle_port_status,
+            TP_PROTO(u32 portnum, u32 portsc),
+            TP_ARGS(portnum, portsc)
+);
+
 #endif /* __XHCI_TRACE_H */
 
 /* this part must be outside header guard */