Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / drivers / usb / misc / usbtest.c
index 2fb1fae..983e104 100644 (file)
@@ -1,7 +1,3 @@
-#include <linux/config.h>
-#if !defined (DEBUG) && defined (CONFIG_USB_DEBUG)
-#   define DEBUG
-#endif
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/init.h>
@@ -9,7 +5,7 @@
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
-#include <asm/scatterlist.h>
+#include <linux/scatterlist.h>
 
 #include <linux/usb.h>
 
@@ -121,8 +117,8 @@ get_endpoints (struct usbtest_dev *dev, struct usb_interface *intf)
        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;
@@ -216,11 +212,11 @@ static struct urb *simple_alloc_urb (
        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;
@@ -231,7 +227,7 @@ static struct urb *simple_alloc_urb (
                        &urb->transfer_dma);
        if (!urb->transfer_buffer) {
                usb_free_urb (urb);
-               urb = 0;
+               urb = NULL;
        } else
                memset (urb->transfer_buffer, 0, bytes);
        return urb;
@@ -380,23 +376,30 @@ alloc_sglist (int nents, int max, int vary)
 
        sg = kmalloc (nents * sizeof *sg, SLAB_KERNEL);
        if (!sg)
-               return 0;
-       memset (sg, 0, nents * sizeof *sg);
+               return NULL;
 
        for (i = 0; i < nents; i++) {
                char            *buf;
+               unsigned        j;
 
-               buf = kmalloc (size, SLAB_KERNEL);
+               buf = kzalloc (size, SLAB_KERNEL);
                if (!buf) {
                        free_sglist (sg, i);
-                       return 0;
+                       return NULL;
                }
-               memset (buf, 0, size);
 
                /* kmalloc pages are always physically contiguous! */
-               sg [i].page = virt_to_page (buf);
-               sg [i].offset = offset_in_page (buf);
-               sg [i].length = size;
+               sg_init_one(&sg[i], buf, size);
+
+               switch (pattern) {
+               case 0:
+                       /* already zeroed */
+                       break;
+               case 1:
+                       for (j = 0; j < size; j++)
+                               *buf++ = (u8) (j % 63);
+                       break;
+               }
 
                if (vary) {
                        size += vary;
@@ -432,6 +435,8 @@ static int perform_sglist (
                usb_sg_wait (req);
                retval = req->status;
 
+               /* FIXME check resulting data pattern */
+
                /* FIXME if endpoint halted, clear halt (and log) */
        }
 
@@ -459,9 +464,9 @@ static int perform_sglist (
  * or remote wakeup (which needs human interaction).
  */
 
-static int realworld = 1;
-MODULE_PARM (realworld, "i");
-MODULE_PARM_DESC (realworld, "clear to demand stricter ch9 compliance");
+static unsigned realworld = 1;
+module_param (realworld, uint, 0);
+MODULE_PARM_DESC (realworld, "clear to demand stricter spec compliance");
 
 static int get_altsetting (struct usbtest_dev *dev)
 {
@@ -472,7 +477,7 @@ static int get_altsetting (struct usbtest_dev *dev)
        retval = usb_control_msg (udev, usb_rcvctrlpipe (udev, 0),
                        USB_REQ_GET_INTERFACE, USB_DIR_IN|USB_RECIP_INTERFACE,
                        0, iface->altsetting [0].desc.bInterfaceNumber,
-                       dev->buf, 1, HZ * USB_CTRL_GET_TIMEOUT);
+                       dev->buf, 1, USB_CTRL_GET_TIMEOUT);
        switch (retval) {
        case 1:
                return dev->buf [0];
@@ -527,10 +532,9 @@ static int is_good_config (char *buf, int len)
                return 0;
        }
 
-       le16_to_cpus (&config->wTotalLength);
-       if (config->wTotalLength == len)                /* read it all */
+       if (le16_to_cpu(config->wTotalLength) == len)           /* read it all */
                return 1;
-       if (config->wTotalLength >= TBUF_SIZE)          /* max partial read */
+       if (le16_to_cpu(config->wTotalLength) >= TBUF_SIZE)             /* max partial read */
                return 1;
        dbg ("bogus config descriptor read size");
        return 0;
@@ -603,11 +607,10 @@ static int ch9_postconfig (struct usbtest_dev *dev)
                retval = usb_control_msg (udev, usb_rcvctrlpipe (udev, 0),
                                USB_REQ_GET_CONFIGURATION,
                                USB_DIR_IN | USB_RECIP_DEVICE,
-                               0, 0, dev->buf, 1, HZ * USB_CTRL_GET_TIMEOUT);
+                               0, 0, dev->buf, 1, USB_CTRL_GET_TIMEOUT);
                if (retval != 1 || dev->buf [0] != expected) {
-                       dev_dbg (&iface->dev,
-                               "get config --> %d (%d)\n", retval,
-                               expected);
+                       dev_dbg (&iface->dev, "get config --> %d %d (1 %d)\n",
+                               retval, dev->buf[0], expected);
                        return (retval < 0) ? retval : -EDOM;
                }
        }
@@ -636,8 +639,8 @@ static int ch9_postconfig (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;
+       if (le16_to_cpu(udev->descriptor.bcdUSB) == 0x0200) {
+               struct usb_qualifier_descriptor         *d = NULL;
 
                /* device qualifier [9.6.2] */
                retval = usb_get_descriptor (udev,
@@ -798,7 +801,9 @@ error:
 
                                if (u == urb || !u->dev)
                                        continue;
+                               spin_unlock(&ctx->lock);
                                status = usb_unlink_urb (u);
+                               spin_lock(&ctx->lock);
                                switch (status) {
                                case -EINPROGRESS:
                                case -EBUSY:
@@ -817,11 +822,11 @@ error:
                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)
@@ -850,10 +855,9 @@ test_ctrl_queue (struct usbtest_dev *dev, struct usbtest_param *param)
         * as with bulk/intr sglists, sglen is the queue depth; it also
         * controls which subtests run (more tests than sglen) or rerun.
         */
-       urb = kmalloc (param->sglen * sizeof (struct urb *), SLAB_KERNEL);
+       urb = kcalloc(param->sglen, sizeof(struct urb *), SLAB_KERNEL);
        if (!urb)
-               goto cleanup;
-       memset (urb, 0, param->sglen * sizeof (struct urb *));
+               return -ENOMEM;
        for (i = 0; i < param->sglen; i++) {
                int                     pipe = usb_rcvctrlpipe (udev, 0);
                unsigned                len;
@@ -954,13 +958,13 @@ 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->epmaxpacketin [0];
+                       len = 1024 - udev->descriptor.bMaxPacketSize0;
                        expected = -EREMOTEIO;
                        break;
                case 14:        // short read; try to fill the last packet
                        req.wValue = cpu_to_le16 ((USB_DT_DEVICE << 8) | 0);
                        // device descriptor size == 18 bytes 
-                       len = udev->epmaxpacketin [0];
+                       len = udev->descriptor.bMaxPacketSize0;
                        switch (len) {
                        case 8:         len = 24; break;
                        case 16:        len = 32; break;
@@ -985,10 +989,10 @@ test_ctrl_queue (struct usbtest_dev *dev, struct usbtest_param *param)
                reqp->number = i % NUM_SUBCASES;
                reqp->expected = expected;
                u->setup_packet = (char *) &reqp->setup;
+               u->transfer_flags |= URB_NO_SETUP_DMA_MAP;
 
                u->context = &context;
                u->complete = ctrl_complete;
-               u->transfer_flags |= URB_ASYNC_UNLINK;
        }
 
        /* queue the urbs */
@@ -1054,8 +1058,6 @@ static int unlink1 (struct usbtest_dev *dev, int pipe, int size, int async)
        urb = simple_alloc_urb (testdev_to_usbdev (dev), pipe, size);
        if (!urb)
                return -ENOMEM;
-       if (async)
-               urb->transfer_flags |= URB_ASYNC_UNLINK;
        urb->context = &completion;
        urb->complete = unlink1_callback;
 
@@ -1074,17 +1076,20 @@ static int unlink1 (struct usbtest_dev *dev, int pipe, int size, int async)
         * 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;
@@ -1095,9 +1100,10 @@ retry:
        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)
@@ -1171,7 +1177,7 @@ static int test_halt (int ep, struct urb *urb)
        retval = usb_control_msg (urb->dev, usb_sndctrlpipe (urb->dev, 0),
                        USB_REQ_SET_FEATURE, USB_RECIP_ENDPOINT,
                        USB_ENDPOINT_HALT, ep,
-                       NULL, 0, HZ * USB_CTRL_SET_TIMEOUT);
+                       NULL, 0, USB_CTRL_SET_TIMEOUT);
        if (retval < 0) {
                dbg ("ep %02x couldn't set halt, %d", ep, retval);
                return retval;
@@ -1202,7 +1208,7 @@ static int halt_simple (struct usbtest_dev *dev)
        struct urb      *urb;
 
        urb = simple_alloc_urb (testdev_to_usbdev (dev), 0, 512);
-       if (urb == 0)
+       if (urb == NULL)
                return -ENOMEM;
 
        if (dev->in_pipe) {
@@ -1236,12 +1242,13 @@ done:
 static int ctrl_out (struct usbtest_dev *dev,
                unsigned count, unsigned length, unsigned vary)
 {
-       unsigned                i, j, len, retval;
+       unsigned                i, j, len;
+       int                     retval;
        u8                      *buf;
        char                    *what = "?";
        struct usb_device       *udev;
-       
-       if (length > 0xffff || vary >= length)
+
+       if (length < 1 || length > 0xffff || vary >= length)
                return -EINVAL;
 
        buf = kmalloc(length, SLAB_KERNEL);
@@ -1261,18 +1268,28 @@ static int ctrl_out (struct usbtest_dev *dev,
                        buf [j] = i + j;
                retval = usb_control_msg (udev, usb_sndctrlpipe (udev,0),
                                0x5b, USB_DIR_OUT|USB_TYPE_VENDOR,
-                               0, 0, buf, len, HZ * USB_CTRL_SET_TIMEOUT);
+                               0, 0, buf, len, USB_CTRL_SET_TIMEOUT);
                if (retval != len) {
                        what = "write";
+                       if (retval >= 0) {
+                               INFO(dev, "ctrl_out, wlen %d (expected %d)\n",
+                                               retval, len);
+                               retval = -EBADMSG;
+                       }
                        break;
                }
 
                /* read it back -- assuming nothing intervened!!  */
                retval = usb_control_msg (udev, usb_rcvctrlpipe (udev,0),
                                0x5c, USB_DIR_IN|USB_TYPE_VENDOR,
-                               0, 0, buf, len, HZ * USB_CTRL_GET_TIMEOUT);
+                               0, 0, buf, len, USB_CTRL_GET_TIMEOUT);
                if (retval != len) {
                        what = "read";
+                       if (retval >= 0) {
+                               INFO(dev, "ctrl_out, rlen %d (expected %d)\n",
+                                               retval, len);
+                               retval = -EBADMSG;
+                       }
                        break;
                }
 
@@ -1291,8 +1308,13 @@ static int ctrl_out (struct usbtest_dev *dev,
                }
 
                len += vary;
+
+               /* [real world] the "zero bytes IN" case isn't really used.
+                * hardware can easily trip up in this wierd case, since its
+                * status stage is IN, not OUT like other ep0in transfers.
+                */
                if (len > length)
-                       len = 0;
+                       len = realworld ? 1 : 0;
        }
 
        if (retval < 0)
@@ -1315,7 +1337,9 @@ struct iso_context {
        unsigned                pending;
        spinlock_t              lock;
        struct completion       done;
+       int                     submit_error;
        unsigned long           errors;
+       unsigned long           packet_count;
        struct usbtest_dev      *dev;
 };
 
@@ -1326,10 +1350,14 @@ static void iso_callback (struct urb *urb, struct pt_regs *regs)
        spin_lock(&ctx->lock);
        ctx->count--;
 
+       ctx->packet_count += urb->number_of_packets;
        if (urb->error_count > 0)
                ctx->errors += urb->error_count;
+       else if (urb->status != 0)
+               ctx->errors += urb->number_of_packets;
 
-       if (urb->status == 0 && ctx->count > (ctx->pending - 1)) {
+       if (urb->status == 0 && ctx->count > (ctx->pending - 1)
+                       && !ctx->submit_error) {
                int status = usb_submit_urb (urb, GFP_ATOMIC);
                switch (status) {
                case 0:
@@ -1340,6 +1368,8 @@ static void iso_callback (struct urb *urb, struct pt_regs *regs)
                                        status);
                        /* FALLTHROUGH */
                case -ENODEV:                   /* disconnected */
+               case -ESHUTDOWN:                /* endpoint disabled */
+                       ctx->submit_error = 1;
                        break;
                }
        }
@@ -1349,10 +1379,10 @@ static void iso_callback (struct urb *urb, struct pt_regs *regs)
        if (ctx->pending == 0) {
                if (ctx->errors)
                        dev_dbg (&ctx->dev->intf->dev,
-                               "iso test, %lu errors\n",
-                               ctx->errors);
+                               "iso test, %lu errors out of %lu\n",
+                               ctx->errors, ctx->packet_count);
                complete (&ctx->done);
-       } else
+       }
 done:
        spin_unlock(&ctx->lock);
 }
@@ -1368,9 +1398,9 @@ static struct urb *iso_alloc_urb (
        unsigned                i, maxp, packets;
 
        if (bytes < 0 || !desc)
-               return 0;
-       maxp = 0x7ff & desc->wMaxPacketSize;
-       maxp *= 1 + (0x3 & (desc->wMaxPacketSize >> 11));
+               return NULL;
+       maxp = 0x7ff & le16_to_cpu(desc->wMaxPacketSize);
+       maxp *= 1 + (0x3 & (le16_to_cpu(desc->wMaxPacketSize) >> 11));
        packets = (bytes + maxp - 1) / maxp;
 
        urb = usb_alloc_urb (packets, SLAB_KERNEL);
@@ -1385,7 +1415,7 @@ static struct urb *iso_alloc_urb (
                        &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++) {
@@ -1411,15 +1441,14 @@ test_iso_queue (struct usbtest_dev *dev, struct usbtest_param *param,
        struct usb_device       *udev;
        unsigned                i;
        unsigned long           packets = 0;
-       int                     status;
+       int                     status = 0;
        struct urb              *urbs[10];      /* FIXME no limit */
 
        if (param->sglen > 10)
                return -EDOM;
 
+       memset(&context, 0, sizeof context);
        context.count = param->iterations * param->sglen;
-       context.pending = param->sglen;
-       context.errors = 0;
        context.dev = dev;
        init_completion (&context.done);
        spin_lock_init (&context.lock);
@@ -1430,7 +1459,7 @@ test_iso_queue (struct usbtest_dev *dev, struct usbtest_param *param,
                "... iso period %d %sframes, wMaxPacket %04x\n",
                1 << (desc->bInterval - 1),
                (udev->speed == USB_SPEED_HIGH) ? "micro" : "",
-               desc->wMaxPacketSize);
+               le16_to_cpu(desc->wMaxPacketSize));
 
        for (i = 0; i < param->sglen; i++) {
                urbs [i] = iso_alloc_urb (udev, pipe, desc,
@@ -1451,20 +1480,37 @@ test_iso_queue (struct usbtest_dev *dev, struct usbtest_param *param,
 
        spin_lock_irq (&context.lock);
        for (i = 0; i < param->sglen; i++) {
+               ++context.pending;
                status = usb_submit_urb (urbs [i], SLAB_ATOMIC);
                if (status < 0) {
                        ERROR (dev, "submit iso[%d], error %d\n", i, status);
-                       if (i == 0)
+                       if (i == 0) {
+                               spin_unlock_irq (&context.lock);
                                goto fail;
+                       }
 
                        simple_free_urb (urbs [i]);
                        context.pending--;
+                       context.submit_error = 1;
+                       break;
                }
        }
        spin_unlock_irq (&context.lock);
 
        wait_for_completion (&context.done);
-       return 0;
+
+       /*
+        * Isochronous transfers are expected to fail sometimes.  As an
+        * arbitrary limit, we will report an error if any submissions
+        * fail or if the transfer failure rate is > 10%.
+        */
+       if (status != 0)
+               ;
+       else if (context.submit_error)
+               status = -EACCES;
+       else if (context.errors > context.packet_count / 10)
+               status = -EIO;
+       return status;
 
 fail:
        for (i = 0; i < param->sglen; i++) {
@@ -1515,6 +1561,11 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
        if (down_interruptible (&dev->sem))
                return -ERESTARTSYS;
 
+       if (intf->dev.power.power_state.event != PM_EVENT_ON) {
+               up (&dev->sem);
+               return -EHOSTUNREACH;
+       }
+
        /* some devices, like ez-usb default devices, need a non-default
         * altsetting to have any active endpoints.  some tests change
         * altsettings; force a default so most tests don't need to check.
@@ -1758,8 +1809,10 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
        case 14:
                if (!dev->info->ctrl_out)
                        break;
-               dev_dbg (&intf->dev, "TEST 14:  %d ep0out, 0..%d vary %d\n",
-                               param->iterations, param->length, param->vary);
+               dev_dbg (&intf->dev, "TEST 14:  %d ep0out, %d..%d vary %d\n",
+                               param->iterations,
+                               realworld ? 1 : 0, param->length,
+                               param->vary);
                retval = ctrl_out (dev, param->iterations, 
                                param->length, param->vary);
                break;
@@ -1808,17 +1861,17 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
 
 /*-------------------------------------------------------------------------*/
 
-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
 
@@ -1837,20 +1890,19 @@ usbtest_probe (struct usb_interface *intf, const struct usb_device_id *id)
        /* specify devices by module parameters? */
        if (id->match_flags == 0) {
                /* vendor match required, product match optional */
-               if (!vendor || udev->descriptor.idVendor != (u16)vendor)
+               if (!vendor || le16_to_cpu(udev->descriptor.idVendor) != (u16)vendor)
                        return -ENODEV;
-               if (product && udev->descriptor.idProduct != (u16)product)
+               if (product && le16_to_cpu(udev->descriptor.idProduct) != (u16)product)
                        return -ENODEV;
                dbg ("matched module params, vend=0x%04x prod=0x%04x",
-                               udev->descriptor.idVendor,
-                               udev->descriptor.idProduct);
+                               le16_to_cpu(udev->descriptor.idVendor),
+                               le16_to_cpu(udev->descriptor.idProduct));
        }
 #endif
 
-       dev = kmalloc (sizeof *dev, SLAB_KERNEL);
+       dev = kzalloc(sizeof(*dev), SLAB_KERNEL);
        if (!dev)
                return -ENOMEM;
-       memset (dev, 0, sizeof *dev);
        info = (struct usbtest_info *) id->driver_info;
        dev->info = info;
        init_MUTEX (&dev->sem);
@@ -1858,7 +1910,7 @@ usbtest_probe (struct usb_interface *intf, const struct usb_device_id *id)
        dev->intf = intf;
 
        /* cacheline-aligned scratch for i/o */
-       if ((dev->buf = kmalloc (TBUF_SIZE, SLAB_KERNEL)) == 0) {
+       if ((dev->buf = kmalloc (TBUF_SIZE, SLAB_KERNEL)) == NULL) {
                kfree (dev);
                return -ENOMEM;
        }
@@ -1923,6 +1975,17 @@ usbtest_probe (struct usb_interface *intf, const struct usb_device_id *id)
        return 0;
 }
 
+static int usbtest_suspend (struct usb_interface *intf, pm_message_t message)
+{
+       return 0;
+}
+
+static int usbtest_resume (struct usb_interface *intf)
+{
+       return 0;
+}
+
+
 static void usbtest_disconnect (struct usb_interface *intf)
 {
        struct usbtest_dev      *dev = usb_get_intfdata (intf);
@@ -2105,12 +2168,13 @@ static struct usb_device_id id_table [] = {
 MODULE_DEVICE_TABLE (usb, id_table);
 
 static struct usb_driver usbtest_driver = {
-       .owner =        THIS_MODULE,
        .name =         "usbtest",
        .id_table =     id_table,
        .probe =        usbtest_probe,
        .ioctl =        usbtest_ioctl,
        .disconnect =   usbtest_disconnect,
+       .suspend =      usbtest_suspend,
+       .resume =       usbtest_resume,
 };
 
 /*-------------------------------------------------------------------------*/