This is a note to let you know that I've just added the patch titled

    usb: host: ehci: make use of new usb_endpoint_maxp_mult()

to my usb git tree which can be found at
    git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the usb-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From e3b89080f2c50936a9f6eccedb1e07e293777f0a Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 13:38:18 +0300
Subject: usb: host: ehci: make use of new usb_endpoint_maxp_mult()

We have introduced a helper to calculate multiplier
value from wMaxPacketSize. Start using it.

Cc: Alan Stern <st...@rowland.harvard.edu>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/host/ehci-q.c     | 10 ++++++----
 drivers/usb/host/ehci-sched.c |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index eca3710d8fc4..a45a5dc7ed9f 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -550,8 +550,6 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
 
 /*-------------------------------------------------------------------------*/
 
-// high bandwidth multiplier, as encoded in highspeed endpoint descriptors
-#define hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03))
 // ... and packet size, for any kind of endpoint descriptor
 #define max_packet(wMaxPacketSize) ((wMaxPacketSize) & 0x07ff)
 
@@ -770,9 +768,11 @@ qh_make (
        gfp_t                   flags
 ) {
        struct ehci_qh          *qh = ehci_qh_alloc (ehci, flags);
+       struct usb_host_endpoint *ep;
        u32                     info1 = 0, info2 = 0;
        int                     is_input, type;
        int                     maxp = 0;
+       int                     mult;
        struct usb_tt           *tt = urb->dev->tt;
        struct ehci_qh_hw       *hw;
 
@@ -787,7 +787,9 @@ qh_make (
 
        is_input = usb_pipein (urb->pipe);
        type = usb_pipetype (urb->pipe);
+       ep = usb_pipe_endpoint (urb->dev, urb->pipe);
        maxp = usb_maxpacket (urb->dev, urb->pipe, !is_input);
+       mult = usb_endpoint_maxp_mult (&ep->desc);
 
        /* 1024 byte maxpacket is a hardware ceiling.  High bandwidth
         * acts like up to 3KB, but is built from smaller packets.
@@ -810,7 +812,7 @@ qh_make (
 
                qh->ps.usecs = NS_TO_US(usb_calc_bus_time(USB_SPEED_HIGH,
                                is_input, 0,
-                               hb_mult(maxp) * max_packet(maxp)));
+                               mult * max_packet(maxp)));
                qh->ps.phase = NO_FRAME;
 
                if (urb->dev->speed == USB_SPEED_HIGH) {
@@ -929,7 +931,7 @@ qh_make (
                        info2 |= (EHCI_TUNE_MULT_HS << 30);
                } else {                /* PIPE_INTERRUPT */
                        info1 |= max_packet (maxp) << 16;
-                       info2 |= hb_mult (maxp) << 30;
+                       info2 |= mult << 30;
                }
                break;
        default:
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 1dfe54f14737..6a9fa2c3a24e 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -1064,7 +1064,7 @@ iso_stream_init(
 
        /* knows about ITD vs SITD */
        if (dev->speed == USB_SPEED_HIGH) {
-               unsigned multi = hb_mult(maxp);
+               unsigned multi = usb_endpoint_maxp_mult(&urb->ep->desc);
 
                stream->highspeed = 1;
 
-- 
2.10.2


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

Reply via email to