Hi,

On 12/30/2016 03:54 PM, Felipe Balbi wrote:
> Hi,
>
> Lu Baolu <baolu...@linux.intel.com> writes:
>> On 12/29/2016 07:00 PM, Felipe Balbi wrote:
>>> instead of open coding how to convert a TRB to no-op, let's use our
>>> newly introduced helper.
>>>
>>> Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
>>> ---
>>>  drivers/usb/host/xhci-ring.c | 33 +++++++++++++++++++++++----------
>>>  1 file changed, 23 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
>>> index f369d97f663d..0b8f728d6e77 100644
>>> --- a/drivers/usb/host/xhci-ring.c
>>> +++ b/drivers/usb/host/xhci-ring.c
>>> @@ -542,6 +542,27 @@ static void trb_to_noop(union xhci_trb *trb)
>>>             trb->generic.field[3] &= cpu_to_le32(TRB_CYCLE);
>>>             trb->generic.field[3] |= cpu_to_le32(TRB_TYPE(TRB_TR_NOOP));
>>>             break;
>>> +   case TRB_ENABLE_SLOT:
>>> +   case TRB_DISABLE_SLOT:
>>> +   case TRB_ADDR_DEV:
>>> +   case TRB_CONFIG_EP:
>>> +   case TRB_EVAL_CONTEXT:
>>> +   case TRB_RESET_EP:
>>> +   case TRB_STOP_RING:
>>> +   case TRB_SET_DEQ:
>>> +   case TRB_RESET_DEV:
>>> +   case TRB_FORCE_EVENT:
>>> +   case TRB_NEG_BANDWIDTH:
>>> +   case TRB_SET_LT:
>>> +   case TRB_GET_BW:
>>> +   case TRB_FORCE_HEADER:
>> How about merging
>>
>> +    case TRB_ENABLE_SLOT:
>> +    case TRB_DISABLE_SLOT:
>> +    case TRB_ADDR_DEV:
>> +    case TRB_CONFIG_EP:
>> +    case TRB_EVAL_CONTEXT:
>> +    case TRB_RESET_EP:
>> +    case TRB_STOP_RING:
>> +    case TRB_SET_DEQ:
>> +    case TRB_RESET_DEV:
>> +    case TRB_FORCE_EVENT:
>> +    case TRB_NEG_BANDWIDTH:
>> +    case TRB_SET_LT:
>> +    case TRB_GET_BW:
>> +    case TRB_FORCE_HEADER:
>>
>> into
>>
>>
>> +        case TRB_ENABLE_SLOT ... TRB_FORCE_HEADER:
>>
>> ?
> to me it's pointless obfuscation :-)
>
>>      
>>
>>> +           trb->generic.field[0] = 0;
>>> +           trb->generic.field[1] = 0;
>>> +           trb->generic.field[2] = 0;
>>> +           /* Preserve only the cycle bit of this TRB */
>>> +           trb->generic.field[3] &= cpu_to_le32(TRB_CYCLE);
>>> +           trb->generic.field[3] = cpu_to_le32(TRB_TYPE(TRB_CMD_NOOP));
>>> +           break;
>>>     default:
>>>             /* nothing */
>> Need a warning?
> We have two users for this function and we know we won't pass unexistent
> TRB types to it. Maybe we can defer that warning until a problem shows up?
>

Fair enough.

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

Reply via email to