[RFC 1/2] xhci: Fix mult base in endpoint bandwidth info.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <sarah.a.sharp@xxxxxxxxxxxxxxx>
---
 drivers/usb/host/xhci-mem.c |    9 +++++----
 drivers/usb/host/xhci.h     |    3 ++-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index c4b8959..94a8b28 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1473,11 +1473,12 @@ void xhci_update_bw_info(struct xhci_hcd *xhci,
 			/* Added or changed endpoint */
 			bw_info->ep_interval = CTX_TO_EP_INTERVAL(
 					le32_to_cpu(ep_ctx->ep_info));
-			bw_info->mult = CTX_TO_EP_MULT(
-					le32_to_cpu(ep_ctx->ep_info));
-			/* Number of packets is zero-based in the input context,
-			 * but we want one-based for the interval table.
+			/* Number of packets and mult are zero-based in the
+			 * input context, but we want one-based for the
+			 * interval table.
 			 */
+			bw_info->mult = CTX_TO_EP_MULT(
+					le32_to_cpu(ep_ctx->ep_info)) + 1;
 			bw_info->num_packets = CTX_TO_MAX_BURST(
 					le32_to_cpu(ep_ctx->ep_info2)) + 1;
 			bw_info->max_packet_size = MAX_PACKET_DECODED(
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index a2fe0b0..c5d6278 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -747,8 +747,9 @@ struct xhci_stream_info {
  * (DMI) also limits the total bandwidth (across all domains) that can be used.
  */
 struct xhci_bw_info {
+	/* ep_interval is zero-based */
 	unsigned int		ep_interval;
-	/* mult and num_packets are zero-based */
+	/* mult and num_packets are one-based */
 	unsigned int		mult;
 	unsigned int		num_packets;
 	unsigned int		max_packet_size;
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux