drivers: autoconvert trivial BKL users to private mutex
[pandora-kernel.git] / drivers / pci / hotplug / cpqphp_sysfs.c
index 5621532..4cb3044 100644 (file)
 #include <linux/workqueue.h>
 #include <linux/pci.h>
 #include <linux/pci_hotplug.h>
-#include <linux/smp_lock.h>
+#include <linux/mutex.h>
 #include <linux/debugfs.h>
 #include "cpqphp.h"
 
+static DEFINE_MUTEX(cpqphp_mutex);
 static int show_ctrl (struct controller *ctrl, char *buf)
 {
        char *out = buf;
@@ -147,7 +148,7 @@ static int open(struct inode *inode, struct file *file)
        struct ctrl_dbg *dbg;
        int retval = -ENOMEM;
 
-       lock_kernel();
+       mutex_lock(&cpqphp_mutex);
        dbg = kmalloc(sizeof(*dbg), GFP_KERNEL);
        if (!dbg)
                goto exit;
@@ -160,7 +161,7 @@ static int open(struct inode *inode, struct file *file)
        file->private_data = dbg;
        retval = 0;
 exit:
-       unlock_kernel();
+       mutex_unlock(&cpqphp_mutex);
        return retval;
 }
 
@@ -169,7 +170,7 @@ static loff_t lseek(struct file *file, loff_t off, int whence)
        struct ctrl_dbg *dbg;
        loff_t new = -1;
 
-       lock_kernel();
+       mutex_lock(&cpqphp_mutex);
        dbg = file->private_data;
 
        switch (whence) {
@@ -181,10 +182,10 @@ static loff_t lseek(struct file *file, loff_t off, int whence)
                break;
        }
        if (new < 0 || new > dbg->size) {
-               unlock_kernel();
+               mutex_unlock(&cpqphp_mutex);
                return -EINVAL;
        }
-       unlock_kernel();
+       mutex_unlock(&cpqphp_mutex);
        return (file->f_pos = new);
 }