usb: misc: usbtest: make use of new usb_endpoint_maxp_mult()
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Wed, 28 Sep 2016 10:40:03 +0000 (13:40 +0300)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Thu, 3 Nov 2016 08:38:21 +0000 (10:38 +0200)
We have introduced a helper to calculate multiplier
value from wMaxPacketSize. Start using it.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/misc/usbtest.c

index 5c8210dc6fd9cf9c0b39003d92b59a1440ddb0c2..8edfbc8bf345bcbc3d1c2512cb4d1f1e42c400c1 100644 (file)
@@ -1915,7 +1915,7 @@ static struct urb *iso_alloc_urb(
        if (bytes < 0 || !desc)
                return NULL;
        maxp = 0x7ff & usb_endpoint_maxp(desc);
-       maxp *= 1 + (0x3 & (usb_endpoint_maxp(desc) >> 11));
+       maxp *= usb_endpoint_maxp_mult(desc);
        packets = DIV_ROUND_UP(bytes, maxp);
 
        urb = usb_alloc_urb(packets, GFP_KERNEL);
@@ -2002,7 +2002,7 @@ test_queue(struct usbtest_dev *dev, struct usbtest_param_32 *param,
                        1 << (desc->bInterval - 1),
                        (udev->speed == USB_SPEED_HIGH) ? "micro" : "",
                        usb_endpoint_maxp(desc) & 0x7ff,
-                       1 + (0x3 & (usb_endpoint_maxp(desc) >> 11)));
+                       usb_endpoint_maxp_mult(desc));
 
                dev_info(&dev->intf->dev,
                        "total %lu msec (%lu packets)\n",