From: Faraz Ata <faraz.ata@samsung.com>
To: gregkh@linuxfoundation.org, quic_jjohnson@quicinc.com,
kees@kernel.org, abdul.rahim@myyahoo.com,
m.grzeschik@pengutronix.de, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: jh0801.jung@samsung.com, dh10.jung@samsung.com,
naushad@samsung.com, akash.m5@samsung.com, rc93.raju@samsung.com,
taehyun.cho@samsung.com, hongpooh.kim@samsung.com,
eomji.oh@samsung.com, shijie.cai@samsung.com,
alim.akhtar@samsung.com,
Selvarasu Ganesan <selvarasu.g@samsung.com>,
stable@vger.kernel.org
Subject: [PATCH] usb: gadget: f_midi: Fixing wMaxPacketSize exceeded issue during MIDI bind retries
Date: Sun, 8 Dec 2024 20:43:13 +0530 [thread overview]
Message-ID: <20241208151314.1625-1-faraz.ata@samsung.com> (raw)
In-Reply-To: CGME20241208151349epcas5p1a94ca45020318f54885072d4987160b3@epcas5p1.samsung.com
From: Selvarasu Ganesan <selvarasu.g@samsung.com>
The current implementation sets the wMaxPacketSize of bulk in/out
endpoints to 1024 bytes at the end of the f_midi_bind function. However,
in cases where there is a failure in the first midi bind attempt,
consider rebinding. This scenario may encounter an f_midi_bind issue due
to the previous bind setting the bulk endpoint's wMaxPacketSize to 1024
bytes, which exceeds the ep->maxpacket_limit where configured TX/RX
FIFO's maxpacket size of 512 bytes for IN/OUT endpoints in support HS
speed only.
This commit addresses this issue by resetting the wMaxPacketSize before
endpoint claim
Fixes: 46decc82ffd5 ("usb: gadget: unconditionally allocate hs/ss descriptor in bind operation")
Cc: stable@vger.kernel.org
Signed-off-by: Selvarasu Ganesan <selvarasu.g@samsung.com>
---
drivers/usb/gadget/function/f_midi.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
index 837fcdfa3840..5caa0e4eb07e 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -907,6 +907,15 @@ static int f_midi_bind(struct usb_configuration *c, struct usb_function *f)
status = -ENODEV;
+ /*
+ * Reset wMaxPacketSize with maximum packet size of FS bulk transfer before
+ * endpoint claim. This ensures that the wMaxPacketSize does not exceed the
+ * limit during bind retries where configured TX/RX FIFO's maxpacket size
+ * of 512 bytes for IN/OUT endpoints in support HS speed only.
+ */
+ bulk_in_desc.wMaxPacketSize = cpu_to_le16(64);
+ bulk_out_desc.wMaxPacketSize = cpu_to_le16(64);
+
/* allocate instance-specific endpoints */
midi->in_ep = usb_ep_autoconfig(cdev->gadget, &bulk_in_desc);
if (!midi->in_ep)
--
2.17.1
next parent reply other threads:[~2024-12-08 15:13 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20241208151349epcas5p1a94ca45020318f54885072d4987160b3@epcas5p1.samsung.com>
2024-12-08 15:13 ` Faraz Ata [this message]
2024-12-08 15:28 ` [PATCH] usb: gadget: f_midi: Fixing wMaxPacketSize exceeded issue during MIDI bind retries Selvarasu Ganesan
2024-12-08 15:48 ` Greg KH
2024-12-08 16:00 ` Selvarasu Ganesan
[not found] <CGME20241208152338epcas5p4fde427bb4467414417083221067ac7ab@epcas5p4.samsung.com>
2024-12-08 15:23 ` Selvarasu Ganesan
2024-12-10 9:53 ` Selvarasu Ganesan
2024-12-10 10:18 ` Greg KH
2024-12-10 14:11 ` Selvarasu Ganesan
2024-12-10 14:25 ` Greg KH
2024-12-12 12:28 ` Selvarasu Ganesan
2024-12-18 5:31 ` Greg KH
2024-12-18 10:21 ` Selvarasu Ganesan
2024-12-18 15:51 ` Alan Stern
2024-12-19 4:06 ` Selvarasu Ganesan
2024-12-20 12:24 ` Greg KH
2024-12-20 13:32 ` Selvarasu Ganesan
2024-12-20 15:15 ` Greg KH
2024-12-21 18:07 ` Selvarasu Ganesan
2025-01-06 5:17 ` Selvarasu Ganesan
2025-01-16 5:19 ` Selvarasu Ganesan
2025-01-17 11:05 ` Greg KH
2025-01-18 6:09 ` Selvarasu Ganesan
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=20241208151314.1625-1-faraz.ata@samsung.com \
--to=faraz.ata@samsung.com \
--cc=abdul.rahim@myyahoo.com \
--cc=akash.m5@samsung.com \
--cc=alim.akhtar@samsung.com \
--cc=dh10.jung@samsung.com \
--cc=eomji.oh@samsung.com \
--cc=gregkh@linuxfoundation.org \
--cc=hongpooh.kim@samsung.com \
--cc=jh0801.jung@samsung.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=m.grzeschik@pengutronix.de \
--cc=naushad@samsung.com \
--cc=quic_jjohnson@quicinc.com \
--cc=rc93.raju@samsung.com \
--cc=selvarasu.g@samsung.com \
--cc=shijie.cai@samsung.com \
--cc=stable@vger.kernel.org \
--cc=taehyun.cho@samsung.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