patch-2.3.99-pre3 linux/drivers/char/amigamouse.c

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

diff -u --recursive --new-file v2.3.99-pre2/linux/drivers/char/amigamouse.c linux/drivers/char/amigamouse.c
@@ -162,6 +162,10 @@
 
 static int open_mouse(struct inode * inode, struct file * file)
 {
+	/* Lock module first - request_irq might sleep */
+	
+	MOD_INC_USE_COUNT;
+	
 	/*
 	 *  use VBL to poll mouse deltas
 	 */
@@ -169,10 +173,10 @@
 	if(request_irq(IRQ_AMIGA_VERTB, mouse_interrupt, 0,
 	               "Amiga mouse", mouse_interrupt)) {
 		printk(KERN_INFO "Installing Amiga mouse failed.\n");
+		MOD_DEC_USE_COUNT;
 		return -EIO;
 	}
 
-	MOD_INC_USE_COUNT;
 #if AMIGA_OLD_INT
 	AMI_MSE_INT_ON();
 #endif

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