Re: [PATCH] usb: gadget: f_midi: Add checking if it need align buffer's size to an ep's maxpacketsize

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

 



> Baolin Wang <baolin.wang@xxxxxxxxxx> writes:
>> @@ -359,10 +361,12 @@ static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
>>  
>>  	/* allocate a bunch of read buffers and queue them all at once. */
>>  	for (i = 0; i < midi->qlen && err == 0; i++) {
>> -		struct usb_request *req =
>> -			midi_alloc_ep_req(midi->out_ep,
>> -				max_t(unsigned, midi->buflen,
>> -					bulk_out_desc.wMaxPacketSize));
>> +		struct usb_request *req;
>> +
>> +		length = usb_ep_align_maybe(midi->gadget, midi->out_ep,
>> +					    midi->buflen);

On Fri, Jul 08 2016, Felipe Balbi wrote:
> after calling usb_ep_align_maybe()...
>
>> +		req = midi_alloc_ep_req(midi->out_ep,
>> +			max_t(unsigned, length, bulk_out_desc.wMaxPacketSize));
>
> ... max_t() is pointless. length will *always* >= wMaxPacketSize.

That is only true for gadgets with the quirk.  usb_ep_align_maybe is
a noöp for gadgets without the quirk.

-- 
Best regards
ミハウ “𝓶𝓲𝓷𝓪86” ナザレヴイツ
«If at first you don’t succeed, give up skydiving»
--
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