linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Julian Scheel <julian@jusst.de>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jonathan Corbet <corbet@lwn.net>, Felipe Balbi <balbi@kernel.org>,
	Julian Scheel <julian@jusst.de>,
	Ruslan Bilovol <ruslan.bilovol@gmail.com>,
	Peter Chen <peter.chen@nxp.com>, Sekhar Nori <nsekhar@ti.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-doc@vger.kernel.org
Subject: [PATCH 1/3] usb: gadget: f_uac1: Fix endpoint reading
Date: Mon, 26 Jun 2017 09:35:03 +0200	[thread overview]
Message-ID: <20170626073505.2792-2-julian@jusst.de> (raw)
In-Reply-To: <20170626073505.2792-1-julian@jusst.de>

The endpoint is stored in the lower byte of wIndex, according to USB
Audio 1.0 specification, section 5.2.1.1.

Signed-off-by: Julian Scheel <julian@jusst.de>
---
 drivers/usb/gadget/function/f_uac1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c
index 8656f84e17d9..b955913bd7ea 100644
--- a/drivers/usb/gadget/function/f_uac1.c
+++ b/drivers/usb/gadget/function/f_uac1.c
@@ -327,7 +327,7 @@ static int audio_set_endpoint_req(struct usb_function *f,
 {
 	struct usb_composite_dev *cdev = f->config->cdev;
 	int			value = -EOPNOTSUPP;
-	u16			ep = le16_to_cpu(ctrl->wIndex);
+	u8			ep = le16_to_cpu(ctrl->wIndex) & 0xff;
 	u16			len = le16_to_cpu(ctrl->wLength);
 	u16			w_value = le16_to_cpu(ctrl->wValue);
 
@@ -363,7 +363,7 @@ static int audio_get_endpoint_req(struct usb_function *f,
 {
 	struct usb_composite_dev *cdev = f->config->cdev;
 	int value = -EOPNOTSUPP;
-	u8 ep = ((le16_to_cpu(ctrl->wIndex) >> 8) & 0xFF);
+	u8 ep = le16_to_cpu(ctrl->wIndex) & 0xff;
 	u16 len = le16_to_cpu(ctrl->wLength);
 	u16 w_value = le16_to_cpu(ctrl->wValue);
 
-- 
2.13.1

  reply	other threads:[~2017-06-26  7:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-26  7:35 [PATCH 0/3] USB Audio Gadget: Support multiple sampling rates Julian Scheel
2017-06-26  7:35 ` Julian Scheel [this message]
2017-06-26  7:35 ` [PATCH 2/3] usb: gadget: f_uac*: Reduce code duplication Julian Scheel
2017-06-26 23:39   ` kbuild test robot
2017-06-26  7:35 ` [PATCH 3/3] usb: gadget: f_uac*: Support multiple sampling rates Julian Scheel
2018-06-30 18:16   ` [PATCHv2 " Eugeniu Rosca
2018-07-02 14:07     ` Julian Scheel
2018-07-02 16:30       ` Eugeniu Rosca
2018-07-02 22:29         ` Ruslan Bilovol
2018-07-05 23:06           ` Eugeniu Rosca

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=20170626073505.2792-2-julian@jusst.de \
    --to=julian@jusst.de \
    --cc=balbi@kernel.org \
    --cc=corbet@lwn.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=peter.chen@nxp.com \
    --cc=ruslan.bilovol@gmail.com \
    --cc=thierry.reding@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).