Hi,

David Laight <david.lai...@aculab.com> writes:
> 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.

it's only used for tracing and compiler can uninline inline functions.

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

Even though I haven't looked at the resulting binary, I'm pretty sure
compiler can optimize this.

-- 
balbi

Attachment: signature.asc
Description: PGP signature

Reply via email to