Skip to content

Commit 116e79c

Browse files
tiwaigregkh
authored andcommitted
usb: gadget: midi2: Fix MIDI2 IN EP max packet size
The EP-IN of MIDI2 (altset 1) wasn't initialized in f_midi2_create_usb_configs() as it's an INT EP unlike others BULK EPs. But this leaves rather the max packet size unchanged no matter which speed is used, resulting in the very slow access. And the wMaxPacketSize values set there look legit for INT EPs, so let's initialize the MIDI2 EP-IN there for achieving the equivalent speed as well. Fixes: 8b64592 ("usb: gadget: Add support for USB MIDI 2.0 function driver") Cc: stable <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 21d8525 commit 116e79c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/usb/gadget/function/f_midi2.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,9 +1737,12 @@ static int f_midi2_create_usb_configs(struct f_midi2 *midi2,
17371737
case USB_SPEED_HIGH:
17381738
midi2_midi1_ep_out_desc.wMaxPacketSize = cpu_to_le16(512);
17391739
midi2_midi1_ep_in_desc.wMaxPacketSize = cpu_to_le16(512);
1740-
for (i = 0; i < midi2->num_eps; i++)
1740+
for (i = 0; i < midi2->num_eps; i++) {
17411741
midi2_midi2_ep_out_desc[i].wMaxPacketSize =
17421742
cpu_to_le16(512);
1743+
midi2_midi2_ep_in_desc[i].wMaxPacketSize =
1744+
cpu_to_le16(512);
1745+
}
17431746
fallthrough;
17441747
case USB_SPEED_FULL:
17451748
midi1_in_eps = midi2_midi1_ep_in_descs;
@@ -1748,9 +1751,12 @@ static int f_midi2_create_usb_configs(struct f_midi2 *midi2,
17481751
case USB_SPEED_SUPER:
17491752
midi2_midi1_ep_out_desc.wMaxPacketSize = cpu_to_le16(1024);
17501753
midi2_midi1_ep_in_desc.wMaxPacketSize = cpu_to_le16(1024);
1751-
for (i = 0; i < midi2->num_eps; i++)
1754+
for (i = 0; i < midi2->num_eps; i++) {
17521755
midi2_midi2_ep_out_desc[i].wMaxPacketSize =
17531756
cpu_to_le16(1024);
1757+
midi2_midi2_ep_in_desc[i].wMaxPacketSize =
1758+
cpu_to_le16(1024);
1759+
}
17541760
midi1_in_eps = midi2_midi1_ep_in_ss_descs;
17551761
midi1_out_eps = midi2_midi1_ep_out_ss_descs;
17561762
break;

0 commit comments

Comments
 (0)