urb = simple_alloc_urb (testdev_to_usbdev (dev), pipe, size);
if (!urb)
return -ENOMEM;
- if (async)
- urb->transfer_flags |= URB_ASYNC_UNLINK;
+ urb->transfer_flags |= URB_ASYNC_UNLINK;
urb->context = &completion;
urb->complete = unlink1_callback;
* hcd states and code paths, even with little other system load.
*/
msleep (jiffies % (2 * INTERRUPT_RATE));
+ if (async) {
retry:
- retval = usb_unlink_urb (urb);
- if (retval == -EBUSY || retval == -EIDRM) {
- /* we can't unlink urbs while they're completing.
- * or if they've completed, and we haven't resubmitted.
- * "normal" drivers would prevent resubmission, but
- * since we're testing unlink paths, we can't.
- */
- dev_dbg (&dev->intf->dev, "unlink retry\n");
- goto retry;
- }
+ retval = usb_unlink_urb (urb);
+ if (retval == -EBUSY || retval == -EIDRM) {
+ /* we can't unlink urbs while they're completing.
+ * or if they've completed, and we haven't resubmitted.
+ * "normal" drivers would prevent resubmission, but
+ * since we're testing unlink paths, we can't.
+ */
+ dev_dbg (&dev->intf->dev, "unlink retry\n");
+ goto retry;
+ }
+ } else
+ usb_kill_urb (urb);
if (!(retval == 0 || retval == -EINPROGRESS)) {
dev_dbg (&dev->intf->dev, "unlink fail %d\n", retval);
return retval;
simple_free_urb (urb);
if (async)
- return (retval != -ECONNRESET) ? -ECONNRESET : 0;
+ return (retval == -ECONNRESET) ? 0 : retval - 1000;
else
- return (retval != -ENOENT) ? -ENOENT : 0;
+ return (retval == -ENOENT || retval == -EPERM) ?
+ 0 : retval - 2000;
}
static int unlink_simple (struct usbtest_dev *dev, int pipe, int len)