Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 877135c

Browse files
tiwaigregkh
authored andcommitted
usb: gadget: midi2: Fix MIDI2 IN EP max packet size
commit 116e79c upstream. 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 47949bc commit 877135c

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
@@ -1739,9 +1739,12 @@ static int f_midi2_create_usb_configs(struct f_midi2 *midi2,
17391739
case USB_SPEED_HIGH:
17401740
midi2_midi1_ep_out_desc.wMaxPacketSize = cpu_to_le16(512);
17411741
midi2_midi1_ep_in_desc.wMaxPacketSize = cpu_to_le16(512);
1742-
for (i = 0; i < midi2->num_eps; i++)
1742+
for (i = 0; i < midi2->num_eps; i++) {
17431743
midi2_midi2_ep_out_desc[i].wMaxPacketSize =
17441744
cpu_to_le16(512);
1745+
midi2_midi2_ep_in_desc[i].wMaxPacketSize =
1746+
cpu_to_le16(512);
1747+
}
17451748
fallthrough;
17461749
case USB_SPEED_FULL:
17471750
midi1_in_eps = midi2_midi1_ep_in_descs;
@@ -1750,9 +1753,12 @@ static int f_midi2_create_usb_configs(struct f_midi2 *midi2,
17501753
case USB_SPEED_SUPER:
17511754
midi2_midi1_ep_out_desc.wMaxPacketSize = cpu_to_le16(1024);
17521755
midi2_midi1_ep_in_desc.wMaxPacketSize = cpu_to_le16(1024);
1753-
for (i = 0; i < midi2->num_eps; i++)
1756+
for (i = 0; i < midi2->num_eps; i++) {
17541757
midi2_midi2_ep_out_desc[i].wMaxPacketSize =
17551758
cpu_to_le16(1024);
1759+
midi2_midi2_ep_in_desc[i].wMaxPacketSize =
1760+
cpu_to_le16(1024);
1761+
}
17561762
midi1_in_eps = midi2_midi1_ep_in_ss_descs;
17571763
midi1_out_eps = midi2_midi1_ep_out_ss_descs;
17581764
break;

0 commit comments

Comments
 (0)