Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: Use the USB_SS_MULT() macro to get the burst multiplier.

Bits 1:0 of the bmAttributes are used for the burst multiplier.
The rest of the bits used to be reserved (zero), but USB3.1 takes bit 7
into use.

Use the existing USB_SS_MULT() macro instead to make sure the mult value
and hence max packet calculations are correct for USB3.1 devices.

Note that burst multiplier in bmAttributes is zero based and that
the USB_SS_MULT() macro adds one.

Cc: <stable@vger.kernel.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Mathias Nyman and committed by
Greg Kroah-Hartman
ff30cbc8 01f4fd2a

+3 -2
+3 -2
drivers/usb/core/config.c
··· 112 112 cfgno, inum, asnum, ep->desc.bEndpointAddress); 113 113 ep->ss_ep_comp.bmAttributes = 16; 114 114 } else if (usb_endpoint_xfer_isoc(&ep->desc) && 115 - desc->bmAttributes > 2) { 115 + USB_SS_MULT(desc->bmAttributes) > 3) { 116 116 dev_warn(ddev, "Isoc endpoint has Mult of %d in " 117 117 "config %d interface %d altsetting %d ep %d: " 118 118 "setting to 3\n", desc->bmAttributes + 1, ··· 121 121 } 122 122 123 123 if (usb_endpoint_xfer_isoc(&ep->desc)) 124 - max_tx = (desc->bMaxBurst + 1) * (desc->bmAttributes + 1) * 124 + max_tx = (desc->bMaxBurst + 1) * 125 + (USB_SS_MULT(desc->bmAttributes)) * 125 126 usb_endpoint_maxp(&ep->desc); 126 127 else if (usb_endpoint_xfer_int(&ep->desc)) 127 128 max_tx = usb_endpoint_maxp(&ep->desc) *