From: Felipe Balbi ... > +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"; > + } > +} If the values are dense the compiler will generate much smaller code if you index an array - possibly even: char msg[][12]; David -- 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