usb: usbtest: two super speed fixes for usbtest
authorPaul Zimmerman <Paul.Zimmerman@synopsys.com>
Mon, 16 Apr 2012 21:19:07 +0000 (14:19 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 May 2012 17:38:27 +0000 (13:38 -0400)
bMaxPacketSize0 field for super speed is a power of 2, not a count.
The size itself is always 512.

Max packet size for a super speed bulk endpoint is 1024, so
allocate the urb size in halt_simple() accordingly.

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/misc/usbtest.c

index 9dcb68f04f03025265f3747e6f7bf072ab1b8958..055b84adedac678b4a20dfe6eaeed25a123b3d32 100644 (file)
@@ -1028,7 +1028,10 @@ test_ctrl_queue(struct usbtest_dev *dev, struct usbtest_param *param)
                case 13:        /* short read, resembling case 10 */
                        req.wValue = cpu_to_le16((USB_DT_CONFIG << 8) | 0);
                        /* last data packet "should" be DATA1, not DATA0 */
-                       len = 1024 - udev->descriptor.bMaxPacketSize0;
+                       if (udev->speed == USB_SPEED_SUPER)
+                               len = 1024 - 512;
+                       else
+                               len = 1024 - udev->descriptor.bMaxPacketSize0;
                        expected = -EREMOTEIO;
                        break;
                case 14:        /* short read; try to fill the last packet */
@@ -1387,11 +1390,15 @@ static int test_halt(struct usbtest_dev *tdev, int ep, struct urb *urb)
 
 static int halt_simple(struct usbtest_dev *dev)
 {
-       int             ep;
-       int             retval = 0;
-       struct urb      *urb;
+       int                     ep;
+       int                     retval = 0;
+       struct urb              *urb;
+       struct usb_device       *udev = testdev_to_usbdev(dev);
 
-       urb = simple_alloc_urb(testdev_to_usbdev(dev), 0, 512);
+       if (udev->speed == USB_SPEED_SUPER)
+               urb = simple_alloc_urb(udev, 0, 1024);
+       else
+               urb = simple_alloc_urb(udev, 0, 512);
        if (urb == NULL)
                return -ENOMEM;