[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <xa1t4m80teds.fsf@mina86.com>
Date: Fri, 08 Jul 2016 16:04:31 +0200
From: Michal Nazarewicz <mina86@...a86.com>
To: Felipe Balbi <balbi@...nel.org>,
Baolin Wang <baolin.wang@...aro.org>
Cc: gregkh@...uxfoundation.org, eu@...ipetonello.com,
r.baldyga@...sung.com, dan.carpenter@...cle.com,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
broonie@...nel.org, baolin.wang@...aro.org
Subject: Re: [PATCH] usb: gadget: f_midi: Add checking if it need align buffer's size to an ep's maxpacketsize
> Baolin Wang <baolin.wang@...aro.org> 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»
Powered by blists - more mailing lists