From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S939011AbcHJS6X (ORCPT ); Wed, 10 Aug 2016 14:58:23 -0400 Received: from mga04.intel.com ([192.55.52.120]:51726 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934845AbcHJS6U (ORCPT ); Wed, 10 Aug 2016 14:58:20 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,499,1464678000"; d="asc'?scan'208";a="862974901" From: Felipe Balbi To: Baolin Wang , "Felipe F. Tonello" Cc: USB , LKML Subject: Re: [PATCH 1/4] usb: gadget: f_midi: fixed endianness when using wMaxPacketSize In-Reply-To: References: <20160725231506.3426-1-eu@felipetonello.com> <20160725231506.3426-2-eu@felipetonello.com> User-Agent: Notmuch/0.22.1+63~g994277e (https://notmuchmail.org) Emacs/25.1.1 (x86_64-pc-linux-gnu) Date: Wed, 10 Aug 2016 14:24:58 +0300 Message-ID: <877fbodfxx.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Baolin Wang writes: > On 26 July 2016 at 07:15, Felipe F. Tonello wrote: >> USB spec specifies wMaxPacketSize to be little endian (as other properti= es), >> so when using this variable in the driver we should convert to the curre= nt >> CPU endianness if necessary. >> >> Signed-off-by: Felipe F. Tonello >> --- >> 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/f= unction/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, un= signed intf, unsigned alt) >> struct usb_request *req =3D >> midi_alloc_ep_req(midi->out_ep, >> max_t(unsigned, midi->buflen, >> - bulk_out_desc.wMaxPacketSize)); >> + le16_to_cpu(bulk_out_desc.wMaxPa= cketSize))); > > 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() =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXqw8KAAoJEIaOsuA1yqRE0IgP/38pEUp9LyHNB89NiK9i0BhT 4UIj/43WZSbkwDaHiebk31D6BYlKx+XoSngcpayd/FXCq17Hwut7lScmOQxg+tkB bGpu3Jju9VAzjbucMt3FCBv5FMSgC2X2B92/nS70XDFG0Ofpvs5CD1Hu3paw3Y/E Eua8h54uIS4NsoIoL3Xp+5I2rXzOKYBijWIOOacMS7uoV4G7A3VzGYH03xpse1gj 7RP2rRaTvAC/WIj/vuqhpb6bDfWHUI5EH8R39TfftT2AyLzg3JWtMW/B4BkaTRYs u1u2JtmqjT3HTsnrCcPXoAlToxAFf38tVunkn+TH4LUxwXXwLhCxOK4qZdibGUy2 MpGJzhzI4nYxQe9eEY5er9LWrEc23i2STij0jYEP+XhMZ2JexGU7BbxLhzzJ1dBk c3QY3M+nhLt8wQNDoXRcs9/fsxYsiyxeWM5fKPHe2MxHq9vE8paCqTluuv6jkQTB 39HIz1Qt8Q6mBcHV26CEKaNPosMVNmAwZzRFNbLkUaL9Axs0n4t7biUk1TfMLmut o+Co1CjEOkzdOBr2+Ztq0ucUuyTIN+99t7BUXKVhKiXHfzwRWmKussZM7GKyYZrU FeGLgRxVHYtPCDwozSZLWa21pjL11Owh8ZeQ5WlChNvKvWy9RCSSjaSN6gsrZd2D 4mjKC13xAl0QGQefsg7a =oMZW -----END PGP SIGNATURE----- --=-=-=--