Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / usb / misc / legousbtower.c
index 7d06105..779bcf0 100644 (file)
@@ -83,6 +83,7 @@
 #include <linux/module.h>
 #include <linux/smp_lock.h>
 #include <linux/completion.h>
+#include <linux/mutex.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
 #include <linux/poll.h>
@@ -256,7 +257,7 @@ static void tower_disconnect        (struct usb_interface *interface);
 
 
 /* prevent races between open() and disconnect */
-static DECLARE_MUTEX (disconnect_sem);
+static DEFINE_MUTEX (disconnect_mutex);
 
 /* file operations needed when we register this driver */
 static struct file_operations tower_fops = {
@@ -271,19 +272,17 @@ static struct file_operations tower_fops = {
 
 /*
  * usb class driver info in order to get a minor number from the usb core,
- * and to have the device registered with devfs and the driver core
+ * and to have the device registered with the driver core
  */
 static struct usb_class_driver tower_class = {
-       .name =         "usb/legousbtower%d",
+       .name =         "legousbtower%d",
        .fops =         &tower_fops,
-       .mode =         S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH,
        .minor_base =   LEGO_USB_TOWER_MINOR_BASE,
 };
 
 
 /* usb specific object needed to register this driver with the usb subsystem */
 static struct usb_driver tower_driver = {
-       .owner =        THIS_MODULE,
        .name =         "legousbtower",
        .probe =        tower_probe,
        .disconnect =   tower_disconnect,
@@ -351,7 +350,7 @@ static int tower_open (struct inode *inode, struct file *file)
        nonseekable_open(inode, file);
        subminor = iminor(inode);
 
-       down (&disconnect_sem);
+       mutex_lock (&disconnect_mutex);
 
        interface = usb_find_interface (&tower_driver, subminor);
 
@@ -429,7 +428,7 @@ unlock_exit:
        up (&dev->sem);
 
 unlock_disconnect_exit:
-       up (&disconnect_sem);
+       mutex_unlock (&disconnect_mutex);
 
        dbg(2, "%s: leave, return value %d ", __FUNCTION__, retval);
 
@@ -1007,7 +1006,7 @@ static void tower_disconnect (struct usb_interface *interface)
 
        dbg(2, "%s: enter", __FUNCTION__);
 
-       down (&disconnect_sem);
+       mutex_lock (&disconnect_mutex);
 
        dev = usb_get_intfdata (interface);
        usb_set_intfdata (interface, NULL);
@@ -1029,7 +1028,7 @@ static void tower_disconnect (struct usb_interface *interface)
                up (&dev->sem);
        }
 
-       up (&disconnect_sem);
+       mutex_unlock (&disconnect_mutex);
 
        info("LEGO USB Tower #%d now disconnected", (minor - LEGO_USB_TOWER_MINOR_BASE));