patch-1.3.31 linux/drivers/char/msbusmouse.c

Next file: linux/drivers/char/psaux.c
Previous file: linux/drivers/char/mem.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.30/linux/drivers/char/msbusmouse.c linux/drivers/char/msbusmouse.c
@@ -39,6 +39,7 @@
 #endif
 
 #include <linux/kernel.h>
+#include <linux/ioport.h>
 #include <linux/sched.h>
 #include <linux/busmouse.h>
 #include <linux/signal.h>
@@ -188,6 +189,10 @@
 	mouse.buttons = 0x80;
 	mouse.dx = mouse.dy = 0;
 	mouse.wait = NULL;
+
+	if (check_region(MS_MSE_CONTROL_PORT, 0x04))
+		return -ENODEV;
+
 	if (inb_p(MS_MSE_SIGNATURE_PORT) == 0xde) {
 
 		mse_byte = inb_p(MS_MSE_SIGNATURE_PORT);
@@ -210,6 +215,7 @@
 #endif
 	}
 	MS_MSE_INT_OFF();
+	request_region(MS_MSE_CONTROL_PORT, 0x04, "MS Busmouse");
 	printk("Microsoft BusMouse detected and installed.\n");
 	mouse_register(&ms_bus_mouse);
 #ifdef MODULE
@@ -224,7 +230,10 @@
 {
 	if (MOD_IN_USE)
 		printk("msbusmouse: in use, remove delayed\n");
-	mouse_deregister(&ms_bus_mouse);
+	else {
+		mouse_deregister(&ms_bus_mouse);
+		release_region(MS_MSE_CONTROL_PORT, 0x04);
+	}
 }
 #endif
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this