diff options
Diffstat (limited to 'drivers/usb/misc/usbtest.c')
-rw-r--r-- | drivers/usb/misc/usbtest.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 5f1a19d1497d..a9f06d76960f 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
@@ -1072,23 +1072,34 @@ static int unlink1 (struct usbtest_dev *dev, int pipe, int size, int async) | |||
1072 | */ | 1072 | */ |
1073 | msleep (jiffies % (2 * INTERRUPT_RATE)); | 1073 | msleep (jiffies % (2 * INTERRUPT_RATE)); |
1074 | if (async) { | 1074 | if (async) { |
1075 | retry: | 1075 | while (!completion_done(&completion)) { |
1076 | retval = usb_unlink_urb (urb); | 1076 | retval = usb_unlink_urb(urb); |
1077 | if (retval == -EBUSY || retval == -EIDRM) { | 1077 | |
1078 | /* we can't unlink urbs while they're completing. | 1078 | switch (retval) { |
1079 | * or if they've completed, and we haven't resubmitted. | 1079 | case -EBUSY: |
1080 | * "normal" drivers would prevent resubmission, but | 1080 | case -EIDRM: |
1081 | * since we're testing unlink paths, we can't. | 1081 | /* we can't unlink urbs while they're completing |
1082 | */ | 1082 | * or if they've completed, and we haven't |
1083 | ERROR(dev, "unlink retry\n"); | 1083 | * resubmitted. "normal" drivers would prevent |
1084 | goto retry; | 1084 | * resubmission, but since we're testing unlink |
1085 | * paths, we can't. | ||
1086 | */ | ||
1087 | ERROR(dev, "unlink retry\n"); | ||
1088 | continue; | ||
1089 | case 0: | ||
1090 | case -EINPROGRESS: | ||
1091 | break; | ||
1092 | |||
1093 | default: | ||
1094 | dev_err(&dev->intf->dev, | ||
1095 | "unlink fail %d\n", retval); | ||
1096 | return retval; | ||
1097 | } | ||
1098 | |||
1099 | break; | ||
1085 | } | 1100 | } |
1086 | } else | 1101 | } else |
1087 | usb_kill_urb (urb); | 1102 | usb_kill_urb (urb); |
1088 | if (!(retval == 0 || retval == -EINPROGRESS)) { | ||
1089 | dev_err(&dev->intf->dev, "unlink fail %d\n", retval); | ||
1090 | return retval; | ||
1091 | } | ||
1092 | 1103 | ||
1093 | wait_for_completion (&completion); | 1104 | wait_for_completion (&completion); |
1094 | retval = urb->status; | 1105 | retval = urb->status; |