RE: [PATCH] usb: dwc3: gadget: pretty print link states

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: linux-usb-owner@xxxxxxxxxxxxxxx [mailto:linux-usb-owner@xxxxxxxxxxxxxxx] On Behalf Of Felipe Balbi
> Sent: Thursday, April 24, 2014 8:10 AM
> 
> this makes it slightly easier to read link state
> change interrupt logs.
> 
> Signed-off-by: Felipe Balbi <balbi@xxxxxx>
> ---
>  drivers/usb/dwc3/gadget.c | 39 ++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 38 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index f0dc0ee..a8cf87b 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";

Hi Felipe,

For the non-obvious link states, could we have both the name and the
number in the message perhaps? i.e.

	case DWC3_LINK_STATE_SS_DIS:
		return "SS.Disabled (4)";
	case DWC3_LINK_STATE_RX_DET:
		return "RX.Detect (5)";

and so on.

If I'm looking at the link state in a register and comparing it to the
log, it helps if I don't have to look up the values in the databook ;)

-- 
Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux