summaryrefslogtreecommitdiffstats
path: root/drivers/sbus/char
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-07-15 03:32:22 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-07-15 03:32:22 +0000
commitf1da2c3860e301527d56a1ef0b56c649ee7c4b1b (patch)
tree562b5d2e8b9cb62eb983d78ff6bcf9789e08fcf6 /drivers/sbus/char
parent00f11569ac8ca73cbcdef8822de1583e79aee571 (diff)
Merge with Linux 2.4.0-test5-pre1. This works again on Origin UP.
The IP22 cache bugs which are plaguing some machines are still unfixed.
Diffstat (limited to 'drivers/sbus/char')
-rw-r--r--drivers/sbus/char/bpp.c4
-rw-r--r--drivers/sbus/char/flash.c14
-rw-r--r--drivers/sbus/char/jsflash.c3
-rw-r--r--drivers/sbus/char/pcikbd.c6
-rw-r--r--drivers/sbus/char/rtc.c3
-rw-r--r--drivers/sbus/char/sunkbd.c20
-rw-r--r--drivers/sbus/char/sunmouse.c3
-rw-r--r--drivers/sbus/char/vfc_dev.c21
8 files changed, 53 insertions, 21 deletions
diff --git a/drivers/sbus/char/bpp.c b/drivers/sbus/char/bpp.c
index ebe9928c2..56f9d38af 100644
--- a/drivers/sbus/char/bpp.c
+++ b/drivers/sbus/char/bpp.c
@@ -16,6 +16,7 @@
#include <linux/fs.h>
#include <linux/errno.h>
#include <linux/sched.h>
+#include <linux/smp_lock.h>
#include <linux/timer.h>
#include <linux/ioport.h>
#include <linux/major.h>
@@ -456,10 +457,13 @@ static int bpp_open(struct inode *inode, struct file *f)
static int bpp_release(struct inode *inode, struct file *f)
{
unsigned minor = MINOR(inode->i_rdev);
+
+ lock_kernel();
instances[minor].opened = 0;
if (instances[minor].mode != COMPATIBILITY)
terminate(minor);
+ unlock_kernel();
return 0;
}
diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c
index 8bdee5e04..7a03036b6 100644
--- a/drivers/sbus/char/flash.c
+++ b/drivers/sbus/char/flash.c
@@ -13,6 +13,7 @@
#include <linux/fcntl.h>
#include <linux/poll.h>
#include <linux/init.h>
+#include <linux/smp_lock.h>
#include <asm/system.h>
#include <asm/uaccess.h>
@@ -37,23 +38,28 @@ flash_mmap(struct file *file, struct vm_area_struct *vma)
unsigned long addr;
unsigned long size;
+ lock_kernel();
if (flash.read_base == flash.write_base) {
addr = flash.read_base;
size = flash.read_size;
} else {
if ((vma->vm_flags & VM_READ) &&
- (vma->vm_flags & VM_WRITE))
+ (vma->vm_flags & VM_WRITE)) {
+ unlock_kernel();
return -EINVAL;
-
+ }
if (vma->vm_flags & VM_READ) {
addr = flash.read_base;
size = flash.read_size;
} else if (vma->vm_flags & VM_WRITE) {
addr = flash.write_base;
size = flash.write_size;
- } else
+ } else {
+ unlock_kernel();
return -ENXIO;
+ }
}
+ unlock_kernel();
if ((vma->vm_pgoff << PAGE_SHIFT) > size)
return -ENXIO;
@@ -121,7 +127,9 @@ flash_open(struct inode *inode, struct file *file)
static int
flash_release(struct inode *inode, struct file *file)
{
+ lock_kernel();
flash.busy = 0;
+ unlock_kernel();
return 0;
}
diff --git a/drivers/sbus/char/jsflash.c b/drivers/sbus/char/jsflash.c
index b01f26969..f87850b2c 100644
--- a/drivers/sbus/char/jsflash.c
+++ b/drivers/sbus/char/jsflash.c
@@ -35,6 +35,7 @@
#include <linux/poll.h>
#include <linux/init.h>
#include <linux/string.h>
+#include <linux/smp_lock.h>
/*
* <linux/blk.h> is controlled from the outside with these definitions.
@@ -504,7 +505,9 @@ static int jsfd_open(struct inode *inode, struct file *file)
static int jsf_release(struct inode *inode, struct file *file)
{
+ lock_kernel();
jsf0.busy = 0;
+ unlock_kernel();
return 0;
}
diff --git a/drivers/sbus/char/pcikbd.c b/drivers/sbus/char/pcikbd.c
index 93673e3b8..ecce4db4b 100644
--- a/drivers/sbus/char/pcikbd.c
+++ b/drivers/sbus/char/pcikbd.c
@@ -24,6 +24,7 @@
#include <linux/kbd_kern.h>
#include <linux/delay.h>
#include <linux/spinlock.h>
+#include <linux/smp_lock.h>
#include <linux/init.h>
#include <asm/ebus.h>
@@ -745,9 +746,10 @@ static int aux_release(struct inode * inode, struct file * file)
{
unsigned long flags;
+ lock_kernel();
aux_fasync(-1, file, 0);
if (--aux_count)
- return 0;
+ goto out;
spin_lock_irqsave(&pcikbd_lock, flags);
@@ -760,6 +762,8 @@ static int aux_release(struct inode * inode, struct file * file)
poll_aux_status();
spin_unlock_irqrestore(&pcikbd_lock, flags);
+out:
+ unlock_kernel();
return 0;
}
diff --git a/drivers/sbus/char/rtc.c b/drivers/sbus/char/rtc.c
index bda9e3a26..7a02f543f 100644
--- a/drivers/sbus/char/rtc.c
+++ b/drivers/sbus/char/rtc.c
@@ -19,6 +19,7 @@
#include <linux/fcntl.h>
#include <linux/poll.h>
#include <linux/init.h>
+#include <linux/smp_lock.h>
#include <asm/mostek.h>
#include <asm/system.h>
#include <asm/uaccess.h>
@@ -129,7 +130,9 @@ static int rtc_open(struct inode *inode, struct file *file)
static int rtc_release(struct inode *inode, struct file *file)
{
+ lock_kernel();
rtc_busy = 0;
+ unlock_kernel();
return 0;
}
diff --git a/drivers/sbus/char/sunkbd.c b/drivers/sbus/char/sunkbd.c
index 8004569ab..191194287 100644
--- a/drivers/sbus/char/sunkbd.c
+++ b/drivers/sbus/char/sunkbd.c
@@ -25,6 +25,7 @@
#include <linux/init.h>
#include <linux/sysrq.h>
#include <linux/spinlock.h>
+#include <linux/smp_lock.h>
#include <linux/devfs_fs_kernel.h>
#include <asm/kbio.h>
@@ -1527,16 +1528,15 @@ kbd_open (struct inode *i, struct file *f)
static int
kbd_close (struct inode *i, struct file *f)
{
- if (--kbd_active)
- return 0;
-
- if (kbd_redirected)
- kbd_table [kbd_redirected-1].kbdmode = VC_XLATE;
-
- kbd_redirected = 0;
- kbd_opened = 0;
-
- kbd_fasync (-1, f, 0);
+ lock_kernel();
+ if (!--kbd_active) {
+ if (kbd_redirected)
+ kbd_table [kbd_redirected-1].kbdmode = VC_XLATE;
+ kbd_redirected = 0;
+ kbd_opened = 0;
+ kbd_fasync (-1, f, 0);
+ }
+ unlock_kernel();
return 0;
}
diff --git a/drivers/sbus/char/sunmouse.c b/drivers/sbus/char/sunmouse.c
index 46d335c2a..b9dd25653 100644
--- a/drivers/sbus/char/sunmouse.c
+++ b/drivers/sbus/char/sunmouse.c
@@ -49,6 +49,7 @@
#include <linux/mm.h>
#include <linux/poll.h>
#include <linux/spinlock.h>
+#include <linux/smp_lock.h>
#include <linux/init.h>
#include <asm/uaccess.h>
#include <asm/system.h>
@@ -411,8 +412,10 @@ static int sun_mouse_fasync (int fd, struct file *filp, int on)
static int
sun_mouse_close(struct inode *inode, struct file *file)
{
+ lock_kernel();
sun_mouse_fasync (-1, file, 0);
sunmouse.active--;
+ unlock_kernel();
return 0;
}
diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c
index eed298c6e..7b7a59ea2 100644
--- a/drivers/sbus/char/vfc_dev.c
+++ b/drivers/sbus/char/vfc_dev.c
@@ -21,6 +21,7 @@
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/fs.h>
+#include <linux/smp_lock.h>
#include <asm/openprom.h>
#include <asm/oplib.h>
@@ -203,16 +204,19 @@ static int vfc_open(struct inode *inode, struct file *file)
return 0;
}
-static void vfc_release(struct inode *inode,struct file *file)
+static int vfc_release(struct inode *inode,struct file *file)
{
struct vfc_dev *dev;
+ lock_kernel();
dev = vfc_get_dev_ptr(MINOR(inode->i_rdev));
- if (dev == NULL)
- return;
- if (!dev->busy)
- return;
+ if (!dev || !dev->busy) {
+ unlock_kernel();
+ return -EINVAL;
+ }
dev->busy = 0;
+ unlock_kernel();
+ return 0;
}
static int vfc_debug(struct vfc_dev *dev, int cmd, unsigned long arg)
@@ -606,10 +610,12 @@ static int vfc_mmap(struct inode *inode, struct file *file,
unsigned int map_size, ret, map_offset;
struct vfc_dev *dev;
+ lock_kernel();
dev = vfc_get_dev_ptr(MINOR(inode->i_rdev));
- if(dev == NULL)
+ if(dev == NULL) {
+ unlock_kernel();
return -ENODEV;
-
+ }
map_size = vma->vm_end - vma->vm_start;
if(map_size > sizeof(struct vfc_regs))
map_size = sizeof(struct vfc_regs);
@@ -619,6 +625,7 @@ static int vfc_mmap(struct inode *inode, struct file *file,
map_offset = (unsigned int) (long)dev->phys_regs;
ret = io_remap_page_range(vma->vm_start, map_offset, map_size,
vma->vm_page_prot, dev->which_io);
+ unlock_kernel();
if(ret)
return -EAGAIN;