Skip to content

Commit 4a1a3bb

Browse files
Felipe Balbigregkh
authored andcommitted
usb: gadget: function: f_fs: pass companion descriptor along
commit 2bfa071 upstream. If we're dealing with SuperSpeed endpoints, we need to make sure to pass along the companion descriptor and initialize fields needed by the Gadget API. Eventually, f_fs.c should be converted to use config_ep_by_speed() like all other functions, though. Signed-off-by: Felipe Balbi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 10af248 commit 4a1a3bb

File tree

1 file changed

+13
-2
lines changed
  • drivers/usb/gadget/function

1 file changed

+13
-2
lines changed

drivers/usb/gadget/function/f_fs.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,11 +1643,14 @@ static int ffs_func_eps_enable(struct ffs_function *func)
16431643
spin_lock_irqsave(&func->ffs->eps_lock, flags);
16441644
do {
16451645
struct usb_endpoint_descriptor *ds;
1646+
struct usb_ss_ep_comp_descriptor *comp_desc = NULL;
1647+
int needs_comp_desc = false;
16461648
int desc_idx;
16471649

1648-
if (ffs->gadget->speed == USB_SPEED_SUPER)
1650+
if (ffs->gadget->speed == USB_SPEED_SUPER) {
16491651
desc_idx = 2;
1650-
else if (ffs->gadget->speed == USB_SPEED_HIGH)
1652+
needs_comp_desc = true;
1653+
} else if (ffs->gadget->speed == USB_SPEED_HIGH)
16511654
desc_idx = 1;
16521655
else
16531656
desc_idx = 0;
@@ -1664,6 +1667,14 @@ static int ffs_func_eps_enable(struct ffs_function *func)
16641667

16651668
ep->ep->driver_data = ep;
16661669
ep->ep->desc = ds;
1670+
1671+
comp_desc = (struct usb_ss_ep_comp_descriptor *)(ds +
1672+
USB_DT_ENDPOINT_SIZE);
1673+
ep->ep->maxburst = comp_desc->bMaxBurst + 1;
1674+
1675+
if (needs_comp_desc)
1676+
ep->ep->comp_desc = comp_desc;
1677+
16671678
ret = usb_ep_enable(ep->ep);
16681679
if (likely(!ret)) {
16691680
epfile->ep = ep;

0 commit comments

Comments
 (0)