Commit 52407729 authored by Felipe Balbi's avatar Felipe Balbi Committed by Greg Kroah-Hartman

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: default avatarFelipe Balbi <felipe.balbi@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 eaa9eb71
...@@ -451,19 +451,9 @@ char *xhci_get_slot_state(struct xhci_hcd *xhci, ...@@ -451,19 +451,9 @@ char *xhci_get_slot_state(struct xhci_hcd *xhci,
struct xhci_container_ctx *ctx) struct xhci_container_ctx *ctx)
{ {
struct xhci_slot_ctx *slot_ctx = xhci_get_slot_ctx(xhci, 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))) { return xhci_slot_state_string(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 void xhci_dbg_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx) static void xhci_dbg_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx)
......
...@@ -2158,6 +2158,22 @@ static inline struct xhci_ring *xhci_urb_to_transfer_ring(struct xhci_hcd *xhci, ...@@ -2158,6 +2158,22 @@ static inline struct xhci_ring *xhci_urb_to_transfer_ring(struct xhci_hcd *xhci,
urb->stream_id); 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, static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2,
u32 field3) u32 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