]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/input/xpad.c
/home/lenb/src/to-akpm branch 'acpi-2.6.12'
[linux-2.6-omap-h63xx.git] / drivers / usb / input / xpad.c
index a8076ccc0b2ef8ef24c1189abc5458ae3705f093..18125e0bffa210d3c8f51f217531dc3e7c87d50d 100644 (file)
@@ -62,6 +62,7 @@
 #include <linux/module.h>
 #include <linux/smp_lock.h>
 #include <linux/usb.h>
+#include <linux/usb_input.h>
 
 #define DRIVER_VERSION "v0.0.5"
 #define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>"
@@ -110,7 +111,6 @@ struct usb_xpad {
        dma_addr_t idata_dma;
 
        char phys[65];                          /* physical device path */
-       int open_count;                         /* reference count */
 };
 
 /*
@@ -197,14 +197,9 @@ static int xpad_open (struct input_dev *dev)
 {
        struct usb_xpad *xpad = dev->private;
 
-       if (xpad->open_count++)
-               return 0;
-
        xpad->irq_in->dev = xpad->udev;
-       if (usb_submit_urb(xpad->irq_in, GFP_KERNEL)) {
-               xpad->open_count--;
+       if (usb_submit_urb(xpad->irq_in, GFP_KERNEL))
                return -EIO;
-       }
 
        return 0;
 }
@@ -213,8 +208,7 @@ static void xpad_close (struct input_dev *dev)
 {
        struct usb_xpad *xpad = dev->private;
 
-       if (!--xpad->open_count)
-               usb_kill_urb(xpad->irq_in);
+       usb_kill_urb(xpad->irq_in);
 }
 
 static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id)
@@ -263,10 +257,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
 
        xpad->udev = udev;
 
-       xpad->dev.id.bustype = BUS_USB;
-       xpad->dev.id.vendor = le16_to_cpu(udev->descriptor.idVendor);
-       xpad->dev.id.product = le16_to_cpu(udev->descriptor.idProduct);
-       xpad->dev.id.version = le16_to_cpu(udev->descriptor.bcdDevice);
+       usb_to_input_id(udev, &xpad->dev.id);
        xpad->dev.dev = &intf->dev;
        xpad->dev.private = xpad;
        xpad->dev.name = xpad_device[i].name;