Skip to content

Commit 170c026

Browse files
Sarah Sharpgregkh
authored andcommitted
xhci: Fix mult base in endpoint bandwidth info.
The "Mult" bits in the SuperSpeed Endpoint Companion Descriptor are zero-based, and the xHCI host controller wants them to be zero-based in the input context. However, for the bandwidth math, we want them to be one-based. Fix this. Fix the documentation about the endpoint bandwidth mult variable in the xhci.h file, which says it is zero-based. Also fix the documentation about num_packets, which is also one-based, not zero-based. Signed-off-by: Sarah Sharp <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 75d7cf7 commit 170c026

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

drivers/usb/host/xhci-mem.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,11 +1473,12 @@ void xhci_update_bw_info(struct xhci_hcd *xhci,
14731473
/* Added or changed endpoint */
14741474
bw_info->ep_interval = CTX_TO_EP_INTERVAL(
14751475
le32_to_cpu(ep_ctx->ep_info));
1476-
bw_info->mult = CTX_TO_EP_MULT(
1477-
le32_to_cpu(ep_ctx->ep_info));
1478-
/* Number of packets is zero-based in the input context,
1479-
* but we want one-based for the interval table.
1476+
/* Number of packets and mult are zero-based in the
1477+
* input context, but we want one-based for the
1478+
* interval table.
14801479
*/
1480+
bw_info->mult = CTX_TO_EP_MULT(
1481+
le32_to_cpu(ep_ctx->ep_info)) + 1;
14811482
bw_info->num_packets = CTX_TO_MAX_BURST(
14821483
le32_to_cpu(ep_ctx->ep_info2)) + 1;
14831484
bw_info->max_packet_size = MAX_PACKET_DECODED(

drivers/usb/host/xhci.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,8 +747,9 @@ struct xhci_stream_info {
747747
* (DMI) also limits the total bandwidth (across all domains) that can be used.
748748
*/
749749
struct xhci_bw_info {
750+
/* ep_interval is zero-based */
750751
unsigned int ep_interval;
751-
/* mult and num_packets are zero-based */
752+
/* mult and num_packets are one-based */
752753
unsigned int mult;
753754
unsigned int num_packets;
754755
unsigned int max_packet_size;

0 commit comments

Comments
 (0)