patch-2.3.18 linux/drivers/usb/mouse.c

Next file: linux/drivers/usb/ohci-hcd.c
Previous file: linux/drivers/usb/keyboard.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.17/linux/drivers/usb/mouse.c linux/drivers/usb/mouse.c
@@ -40,8 +40,7 @@
 #include <linux/init.h>
 #include <linux/malloc.h>
 #include <linux/module.h>
-
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
 
 #include "usb.h"
 
@@ -149,7 +148,8 @@
 	if (--mouse->active == 0) {
 		mouse->suspended = 0;
 		/* stop polling the mouse while its not in use */
-	    	usb_release_irq(mouse->dev, mouse->irq_handle);
+	    	usb_release_irq(mouse->dev, mouse->irq_handle,
+				usb_rcvctrlpipe(mouse->dev, mouse->bEndpointAddress));
 		/* never keep a reference to a released IRQ! */
 		mouse->irq_handle = NULL;
 	}
@@ -160,6 +160,7 @@
 static int open_mouse(struct inode * inode, struct file * file)
 {
 	struct mouse_state *mouse = &static_mouse_state;
+	int ret;
 
 	printk(KERN_DEBUG "%s(%d): open_mouse\n", __FILE__, __LINE__);
 	/*
@@ -195,7 +196,13 @@
 		return 0;
 
 	/* start the usb controller's polling of the mouse */
-	mouse->irq_handle = usb_request_irq(mouse->dev, usb_rcvctrlpipe(mouse->dev, mouse->bEndpointAddress), mouse_irq, mouse->bInterval, NULL);
+	ret = usb_request_irq(mouse->dev, usb_rcvctrlpipe(mouse->dev, mouse->bEndpointAddress),
+			mouse_irq, mouse->bInterval,
+			NULL, &mouse->irq_handle);
+	if (ret) {
+		printk (KERN_WARNING "usb-mouse: usb_request_irq failed (0x%x)\n", ret);
+		return ret;
+	}
 
 	return 0;
 }
@@ -321,6 +328,7 @@
 	struct usb_interface_descriptor *interface;
 	struct usb_endpoint_descriptor *endpoint;
 	struct mouse_state *mouse = &static_mouse_state;
+	int ret;
 
 	/* We don't handle multi-config mice */
 	if (dev->descriptor.bNumConfigurations != 1)
@@ -373,9 +381,13 @@
 	{
 		printk(KERN_DEBUG "%s(%d): mouse resume\n", __FILE__, __LINE__);
 		/* restart the usb controller's polling of the mouse */
-		mouse->irq_handle = usb_request_irq(mouse->dev,
-			usb_rcvctrlpipe(mouse->dev, mouse->bEndpointAddress),
-			mouse_irq, mouse->bInterval, NULL);
+		ret = usb_request_irq(mouse->dev, usb_rcvctrlpipe(mouse->dev, mouse->bEndpointAddress),
+			mouse_irq, mouse->bInterval,
+			NULL, &mouse->irq_handle);
+		if (ret) {
+			printk (KERN_WARNING "usb-mouse: usb_request_irq failed (0x%x)\n", ret);
+			return ret;
+		}
 		mouse->suspended = 0;
 	}
 
@@ -388,7 +400,8 @@
 
 	/* stop the usb interrupt transfer */
 	if (mouse->present) {
-	    	usb_release_irq(mouse->dev, mouse->irq_handle);
+	    	usb_release_irq(mouse->dev, mouse->irq_handle,
+				usb_rcvctrlpipe(mouse->dev, mouse->bEndpointAddress));
 		/* never keep a reference to a released IRQ! */
 	}
 
@@ -428,7 +441,8 @@
 
 	/* stop the usb interrupt transfer */
 	if (mouse->present) {
-	    	usb_release_irq(mouse->dev, mouse->irq_handle);
+	    	usb_release_irq(mouse->dev, mouse->irq_handle,
+				usb_rcvctrlpipe(mouse->dev, mouse->bEndpointAddress));
 		/* never keep a reference to a released IRQ! */
 		mouse->irq_handle = NULL;
 	}

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