block: autoconvert trivial BKL users to private mutex
[cascardo/linux.git] / drivers / block / aoe / aoechr.c
index 4a1b9e7..05d5ef1 100644 (file)
@@ -9,7 +9,7 @@
 #include <linux/completion.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
-#include <linux/smp_lock.h>
+#include <linux/mutex.h>
 #include <linux/skbuff.h>
 #include "aoe.h"
 
@@ -37,6 +37,7 @@ struct ErrMsg {
        char *msg;
 };
 
+static DEFINE_MUTEX(aoechr_mutex);
 static struct ErrMsg emsgs[NMSG];
 static int emsgs_head_idx, emsgs_tail_idx;
 static struct completion emsgs_comp;
@@ -183,16 +184,16 @@ aoechr_open(struct inode *inode, struct file *filp)
 {
        int n, i;
 
-       lock_kernel();
+       mutex_lock(&aoechr_mutex);
        n = iminor(inode);
        filp->private_data = (void *) (unsigned long) n;
 
        for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
                if (chardevs[i].minor == n) {
-                       unlock_kernel();
+                       mutex_unlock(&aoechr_mutex);
                        return 0;
                }
-       unlock_kernel();
+       mutex_unlock(&aoechr_mutex);
        return -EINVAL;
 }