summaryrefslogtreecommitdiffstats
path: root/drivers/sbus/char/sunmouse.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2001-01-31 22:22:27 +0000
committerRalf Baechle <ralf@linux-mips.org>2001-01-31 22:22:27 +0000
commit825423e4c4f18289df2393951cfd2a7a31fc0464 (patch)
tree4ad80e981c3d9effa910d2247d118d254f9a5d09 /drivers/sbus/char/sunmouse.c
parentc4693dc4856ab907a5c02187a8d398861bebfc7e (diff)
Merge with Linux 2.4.1.
Diffstat (limited to 'drivers/sbus/char/sunmouse.c')
-rw-r--r--drivers/sbus/char/sunmouse.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/sbus/char/sunmouse.c b/drivers/sbus/char/sunmouse.c
index fd92bc434..8bb45cbde 100644
--- a/drivers/sbus/char/sunmouse.c
+++ b/drivers/sbus/char/sunmouse.c
@@ -391,11 +391,14 @@ sun_mouse_inbyte(unsigned char byte, int is_break)
static int
sun_mouse_open(struct inode * inode, struct file * file)
{
+ spin_lock_irq(&sunmouse.lock);
if (sunmouse.active++)
- return 0;
+ goto out;
sunmouse.delta_x = sunmouse.delta_y = 0;
sunmouse.button_state = 0x80;
sunmouse.vuid_mode = VUID_NATIVE;
+out:
+ spin_unlock_irq(&sunmouse.lock);
return 0;
}
@@ -412,10 +415,12 @@ 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);
+
+ spin_lock_irq(&sunmouse.lock);
sunmouse.active--;
- unlock_kernel();
+ spin_unlock_irq(&sunmouse.lock);
+
return 0;
}