Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[pandora-kernel.git] / drivers / usb / image / mdc800.c
index 08daf40..36502a0 100644 (file)
@@ -94,7 +94,6 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/module.h>
-#include <linux/smp_lock.h>
 #include <linux/wait.h>
 #include <linux/mutex.h>
 
@@ -280,7 +279,7 @@ static int mdc800_isReady (char *ch)
 /*
  * USB IRQ Handler for InputLine
  */
-static void mdc800_usb_irq (struct urb *urb, struct pt_regs *res)
+static void mdc800_usb_irq (struct urb *urb)
 {
        int data_received=0, wake_up;
        unsigned char* b=urb->transfer_buffer;
@@ -374,7 +373,7 @@ static int mdc800_usb_waitForIRQ (int mode, int msec)
 /*
  * The write_urb callback function
  */
-static void mdc800_usb_write_notify (struct urb *urb, struct pt_regs *res)
+static void mdc800_usb_write_notify (struct urb *urb)
 {
        struct mdc800_data* mdc800=urb->context;
 
@@ -394,7 +393,7 @@ static void mdc800_usb_write_notify (struct urb *urb, struct pt_regs *res)
 /*
  * The download_urb callback function
  */
-static void mdc800_usb_download_notify (struct urb *urb, struct pt_regs *res)
+static void mdc800_usb_download_notify (struct urb *urb)
 {
        struct mdc800_data* mdc800=urb->context;
 
@@ -424,7 +423,7 @@ static void mdc800_usb_download_notify (struct urb *urb, struct pt_regs *res)
  ***************************************************************************/
 
 static struct usb_driver mdc800_usb_driver;
-static struct file_operations mdc800_device_ops;
+static const struct file_operations mdc800_device_ops;
 static struct usb_class_driver mdc800_class = {
        .name =         "mdc800%d",
        .fops =         &mdc800_device_ops,
@@ -565,11 +564,15 @@ static void mdc800_usb_disconnect (struct usb_interface *intf)
 
                usb_deregister_dev(intf, &mdc800_class);
 
+               /* must be under lock to make sure no URB
+                  is submitted after usb_kill_urb() */
+               mutex_lock(&mdc800->io_lock);
                mdc800->state=NOT_CONNECTED;
 
                usb_kill_urb(mdc800->irq_urb);
                usb_kill_urb(mdc800->write_urb);
                usb_kill_urb(mdc800->download_urb);
+               mutex_unlock(&mdc800->io_lock);
 
                mdc800->dev = NULL;
                usb_set_intfdata(intf, NULL);
@@ -941,7 +944,7 @@ static ssize_t mdc800_device_write (struct file *file, const char __user *buf, s
 ****************************************************************************/
 
 /* File Operations of this drivers */
-static struct file_operations mdc800_device_ops =
+static const struct file_operations mdc800_device_ops =
 {
        .owner =        THIS_MODULE,
        .read =         mdc800_device_read,