Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1450318

Re: [PATCH 1/4] usb: gadget: f_midi: fixed endianness when using wMaxPacketSize

Path csiph.com!feeder.erje.net!1.us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Baolin Wang <baolin.wang@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/4] usb: gadget: f_midi: fixed endianness when using wMaxPacketSize
Date Tue, 26 Jul 2016 04:00:01 +0200
Message-ID <rYZP3-459-9@gated-at.bofh.it> (permalink)
References <rYXkd-2G4-5@gated-at.bofh.it> <rYXkd-2G4-17@gated-at.bofh.it>
X-Original-To "Felipe F. Tonello" <eu@felipetonello.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=QBM24tiyfJSeUk1wQ0BmK+B8f/dVxxXGaF1ZBwVQVhA=; b=AJxJehtcCNCZdep/iKITKPoE/8kPzBwyj/1eGvrmjihVPG9GkXIv9o9Gn4mACDxNcN sFJiCNaVkBSOCYIs3Mi16pEh2TCXVanQELd6tUYKoncKgGbS/pfXiceoOBQmA626qjL1 mdFM+VAQpGbTgB9mJ/DdVMBCHofoXR+7yfMGs=
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=QBM24tiyfJSeUk1wQ0BmK+B8f/dVxxXGaF1ZBwVQVhA=; b=kxOVPKwv+8thah87HTXP7QSB5620NNRi7852dGd9t7bJhMpmJtF65tvwnzVRX0/3zF X6RVTZYFGhUsB9uIjZzmQ8ybPfkrTxliqDUpwSwLluaEcM6RkRfiMUVQ90eXzX806w37 BWx+wgWc5eyot3BYatfimUoAtlamx7bxPsZT6Lrmx7azGodmQo9LJj4CQY9sMmqfl8SF zUElSfbhK6rCZu0fsojTfcugbRqMiLQci2T1fyDLiXWLO8fbmEIL5+hdrbdgcuxUMUjb VVeDTXYEiCumIq2tjDKu05pMTTY3M/kddLI7zK4gG2+OlEKCP8hksV/KQk2ru9xRxxjU OD4g==
X-Gm-Message-State AEkoouvle63YF0FebefMfzZG+W/VYd35kFCdssgd+8P3V+lXKaXTvcA7/FOCySQEwYD+3qSrNTkqTt/rhrOD5ShB
X-Received by 10.129.86.131 with SMTP id k125mr10657347ywb.21.1469497893587; Mon, 25 Jul 2016 18:51:33 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 43
Organization linux.* mail to news gateway
X-Original-Cc USB <linux-usb@vger.kernel.org>, Felipe Balbi <balbi@kernel.org>, LKML <linux-kernel@vger.kernel.org>
X-Original-Date Tue, 26 Jul 2016 09:51:33 +0800
X-Original-Message-ID <CAMz4ku+q8KrUR4fae=R2O3=36w3fp0EEuqAQQE8EXHCaRDXBZg@mail.gmail.com>
X-Original-References <20160725231506.3426-1-eu@felipetonello.com> <20160725231506.3426-2-eu@felipetonello.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1450318

Show key headers only | View raw


Hi,

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

>                 if (req == NULL)
>                         return -ENOMEM;
>
> --
> 2.9.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Baolin.wang
Best Regards

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] MIDI Function improvements "Felipe F. Tonello" <eu@felipetonello.com> - 2016-07-26 01:20 +0200
  [PATCH 2/4] usb: gadget: f_midi: defaults buflen sizes to 512 "Felipe F. Tonello" <eu@felipetonello.com> - 2016-07-26 01:20 +0200
    Re: [PATCH 2/4] usb: gadget: f_midi: defaults buflen sizes to 512 Felipe Balbi <balbi@kernel.org> - 2016-08-10 21:40 +0200
  [PATCH 3/4] usb: gadget: f_midi: refactor state machine "Felipe F. Tonello" <eu@felipetonello.com> - 2016-07-26 01:20 +0200
  [PATCH 1/4] usb: gadget: f_midi: fixed endianness when using wMaxPacketSize "Felipe F. Tonello" <eu@felipetonello.com> - 2016-07-26 01:20 +0200
    Re: [PATCH 1/4] usb: gadget: f_midi: fixed endianness when using wMaxPacketSize Baolin Wang <baolin.wang@linaro.org> - 2016-07-26 04:00 +0200
      Re: [PATCH 1/4] usb: gadget: f_midi: fixed endianness when using wMaxPacketSize Felipe Balbi <balbi@kernel.org> - 2016-08-10 21:00 +0200

csiph-web