From: Mathias Nyman
> Sent: 23 January 2017 12:20
> If we just provide a helper to convert completion code to string, we can
> combine all debugging messages into a single print.
...
> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
> index aa63e38..ebdd920 100644
> --- a/drivers/usb/host/xhci.h
> +++ b/drivers/usb/host/xhci.h
> @@ -1097,6 +1097,86 @@ struct xhci_transfer_event {
>  #define COMP_SECONDARY_BANDWIDTH_ERROR               35
>  #define COMP_SPLIT_TRANSACTION_ERROR         36
> 
> +static inline const char *xhci_trb_comp_code_string(u8 status)
> +{
> +     switch (status) {
> +     case COMP_INVALID:
> +             return "Invalid";
...
> +     case COMP_SPLIT_TRANSACTION_ERROR:
> +             return "Split Transaction Error";
> +     default:
> +             return "Unknown!!";
> +     }
> +}

That ought to be a real function, not a static inline.
Will generate a lot of code and data if inlined.

If the error codes are reasonable dense then an array is much better
than the switch statement.

        David

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

Reply via email to