vserver 2.0 rc7
[linux-2.6.git] / drivers / usb / input / aiptek.c
index 81caa0d..94ce2a9 100644 (file)
@@ -297,8 +297,6 @@ struct aiptek_features {
        int firmwareCode;       /* prom/eeprom version            */
        char usbPath[64 + 1];   /* device's physical usb path     */
        char inputPath[64 + 1]; /* input device path              */
-       char manuName[64 + 1];  /* manufacturer name              */
-       char prodName[64 + 1];  /* product name                   */
 };
 
 struct aiptek_settings {
@@ -388,7 +386,7 @@ static int aiptek_convert_from_2s_complement(unsigned char c)
  * convention above.) I therefore have taken over REL_MISC and ABS_MISC
  * (for relative and absolute reports, respectively) for communicating
  * Proximity. Why two events? I thought it interesting to know if the
- * Proximity event occured while the tablet was in absolute or relative
+ * Proximity event occurred while the tablet was in absolute or relative
  * mode.
  *
  * Other tablets use the notion of a certain minimum stylus pressure
@@ -494,9 +492,9 @@ static void aiptek_irq(struct urb *urb, struct pt_regs *regs)
                } else {
                        input_regs(inputdev, regs);
 
-                       x = le16_to_cpu(get_unaligned((__u16 *) (data + 1)));
-                       y = le16_to_cpu(get_unaligned((__u16 *) (data + 3)));
-                       z = le16_to_cpu(get_unaligned((__u16 *) (data + 6)));
+                       x = le16_to_cpu(get_unaligned((__le16 *) (data + 1)));
+                       y = le16_to_cpu(get_unaligned((__le16 *) (data + 3)));
+                       z = le16_to_cpu(get_unaligned((__le16 *) (data + 6)));
 
                        p = (data[5] & 0x01) != 0 ? 1 : 0;
                        dv = (data[5] & 0x02) != 0 ? 1 : 0;
@@ -573,8 +571,8 @@ static void aiptek_irq(struct urb *urb, struct pt_regs *regs)
                        aiptek->diagnostic = AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED;
                } else {
                        input_regs(inputdev, regs);
-                       x = le16_to_cpu(get_unaligned((__u16 *) (data + 1)));
-                       y = le16_to_cpu(get_unaligned((__u16 *) (data + 3)));
+                       x = le16_to_cpu(get_unaligned((__le16 *) (data + 1)));
+                       y = le16_to_cpu(get_unaligned((__le16 *) (data + 3)));
 
                        jitterable = data[5] & 0x1c;
 
@@ -632,7 +630,7 @@ static void aiptek_irq(struct urb *urb, struct pt_regs *regs)
                pck = (data[1] & aiptek->curSetting.stylusButtonUpper) != 0 ? 1 : 0;
 
                macro = data[3];
-               z = le16_to_cpu(get_unaligned((__u16 *) (data + 4)));
+               z = le16_to_cpu(get_unaligned((__le16 *) (data + 4)));
 
                if (dv != 0) {
                        input_regs(inputdev, regs);
@@ -729,7 +727,7 @@ static void aiptek_irq(struct urb *urb, struct pt_regs *regs)
         * hat switches (which just so happen to be the macroKeys.)
         */
        else if (data[0] == 6) {
-               macro = le16_to_cpu(get_unaligned((__u16 *) (data + 1)));
+               macro = le16_to_cpu(get_unaligned((__le16 *) (data + 1)));
                input_regs(inputdev, regs);
 
                if (macro > 0) {
@@ -796,7 +794,7 @@ exit:
  * manufacturing revisions. In any event, we consider these 
  * IDs to not be model-specific nor unique.
  */
-struct usb_device_id aiptek_ids[] = {
+static const struct usb_device_id aiptek_ids[] = {
        {USB_DEVICE(USB_VENDOR_ID_AIPTEK, 0x01)},
        {USB_DEVICE(USB_VENDOR_ID_AIPTEK, 0x10)},
        {USB_DEVICE(USB_VENDOR_ID_AIPTEK, 0x20)},
@@ -837,7 +835,7 @@ static void aiptek_close(struct input_dev *inputdev)
        struct aiptek *aiptek = inputdev->private;
 
        if (--aiptek->openCount == 0) {
-               usb_unlink_urb(aiptek->urb);
+               usb_kill_urb(aiptek->urb);
        }
 }
 
@@ -855,7 +853,7 @@ aiptek_set_report(struct aiptek *aiptek,
                               USB_REQ_SET_REPORT,
                               USB_TYPE_CLASS | USB_RECIP_INTERFACE |
                               USB_DIR_OUT, (report_type << 8) + report_id,
-                              aiptek->ifnum, buffer, size, 5 * HZ);
+                              aiptek->ifnum, buffer, size, 5000);
 }
 
 static int
@@ -868,7 +866,7 @@ aiptek_get_report(struct aiptek *aiptek,
                               USB_REQ_GET_REPORT,
                               USB_TYPE_CLASS | USB_RECIP_INTERFACE |
                               USB_DIR_IN, (report_type << 8) + report_id,
-                              aiptek->ifnum, buffer, size, 5 * HZ);
+                              aiptek->ifnum, buffer, size, 5000);
 }
 
 /***********************************************************************
@@ -930,7 +928,7 @@ aiptek_query(struct aiptek *aiptek, unsigned char command, unsigned char data)
                    buf[0], buf[1], buf[2]);
                ret = -EIO;
        } else {
-               ret = le16_to_cpu(get_unaligned((__u16 *) (buf + 1)));
+               ret = le16_to_cpu(get_unaligned((__le16 *) (buf + 1)));
        }
        kfree(buf);
        return ret;
@@ -1089,7 +1087,7 @@ static ssize_t show_tabletManufacturer(struct device *dev, char *buf)
        if (aiptek == NULL)
                return 0;
 
-       retval = snprintf(buf, PAGE_SIZE, "%s\n", aiptek->features.manuName);
+       retval = snprintf(buf, PAGE_SIZE, "%s\n", aiptek->usbdev->manufacturer);
        return retval;
 }
 
@@ -1106,7 +1104,7 @@ static ssize_t show_tabletProduct(struct device *dev, char *buf)
        if (aiptek == NULL)
                return 0;
 
-       retval = snprintf(buf, PAGE_SIZE, "%s\n", aiptek->features.prodName);
+       retval = snprintf(buf, PAGE_SIZE, "%s\n", aiptek->usbdev->product);
        return retval;
 }
 
@@ -1324,7 +1322,7 @@ store_tabletXtilt(struct device *dev, const char *buf, size_t count)
        if (strcmp(buf, "disable") == 0) {
                aiptek->newSetting.xTilt = AIPTEK_TILT_DISABLE;
        } else {
-               x = (int)simple_strtol(buf, 0, 10);
+               x = (int)simple_strtol(buf, NULL, 10);
                if (x >= AIPTEK_TILT_MIN && x <= AIPTEK_TILT_MAX) {
                        aiptek->newSetting.xTilt = x;
                }
@@ -1366,7 +1364,7 @@ store_tabletYtilt(struct device *dev, const char *buf, size_t count)
        if (strcmp(buf, "disable") == 0) {
                aiptek->newSetting.yTilt = AIPTEK_TILT_DISABLE;
        } else {
-               y = (int)simple_strtol(buf, 0, 10);
+               y = (int)simple_strtol(buf, NULL, 10);
                if (y >= AIPTEK_TILT_MIN && y <= AIPTEK_TILT_MAX) {
                        aiptek->newSetting.yTilt = y;
                }
@@ -1399,7 +1397,7 @@ store_tabletJitterDelay(struct device *dev, const char *buf, size_t count)
        if (aiptek == NULL)
                return 0;
 
-       aiptek->newSetting.jitterDelay = (int)simple_strtol(buf, 0, 10);
+       aiptek->newSetting.jitterDelay = (int)simple_strtol(buf, NULL, 10);
        return count;
 }
 
@@ -1430,7 +1428,7 @@ store_tabletProgrammableDelay(struct device *dev, const char *buf, size_t count)
        if (aiptek == NULL)
                return 0;
 
-       aiptek->newSetting.programmableDelay = (int)simple_strtol(buf, 0, 10);
+       aiptek->newSetting.programmableDelay = (int)simple_strtol(buf, NULL, 10);
        return count;
 }
 
@@ -1805,7 +1803,7 @@ store_tabletWheel(struct device *dev, const char *buf, size_t count)
        if (aiptek == NULL)
                return 0;
 
-       aiptek->newSetting.wheel = (int)simple_strtol(buf, 0, 10);
+       aiptek->newSetting.wheel = (int)simple_strtol(buf, NULL, 10);
        return count;
 }
 
@@ -2137,9 +2135,10 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
        aiptek->inputdev.name = "Aiptek";
        aiptek->inputdev.phys = aiptek->features.usbPath;
        aiptek->inputdev.id.bustype = BUS_USB;
-       aiptek->inputdev.id.vendor = usbdev->descriptor.idVendor;
-       aiptek->inputdev.id.product = usbdev->descriptor.idProduct;
-       aiptek->inputdev.id.version = usbdev->descriptor.bcdDevice;
+       aiptek->inputdev.id.vendor = le16_to_cpu(usbdev->descriptor.idVendor);
+       aiptek->inputdev.id.product = le16_to_cpu(usbdev->descriptor.idProduct);
+       aiptek->inputdev.id.version = le16_to_cpu(usbdev->descriptor.bcdDevice);
+       aiptek->inputdev.dev = &intf->dev;
 
        aiptek->usbdev = usbdev;
        aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber;
@@ -2166,19 +2165,6 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
         */
        input_register_device(&aiptek->inputdev);
 
-       /* Go and decode the USB representation of the tablet's manufacturer
-        * name and product name. They only change once every hotplug event,
-        * which is why we put it here instead of in the sysfs interface.
-        */
-       usb_string(usbdev,
-                  usbdev->descriptor.iManufacturer,
-                  aiptek->features.manuName,
-                  sizeof(aiptek->features.manuName));
-       usb_string(usbdev,
-                  usbdev->descriptor.iProduct,
-                  aiptek->features.prodName,
-                  sizeof(aiptek->features.prodName));
-
        /* We now will look for the evdev device which is mapped to
         * the tablet. The partial name is kept in the link list of
         * input_handles associated with this input device.
@@ -2258,7 +2244,7 @@ static void aiptek_disconnect(struct usb_interface *intf)
        if (aiptek != NULL) {
                /* Free & unhook everything from the system.
                 */
-               usb_unlink_urb(aiptek->urb);
+               usb_kill_urb(aiptek->urb);
                input_unregister_device(&aiptek->inputdev);
                aiptek_delete_files(&intf->dev);
                usb_free_urb(aiptek->urb);
@@ -2289,9 +2275,9 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
 
-MODULE_PARM(programmableDelay, "i");
+module_param(programmableDelay, int, 0);
 MODULE_PARM_DESC(programmableDelay, "delay used during tablet programming");
-MODULE_PARM(jitterDelay, "i");
+module_param(jitterDelay, int, 0);
 MODULE_PARM_DESC(jitterDelay, "stylus/mouse settlement delay");
 
 module_init(aiptek_init);