public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Baolin Wang <baolin.wang@linaro.org>,
	"Felipe F. Tonello" <eu@felipetonello.com>
Cc: USB <linux-usb@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/4] usb: gadget: f_midi: fixed endianness when using wMaxPacketSize
Date: Wed, 10 Aug 2016 14:24:58 +0300	[thread overview]
Message-ID: <877fbodfxx.fsf@linux.intel.com> (raw)
In-Reply-To: <CAMz4ku+q8KrUR4fae=R2O3=36w3fp0EEuqAQQE8EXHCaRDXBZg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1523 bytes --]


Hi,

Baolin Wang <baolin.wang@linaro.org> writes:
> On 26 July 2016 at 07:15, Felipe F. Tonello <eu@felipetonello.com> wrote:
>> USB spec specifies wMaxPacketSize to be little endian (as other properties),
>> so when using this variable in the driver we should convert to the current
>> CPU endianness if necessary.
>>
>> Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
>> ---
>>  drivers/usb/gadget/function/f_midi.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
>> index 58fc199a18ec..a83d852b1da5 100644
>> --- a/drivers/usb/gadget/function/f_midi.c
>> +++ b/drivers/usb/gadget/function/f_midi.c
>> @@ -362,7 +362,7 @@ static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
>>                 struct usb_request *req =
>>                         midi_alloc_ep_req(midi->out_ep,
>>                                 max_t(unsigned, midi->buflen,
>> -                                       bulk_out_desc.wMaxPacketSize));
>> +                                       le16_to_cpu(bulk_out_desc.wMaxPacketSize)));
>
> I think here we should use usb_ep_align_maybe() function instead of
> max_t() to handle 'quirk_ep_out_aligned_size' quirk, please see the
> patch I've send out: https://lkml.org/lkml/2016/7/12/106

agree, if usb_ep_align_maybe() has a bug with endianness, let's fix it
since there are other gadgets using usb_ep_align_maybe()

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

  reply	other threads:[~2016-08-10 18:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-25 23:15 [PATCH 0/4] MIDI Function improvements Felipe F. Tonello
2016-07-25 23:15 ` [PATCH 1/4] usb: gadget: f_midi: fixed endianness when using wMaxPacketSize Felipe F. Tonello
2016-07-26  1:51   ` Baolin Wang
2016-08-10 11:24     ` Felipe Balbi [this message]
2016-08-11  8:37       ` Felipe Ferreri Tonello
2016-07-25 23:15 ` [PATCH 2/4] usb: gadget: f_midi: defaults buflen sizes to 512 Felipe F. Tonello
2016-08-10 11:25   ` Felipe Balbi
2016-08-11  8:34     ` Felipe Ferreri Tonello
2016-07-25 23:15 ` [PATCH 3/4] usb: gadget: f_midi: refactor state machine Felipe F. Tonello
2016-07-25 23:15 ` [PATCH 4/4] usb: gadget: f_midi: drop substreams when disabling endpoint Felipe F. Tonello

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877fbodfxx.fsf@linux.intel.com \
    --to=balbi@kernel.org \
    --cc=baolin.wang@linaro.org \
    --cc=eu@felipetonello.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox