header cleaning: don't include smp_lock.h when not used
[sfrench/cifs-2.6.git] / drivers / usb / misc / legousbtower.c
index 77c36e63c7bff169c405357bbec5270565ab80bb..1713e19a789974b086fe96cd458136f37df5175f 100644 (file)
@@ -80,7 +80,6 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/module.h>
-#include <linux/smp_lock.h>
 #include <linux/completion.h>
 #include <linux/mutex.h>
 #include <asm/uaccess.h>
@@ -248,8 +247,8 @@ static loff_t tower_llseek  (struct file *file, loff_t off, int whence);
 
 static void tower_abort_transfers (struct lego_usb_tower *dev);
 static void tower_check_for_read_packet (struct lego_usb_tower *dev);
-static void tower_interrupt_in_callback (struct urb *urb, struct pt_regs *regs);
-static void tower_interrupt_out_callback (struct urb *urb, struct pt_regs *regs);
+static void tower_interrupt_in_callback (struct urb *urb);
+static void tower_interrupt_out_callback (struct urb *urb);
 
 static int  tower_probe        (struct usb_interface *interface, const struct usb_device_id *id);
 static void tower_disconnect   (struct usb_interface *interface);
@@ -317,12 +316,8 @@ static inline void tower_delete (struct lego_usb_tower *dev)
        tower_abort_transfers (dev);
 
        /* free data structures */
-       if (dev->interrupt_in_urb != NULL) {
-               usb_free_urb (dev->interrupt_in_urb);
-       }
-       if (dev->interrupt_out_urb != NULL) {
-               usb_free_urb (dev->interrupt_out_urb);
-       }
+       usb_free_urb(dev->interrupt_in_urb);
+       usb_free_urb(dev->interrupt_out_urb);
        kfree (dev->read_buffer);
        kfree (dev->interrupt_in_buffer);
        kfree (dev->interrupt_out_buffer);
@@ -502,15 +497,11 @@ static void tower_abort_transfers (struct lego_usb_tower *dev)
        if (dev->interrupt_in_running) {
                dev->interrupt_in_running = 0;
                mb();
-               if (dev->interrupt_in_urb != NULL && dev->udev) {
+               if (dev->udev)
                        usb_kill_urb (dev->interrupt_in_urb);
-               }
-       }
-       if (dev->interrupt_out_busy) {
-               if (dev->interrupt_out_urb != NULL && dev->udev) {
-                       usb_kill_urb (dev->interrupt_out_urb);
-               }
        }
+       if (dev->interrupt_out_busy && dev->udev)
+               usb_kill_urb(dev->interrupt_out_urb);
 
 exit:
        dbg(2, "%s: leave", __FUNCTION__);
@@ -755,7 +746,7 @@ exit:
 /**
  *     tower_interrupt_in_callback
  */
-static void tower_interrupt_in_callback (struct urb *urb, struct pt_regs *regs)
+static void tower_interrupt_in_callback (struct urb *urb)
 {
        struct lego_usb_tower *dev = (struct lego_usb_tower *)urb->context;
        int retval;
@@ -811,7 +802,7 @@ exit:
 /**
  *     tower_interrupt_out_callback
  */
-static void tower_interrupt_out_callback (struct urb *urb, struct pt_regs *regs)
+static void tower_interrupt_out_callback (struct urb *urb)
 {
        struct lego_usb_tower *dev = (struct lego_usb_tower *)urb->context;
 
@@ -898,14 +889,11 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device
        for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
                endpoint = &iface_desc->endpoint[i].desc;
 
-               if (((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN) &&
-                   ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT)) {
-                       dev->interrupt_in_endpoint = endpoint;
-               }
-
-               if (((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) &&
-                   ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT)) {
-                       dev->interrupt_out_endpoint = endpoint;
+               if (usb_endpoint_xfer_int(endpoint)) {
+                       if (usb_endpoint_dir_in(endpoint))
+                               dev->interrupt_in_endpoint = endpoint;
+                       else
+                               dev->interrupt_out_endpoint = endpoint;
                }
        }
        if(dev->interrupt_in_endpoint == NULL) {