aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/sbus/char/openprom.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/sbus/char/openprom.c')
-rw-r--r--drivers/sbus/char/openprom.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c
index aacbe14e2e7a..8d6e508222b8 100644
--- a/drivers/sbus/char/openprom.c
+++ b/drivers/sbus/char/openprom.c
@@ -33,7 +33,7 @@
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <linux/errno.h> 34#include <linux/errno.h>
35#include <linux/slab.h> 35#include <linux/slab.h>
36#include <linux/smp_lock.h> 36#include <linux/mutex.h>
37#include <linux/string.h> 37#include <linux/string.h>
38#include <linux/miscdevice.h> 38#include <linux/miscdevice.h>
39#include <linux/init.h> 39#include <linux/init.h>
@@ -61,6 +61,7 @@ typedef struct openprom_private_data
61} DATA; 61} DATA;
62 62
63/* ID of the PROM node containing all of the EEPROM options. */ 63/* ID of the PROM node containing all of the EEPROM options. */
64static DEFINE_MUTEX(openprom_mutex);
64static struct device_node *options_node; 65static struct device_node *options_node;
65 66
66/* 67/*
@@ -316,7 +317,7 @@ static long openprom_sunos_ioctl(struct file * file,
316 if (bufsize < 0) 317 if (bufsize < 0)
317 return bufsize; 318 return bufsize;
318 319
319 lock_kernel(); 320 mutex_lock(&openprom_mutex);
320 321
321 switch (cmd) { 322 switch (cmd) {
322 case OPROMGETOPT: 323 case OPROMGETOPT:
@@ -367,7 +368,7 @@ static long openprom_sunos_ioctl(struct file * file,
367 } 368 }
368 369
369 kfree(opp); 370 kfree(opp);
370 unlock_kernel(); 371 mutex_unlock(&openprom_mutex);
371 372
372 return error; 373 return error;
373} 374}
@@ -558,7 +559,7 @@ static int openprom_bsd_ioctl(struct file * file,
558 void __user *argp = (void __user *)arg; 559 void __user *argp = (void __user *)arg;
559 int err; 560 int err;
560 561
561 lock_kernel(); 562 mutex_lock(&openprom_mutex);
562 switch (cmd) { 563 switch (cmd) {
563 case OPIOCGET: 564 case OPIOCGET:
564 err = opiocget(argp, data); 565 err = opiocget(argp, data);
@@ -589,7 +590,7 @@ static int openprom_bsd_ioctl(struct file * file,
589 err = -EINVAL; 590 err = -EINVAL;
590 break; 591 break;
591 }; 592 };
592 unlock_kernel(); 593 mutex_unlock(&openprom_mutex);
593 594
594 return err; 595 return err;
595} 596}
@@ -697,11 +698,11 @@ static int openprom_open(struct inode * inode, struct file * file)
697 if (!data) 698 if (!data)
698 return -ENOMEM; 699 return -ENOMEM;
699 700
700 lock_kernel(); 701 mutex_lock(&openprom_mutex);
701 data->current_node = of_find_node_by_path("/"); 702 data->current_node = of_find_node_by_path("/");
702 data->lastnode = data->current_node; 703 data->lastnode = data->current_node;
703 file->private_data = (void *) data; 704 file->private_data = (void *) data;
704 unlock_kernel(); 705 mutex_unlock(&openprom_mutex);
705 706
706 return 0; 707 return 0;
707} 708}