|
@@ -33,7 +33,7 @@
|
|
|
#include <linux/kernel.h>
|
|
|
#include <linux/errno.h>
|
|
|
#include <linux/slab.h>
|
|
|
-#include <linux/smp_lock.h>
|
|
|
+#include <linux/mutex.h>
|
|
|
#include <linux/string.h>
|
|
|
#include <linux/miscdevice.h>
|
|
|
#include <linux/init.h>
|
|
@@ -61,6 +61,7 @@ typedef struct openprom_private_data
|
|
|
} DATA;
|
|
|
|
|
|
/* ID of the PROM node containing all of the EEPROM options. */
|
|
|
+static DEFINE_MUTEX(openprom_mutex);
|
|
|
static struct device_node *options_node;
|
|
|
|
|
|
/*
|
|
@@ -316,7 +317,7 @@ static long openprom_sunos_ioctl(struct file * file,
|
|
|
if (bufsize < 0)
|
|
|
return bufsize;
|
|
|
|
|
|
- lock_kernel();
|
|
|
+ mutex_lock(&openprom_mutex);
|
|
|
|
|
|
switch (cmd) {
|
|
|
case OPROMGETOPT:
|
|
@@ -367,7 +368,7 @@ static long openprom_sunos_ioctl(struct file * file,
|
|
|
}
|
|
|
|
|
|
kfree(opp);
|
|
|
- unlock_kernel();
|
|
|
+ mutex_unlock(&openprom_mutex);
|
|
|
|
|
|
return error;
|
|
|
}
|
|
@@ -558,7 +559,7 @@ static int openprom_bsd_ioctl(struct file * file,
|
|
|
void __user *argp = (void __user *)arg;
|
|
|
int err;
|
|
|
|
|
|
- lock_kernel();
|
|
|
+ mutex_lock(&openprom_mutex);
|
|
|
switch (cmd) {
|
|
|
case OPIOCGET:
|
|
|
err = opiocget(argp, data);
|
|
@@ -589,7 +590,7 @@ static int openprom_bsd_ioctl(struct file * file,
|
|
|
err = -EINVAL;
|
|
|
break;
|
|
|
};
|
|
|
- unlock_kernel();
|
|
|
+ mutex_unlock(&openprom_mutex);
|
|
|
|
|
|
return err;
|
|
|
}
|
|
@@ -697,11 +698,11 @@ static int openprom_open(struct inode * inode, struct file * file)
|
|
|
if (!data)
|
|
|
return -ENOMEM;
|
|
|
|
|
|
- lock_kernel();
|
|
|
+ mutex_lock(&openprom_mutex);
|
|
|
data->current_node = of_find_node_by_path("/");
|
|
|
data->lastnode = data->current_node;
|
|
|
file->private_data = (void *) data;
|
|
|
- unlock_kernel();
|
|
|
+ mutex_unlock(&openprom_mutex);
|
|
|
|
|
|
return 0;
|
|
|
}
|