for (tmp = 0; tmp < intf->num_altsetting; tmp++) {
unsigned ep;
- in = out = 0;
- iso_in = iso_out = 0;
+ in = out = NULL;
+ iso_in = iso_out = NULL;
alt = intf->altsetting + tmp;
/* take the first altsetting with in-bulk + out-bulk;
struct urb *urb;
if (bytes < 0)
- return 0;
+ return NULL;
urb = usb_alloc_urb (0, SLAB_KERNEL);
if (!urb)
return urb;
- usb_fill_bulk_urb (urb, udev, pipe, 0, bytes, simple_callback, 0);
+ usb_fill_bulk_urb (urb, udev, pipe, NULL, bytes, simple_callback, NULL);
urb->interval = (udev->speed == USB_SPEED_HIGH)
? (INTERRUPT_RATE << 3)
: INTERRUPT_RATE;
&urb->transfer_dma);
if (!urb->transfer_buffer) {
usb_free_urb (urb);
- urb = 0;
+ urb = NULL;
} else
memset (urb->transfer_buffer, 0, bytes);
return urb;
sg = kmalloc (nents * sizeof *sg, SLAB_KERNEL);
if (!sg)
- return 0;
+ return NULL;
memset (sg, 0, nents * sizeof *sg);
for (i = 0; i < nents; i++) {
buf = kmalloc (size, SLAB_KERNEL);
if (!buf) {
free_sglist (sg, i);
- return 0;
+ return NULL;
}
memset (buf, 0, size);
* or remote wakeup (which needs human interaction).
*/
-static int realworld = 1;
-MODULE_PARM (realworld, "i");
+static unsigned realworld = 1;
+module_param (realworld, uint, 0);
MODULE_PARM_DESC (realworld, "clear to demand stricter ch9 compliance");
static int get_altsetting (struct usbtest_dev *dev)
/* and sometimes [9.2.6.6] speed dependent descriptors */
if (udev->descriptor.bcdUSB == 0x0200) { /* pre-swapped */
- struct usb_qualifier_descriptor *d = 0;
+ struct usb_qualifier_descriptor *d = NULL;
/* device qualifier [9.6.2] */
retval = usb_get_descriptor (udev,
if ((status = usb_submit_urb (urb, SLAB_ATOMIC)) != 0) {
dbg ("can't resubmit ctrl %02x.%02x, err %d",
reqp->bRequestType, reqp->bRequest, status);
- urb->dev = 0;
+ urb->dev = NULL;
} else
ctx->pending++;
} else
- urb->dev = 0;
+ urb->dev = NULL;
/* signal completion when nothing's queued */
if (ctx->pending == 0)
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)
unsigned i, maxp, packets;
if (bytes < 0 || !desc)
- return 0;
+ return NULL;
maxp = 0x7ff & desc->wMaxPacketSize;
maxp *= 1 + (0x3 & (desc->wMaxPacketSize >> 11));
packets = (bytes + maxp - 1) / maxp;
&urb->transfer_dma);
if (!urb->transfer_buffer) {
usb_free_urb (urb);
- return 0;
+ return NULL;
}
memset (urb->transfer_buffer, 0, bytes);
for (i = 0; i < packets; i++) {
/*-------------------------------------------------------------------------*/
-static int force_interrupt = 0;
-MODULE_PARM (force_interrupt, "i");
+static unsigned force_interrupt = 0;
+module_param (force_interrupt, uint, 0);
MODULE_PARM_DESC (force_interrupt, "0 = test default; else interrupt");
#ifdef GENERIC
-static int vendor;
-MODULE_PARM (vendor, "h");
+static unsigned short vendor;
+module_param(vendor, ushort, 0);
MODULE_PARM_DESC (vendor, "vendor code (from usb-if)");
-static int product;
-MODULE_PARM (product, "h");
+static unsigned short product;
+module_param(product, ushort, 0);
MODULE_PARM_DESC (product, "product code (from vendor)");
#endif