Merge git://oss.sgi.com:8090/xfs/xfs-2.6
[linux-drm-fsl-dcu.git] / drivers / input / mouse / inport.c
index afc66f56df43b5d5f6a415a81e595c31e07db27a..701ebd5473cfe8745ca8ef4e82e2f6a7647d352c 100644 (file)
@@ -36,7 +36,6 @@
 
 #include <linux/module.h>
 #include <linux/moduleparam.h>
-#include <linux/config.h>
 #include <linux/ioport.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
@@ -62,7 +61,7 @@ MODULE_LICENSE("GPL");
 #define INPORT_REG_MODE                0x07
 #define INPORT_RESET           0x80
 
-#ifdef CONFIG_INPUT_ATIXL
+#ifdef CONFIG_MOUSE_ATIXL
 #define INPORT_NAME            "ATI XL Mouse"
 #define INPORT_VENDOR          0x0002
 #define INPORT_SPEED_30HZ      0x01
@@ -89,15 +88,13 @@ __obsolete_setup("inport_irq=");
 
 static struct input_dev *inport_dev;
 
-static irqreturn_t inport_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t inport_interrupt(int irq, void *dev_id)
 {
        unsigned char buttons;
 
        outb(INPORT_REG_MODE, INPORT_CONTROL_PORT);
        outb(INPORT_MODE_HOLD | INPORT_MODE_IRQ | INPORT_MODE_BASE, INPORT_DATA_PORT);
 
-       input_regs(inport_dev, regs);
-
        outb(INPORT_REG_X, INPORT_CONTROL_PORT);
        input_report_rel(inport_dev, REL_X, inb(INPORT_DATA_PORT));
 
@@ -138,6 +135,7 @@ static void inport_close(struct input_dev *dev)
 static int __init inport_init(void)
 {
        unsigned char a, b, c;
+       int err;
 
        if (!request_region(INPORT_BASE, INPORT_EXTENT, "inport")) {
                printk(KERN_ERR "inport.c: Can't allocate ports at %#x\n", INPORT_BASE);
@@ -148,15 +146,16 @@ static int __init inport_init(void)
        b = inb(INPORT_SIGNATURE_PORT);
        c = inb(INPORT_SIGNATURE_PORT);
        if (a == b || a != c) {
-               release_region(INPORT_BASE, INPORT_EXTENT);
                printk(KERN_ERR "inport.c: Didn't find InPort mouse at %#x\n", INPORT_BASE);
-               return -ENODEV;
+               err = -ENODEV;
+               goto err_release_region;
        }
 
-       if (!(inport_dev = input_allocate_device())) {
+       inport_dev = input_allocate_device();
+       if (!inport_dev) {
                printk(KERN_ERR "inport.c: Not enough memory for input device\n");
-               release_region(INPORT_BASE, INPORT_EXTENT);
-               return -ENOMEM;
+               err = -ENOMEM;
+               goto err_release_region;
        }
 
        inport_dev->name = INPORT_NAME;
@@ -177,9 +176,18 @@ static int __init inport_init(void)
        outb(INPORT_REG_MODE, INPORT_CONTROL_PORT);
        outb(INPORT_MODE_BASE, INPORT_DATA_PORT);
 
-       input_register_device(inport_dev);
+       err = input_register_device(inport_dev);
+       if (err)
+               goto err_free_dev;
 
        return 0;
+
+ err_free_dev:
+       input_free_device(inport_dev);
+ err_release_region:
+       release_region(INPORT_BASE, INPORT_EXTENT);
+
+       return err;
 }
 
 static void __exit inport_exit(void)