fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / usb / storage / onetouch.c
index 55ee2d3..e565d3d 100644 (file)
  *
  */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/input.h>
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/module.h>
-#include <linux/usb.h>
 #include <linux/usb_ch9.h>
-#include <linux/usb_input.h>
+#include <linux/usb/input.h>
 #include "usb.h"
 #include "onetouch.h"
 #include "debug.h"
@@ -55,7 +53,7 @@ struct usb_onetouch {
        unsigned int is_open:1;
 };
 
-static void usb_onetouch_irq(struct urb *urb, struct pt_regs *regs)
+static void usb_onetouch_irq(struct urb *urb)
 {
        struct usb_onetouch *onetouch = urb->context;
        signed char *data = onetouch->data;
@@ -74,12 +72,11 @@ static void usb_onetouch_irq(struct urb *urb, struct pt_regs *regs)
                goto resubmit;
        }
 
-       input_regs(dev, regs);
        input_report_key(dev, ONETOUCH_BUTTON, data[0] & 0x02);
        input_sync(dev);
 
 resubmit:
-       status = usb_submit_urb (urb, SLAB_ATOMIC);
+       status = usb_submit_urb (urb, GFP_ATOMIC);
        if (status)
                err ("can't resubmit intr, %s-%s/input0, status %d",
                        onetouch->udev->bus->bus_name,
@@ -137,6 +134,7 @@ int onetouch_connect_input(struct us_data *ss)
        struct usb_onetouch *onetouch;
        struct input_dev *input_dev;
        int pipe, maxp;
+       int error = -ENOMEM;
 
        interface = ss->pusb_intf->cur_altsetting;
 
@@ -144,10 +142,7 @@ int onetouch_connect_input(struct us_data *ss)
                return -ENODEV;
 
        endpoint = &interface->endpoint[2].desc;
-       if (!(endpoint->bEndpointAddress & USB_DIR_IN))
-               return -ENODEV;
-       if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
-                       != USB_ENDPOINT_XFER_INT)
+       if (!usb_endpoint_is_int_in(endpoint))
                return -ENODEV;
 
        pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress);
@@ -159,7 +154,7 @@ int onetouch_connect_input(struct us_data *ss)
                goto fail1;
 
        onetouch->data = usb_buffer_alloc(udev, ONETOUCH_PKT_LEN,
-                                         SLAB_ATOMIC, &onetouch->data_dma);
+                                         GFP_ATOMIC, &onetouch->data_dma);
        if (!onetouch->data)
                goto fail1;
 
@@ -213,15 +208,18 @@ int onetouch_connect_input(struct us_data *ss)
        ss->suspend_resume_hook = usb_onetouch_pm_hook;
 #endif
 
-       input_register_device(onetouch->dev);
+       error = input_register_device(onetouch->dev);
+       if (error)
+               goto fail3;
 
        return 0;
 
+ fail3:        usb_free_urb(onetouch->irq);
  fail2:        usb_buffer_free(udev, ONETOUCH_PKT_LEN,
                        onetouch->data, onetouch->data_dma);
  fail1:        kfree(onetouch);
        input_free_device(input_dev);
-       return -ENOMEM;
+       return error;
 }
 
 void onetouch_release_input(void *onetouch_)