From 0ccd5573b8bb04d746391c7b94b6b7ee29757d18 Mon Sep 17 00:00:00 2001 From: Mathias Nyman Date: Wed, 16 Aug 2017 14:23:24 +0300 Subject: [PATCH] UPSTREAM: xhci: add port status tracing Track the port status in a human readble way each time we get a port status change event Change-Id: I14ac1a720e0faca54c694d3b0eb52eac42bccd5d Signed-off-by: Mathias Nyman Signed-off-by: Greg Kroah-Hartman Signed-off-by: William Wu (cherry picked from commit 8ca1358bd9b1c7a98c8f3210c1aaa2577975a389) --- drivers/usb/host/xhci-ring.c | 2 ++ drivers/usb/host/xhci-trace.h | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index db52230484e2..28db6802e15a 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1637,6 +1637,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); diff --git a/drivers/usb/host/xhci-trace.h b/drivers/usb/host/xhci-trace.h index 59c50b09a475..e70c0b5de26d 100644 --- a/drivers/usb/host/xhci-trace.h +++ b/drivers/usb/host/xhci-trace.h @@ -450,6 +450,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 */