[NET] sem2mutex: net/
[linux-2.6.git] / net / socket.c
index 510ae18..e3c21d5 100644 (file)
@@ -68,6 +68,7 @@
 #include <linux/netdevice.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
+#include <linux/mutex.h>
 #include <linux/wanrouter.h>
 #include <linux/if_bridge.h>
 #include <linux/if_frad.h>
@@ -826,36 +827,36 @@ static ssize_t sock_aio_write(struct kiocb *iocb, const char __user *ubuf,
  * with module unload.
  */
 
-static DECLARE_MUTEX(br_ioctl_mutex);
+static DEFINE_MUTEX(br_ioctl_mutex);
 static int (*br_ioctl_hook)(unsigned int cmd, void __user *arg) = NULL;
 
 void brioctl_set(int (*hook)(unsigned int, void __user *))
 {
-       down(&br_ioctl_mutex);
+       mutex_lock(&br_ioctl_mutex);
        br_ioctl_hook = hook;
-       up(&br_ioctl_mutex);
+       mutex_unlock(&br_ioctl_mutex);
 }
 EXPORT_SYMBOL(brioctl_set);
 
-static DECLARE_MUTEX(vlan_ioctl_mutex);
+static DEFINE_MUTEX(vlan_ioctl_mutex);
 static int (*vlan_ioctl_hook)(void __user *arg);
 
 void vlan_ioctl_set(int (*hook)(void __user *))
 {
-       down(&vlan_ioctl_mutex);
+       mutex_lock(&vlan_ioctl_mutex);
        vlan_ioctl_hook = hook;
-       up(&vlan_ioctl_mutex);
+       mutex_unlock(&vlan_ioctl_mutex);
 }
 EXPORT_SYMBOL(vlan_ioctl_set);
 
-static DECLARE_MUTEX(dlci_ioctl_mutex);
+static DEFINE_MUTEX(dlci_ioctl_mutex);
 static int (*dlci_ioctl_hook)(unsigned int, void __user *);
 
 void dlci_ioctl_set(int (*hook)(unsigned int, void __user *))
 {
-       down(&dlci_ioctl_mutex);
+       mutex_lock(&dlci_ioctl_mutex);
        dlci_ioctl_hook = hook;
-       up(&dlci_ioctl_mutex);
+       mutex_unlock(&dlci_ioctl_mutex);
 }
 EXPORT_SYMBOL(dlci_ioctl_set);
 
@@ -899,10 +900,10 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg)
                        if (!br_ioctl_hook)
                                request_module("bridge");
 
-                       down(&br_ioctl_mutex);
+                       mutex_lock(&br_ioctl_mutex);
                        if (br_ioctl_hook) 
                                err = br_ioctl_hook(cmd, argp);
-                       up(&br_ioctl_mutex);
+                       mutex_unlock(&br_ioctl_mutex);
                        break;
                case SIOCGIFVLAN:
                case SIOCSIFVLAN:
@@ -910,10 +911,10 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg)
                        if (!vlan_ioctl_hook)
                                request_module("8021q");
 
-                       down(&vlan_ioctl_mutex);
+                       mutex_lock(&vlan_ioctl_mutex);
                        if (vlan_ioctl_hook)
                                err = vlan_ioctl_hook(argp);
-                       up(&vlan_ioctl_mutex);
+                       mutex_unlock(&vlan_ioctl_mutex);
                        break;
                case SIOCGIFDIVERT:
                case SIOCSIFDIVERT:
@@ -927,9 +928,9 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg)
                                request_module("dlci");
 
                        if (dlci_ioctl_hook) {
-                               down(&dlci_ioctl_mutex);
+                               mutex_lock(&dlci_ioctl_mutex);
                                err = dlci_ioctl_hook(cmd, argp);
-                               up(&dlci_ioctl_mutex);
+                               mutex_unlock(&dlci_ioctl_mutex);
                        }
                        break;
                default: