On Fri, Apr 25, 2014 at 02:15:29PM -0500, Felipe Balbi wrote: > this makes it slightly easier to read link state > change interrupt logs. > > Signed-off-by: Felipe Balbi <balbi@xxxxxx> > --- > drivers/usb/dwc3/gadget.c | 44 +++++++++++++++++++++++++++++++++++++++++--- > 1 file changed, 41 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c > index f5adf3f..2406a82 100644 > --- a/drivers/usb/dwc3/gadget.c > +++ b/drivers/usb/dwc3/gadget.c > @@ -302,6 +302,42 @@ static const char *dwc3_gadget_ep_cmd_string(u8 cmd) > } > } > > +static const char *dwc3_gadget_link_string(enum dwc3_link_state link_state) > +{ > + switch (link_state) { > + case DWC3_LINK_STATE_U0: > + return "U0"; > + case DWC3_LINK_STATE_U1: > + return "U1"; > + case DWC3_LINK_STATE_U2: > + return "U2"; > + case DWC3_LINK_STATE_U3: > + return "U3"; > + case DWC3_LINK_STATE_SS_DIS: > + return "SS.Disabled"; > + case DWC3_LINK_STATE_RX_DET: > + return "RX.Detect"; > + case DWC3_LINK_STATE_SS_INACT: > + return "SS.Inactive"; > + case DWC3_LINK_STATE_POLL: > + return "Polling"; > + case DWC3_LINK_STATE_RECOV: > + return "Recovery"; > + case DWC3_LINK_STATE_HRESET: > + return "Hot Reset"; > + case DWC3_LINK_STATE_CMPLY: > + return "Compliance"; > + case DWC3_LINK_STATE_LPBK: > + return "Loopback"; > + case DWC3_LINK_STATE_RESET: > + return "Reset"; > + case DWC3_LINK_STATE_RESUME: > + return "Resume"; > + default: > + return "UNKNOWN link state\n"; > + } > +} > + > int dwc3_send_gadget_generic_command(struct dwc3 *dwc, int cmd, u32 param) > { > u32 timeout = 500; > @@ -2449,8 +2485,6 @@ static void dwc3_gadget_linksts_change_interrupt(struct dwc3 *dwc, > } > } > > - dwc->link_state = next; > - > switch (next) { > case DWC3_LINK_STATE_U1: > if (dwc->speed == USB_SPEED_SUPER) > @@ -2468,7 +2502,11 @@ static void dwc3_gadget_linksts_change_interrupt(struct dwc3 *dwc, > break; > } > > - dev_vdbg(dwc->dev, "%s link %d\n", __func__, dwc->link_state); > + dev_vdbg(dwc->dev, "link change: %s [%d] -> %s [%d]\n", __func__, don't you hate when you think you've committed something but in reality you didn't ? grrrrr 8<---------------------------------------------------------------------------- From e57ebc1db6ef796124b69abca044a373b9110a47 Mon Sep 17 00:00:00 2001 From: Felipe Balbi <balbi@xxxxxx> Date: Tue, 22 Apr 2014 13:20:12 -0500 Subject: [PATCH] usb: dwc3: gadget: pretty print link states this makes it slightly easier to read link state change interrupt logs. Signed-off-by: Felipe Balbi <balbi@xxxxxx> --- drivers/usb/dwc3/gadget.c | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index f5adf3f..9a8ae39 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -302,6 +302,42 @@ static const char *dwc3_gadget_ep_cmd_string(u8 cmd) } } +static const char *dwc3_gadget_link_string(enum dwc3_link_state link_state) +{ + switch (link_state) { + case DWC3_LINK_STATE_U0: + return "U0"; + case DWC3_LINK_STATE_U1: + return "U1"; + case DWC3_LINK_STATE_U2: + return "U2"; + case DWC3_LINK_STATE_U3: + return "U3"; + case DWC3_LINK_STATE_SS_DIS: + return "SS.Disabled"; + case DWC3_LINK_STATE_RX_DET: + return "RX.Detect"; + case DWC3_LINK_STATE_SS_INACT: + return "SS.Inactive"; + case DWC3_LINK_STATE_POLL: + return "Polling"; + case DWC3_LINK_STATE_RECOV: + return "Recovery"; + case DWC3_LINK_STATE_HRESET: + return "Hot Reset"; + case DWC3_LINK_STATE_CMPLY: + return "Compliance"; + case DWC3_LINK_STATE_LPBK: + return "Loopback"; + case DWC3_LINK_STATE_RESET: + return "Reset"; + case DWC3_LINK_STATE_RESUME: + return "Resume"; + default: + return "UNKNOWN link state\n"; + } +} + int dwc3_send_gadget_generic_command(struct dwc3 *dwc, int cmd, u32 param) { u32 timeout = 500; @@ -2449,8 +2485,6 @@ static void dwc3_gadget_linksts_change_interrupt(struct dwc3 *dwc, } } - dwc->link_state = next; - switch (next) { case DWC3_LINK_STATE_U1: if (dwc->speed == USB_SPEED_SUPER) @@ -2468,7 +2502,11 @@ static void dwc3_gadget_linksts_change_interrupt(struct dwc3 *dwc, break; } - dev_vdbg(dwc->dev, "%s link %d\n", __func__, dwc->link_state); + dev_vdbg(dwc->dev, "link change: %s [%d] -> %s [%d]\n", + dwc3_gadget_link_string(dwc->link_state), + dwc->link_state, dwc3_gadget_link_string(next), next); + + dwc->link_state = next; } static void dwc3_gadget_hibernation_interrupt(struct dwc3 *dwc, -- 1.9.2.459.g68773ac -- balbi
Attachment:
signature.asc
Description: Digital signature