patch-2.4.1 linux/drivers/sbus/char/sunmouse.c

Next file: linux/drivers/sbus/char/vfc_dev.c
Previous file: linux/drivers/sbus/char/sunkbd.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0/linux/drivers/sbus/char/sunmouse.c linux/drivers/sbus/char/sunmouse.c
@@ -391,11 +391,14 @@
 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_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;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)