| From d6bf529c90df506b55c22350b59230489e2e47f1 Mon Sep 17 00:00:00 2001 |
| From: Felipe Balbi <felipe.balbi@linux.intel.com> |
| Date: Fri, 7 Apr 2017 17:56:56 +0300 |
| Subject: [PATCH 182/286] usb: host: xhci: extract xhci_slot_state_string() |
| |
| By extracting and exposing xhci_slot_state_string() in a header file, we |
| can re-use it to print Slot Context State from our tracepoints, which |
| can aid in tracking down problems related to command execution. |
| |
| 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> |
| (cherry picked from commit 52407729fbeabb654d38c0c99661a41a481092d1) |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| --- |
| drivers/usb/host/xhci-dbg.c | 14 ++------------ |
| drivers/usb/host/xhci.h | 16 ++++++++++++++++ |
| 2 files changed, 18 insertions(+), 12 deletions(-) |
| |
| --- a/drivers/usb/host/xhci-dbg.c |
| +++ b/drivers/usb/host/xhci-dbg.c |
| @@ -451,19 +451,9 @@ char *xhci_get_slot_state(struct xhci_hc |
| struct xhci_container_ctx *ctx) |
| { |
| struct xhci_slot_ctx *slot_ctx = xhci_get_slot_ctx(xhci, ctx); |
| + int state = GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state)); |
| |
| - switch (GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state))) { |
| - case SLOT_STATE_ENABLED: |
| - return "enabled/disabled"; |
| - case SLOT_STATE_DEFAULT: |
| - return "default"; |
| - case SLOT_STATE_ADDRESSED: |
| - return "addressed"; |
| - case SLOT_STATE_CONFIGURED: |
| - return "configured"; |
| - default: |
| - return "reserved"; |
| - } |
| + return xhci_slot_state_string(state); |
| } |
| |
| static void xhci_dbg_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx) |
| --- a/drivers/usb/host/xhci.h |
| +++ b/drivers/usb/host/xhci.h |
| @@ -2161,6 +2161,22 @@ static inline struct xhci_ring *xhci_urb |
| urb->stream_id); |
| } |
| |
| +static inline char *xhci_slot_state_string(u32 state) |
| +{ |
| + switch (state) { |
| + case SLOT_STATE_ENABLED: |
| + return "enabled/disabled"; |
| + case SLOT_STATE_DEFAULT: |
| + return "default"; |
| + case SLOT_STATE_ADDRESSED: |
| + return "addressed"; |
| + case SLOT_STATE_CONFIGURED: |
| + return "configured"; |
| + default: |
| + return "reserved"; |
| + } |
| +} |
| + |
| static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, |
| u32 field3) |
| { |