Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[pandora-kernel.git] / drivers / input / touchscreen / gunze.c
index b769b21..a54f90e 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * $Id: gunze.c,v 1.12 2001/09/25 10:12:07 vojtech Exp $
- *
  *  Copyright (c) 2000-2001 Vojtech Pavlik
  */
 
@@ -60,7 +58,7 @@ struct gunze {
        char phys[32];
 };
 
-static void gunze_process_packet(struct gunze* gunze, struct pt_regs *regs)
+static void gunze_process_packet(struct gunze* gunze)
 {
        struct input_dev *dev = gunze->dev;
 
@@ -70,7 +68,6 @@ static void gunze_process_packet(struct gunze* gunze, struct pt_regs *regs)
                return;
        }
 
-       input_regs(dev, regs);
        input_report_abs(dev, ABS_X, simple_strtoul(gunze->data + 1, NULL, 10));
        input_report_abs(dev, ABS_Y, 1024 - simple_strtoul(gunze->data + 6, NULL, 10));
        input_report_key(dev, BTN_TOUCH, gunze->data[0] == 'T');
@@ -78,12 +75,12 @@ static void gunze_process_packet(struct gunze* gunze, struct pt_regs *regs)
 }
 
 static irqreturn_t gunze_interrupt(struct serio *serio,
-               unsigned char data, unsigned int flags, struct pt_regs *regs)
+               unsigned char data, unsigned int flags)
 {
        struct gunze* gunze = serio_get_drvdata(serio);
 
        if (data == '\r') {
-               gunze_process_packet(gunze, regs);
+               gunze_process_packet(gunze);
                gunze->idx = 0;
        } else {
                if (gunze->idx < GUNZE_MAX_LENGTH)
@@ -124,22 +121,22 @@ static int gunze_connect(struct serio *serio, struct serio_driver *drv)
        input_dev = input_allocate_device();
        if (!gunze || !input_dev) {
                err = -ENOMEM;
-               goto fail;
+               goto fail1;
        }
 
        gunze->serio = serio;
        gunze->dev = input_dev;
        snprintf(gunze->phys, sizeof(serio->phys), "%s/input0", serio->phys);
 
-       input_dev->private = gunze;
        input_dev->name = "Gunze AHL-51S TouchScreen";
        input_dev->phys = gunze->phys;
        input_dev->id.bustype = BUS_RS232;
        input_dev->id.vendor = SERIO_GUNZE;
        input_dev->id.product = 0x0051;
        input_dev->id.version = 0x0100;
-       input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
-       input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
+       input_dev->dev.parent = &serio->dev;
+       input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
+       input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
        input_set_abs_params(input_dev, ABS_X, 24, 1000, 0, 0);
        input_set_abs_params(input_dev, ABS_Y, 24, 1000, 0, 0);
 
@@ -147,13 +144,17 @@ static int gunze_connect(struct serio *serio, struct serio_driver *drv)
 
        err = serio_open(serio, drv);
        if (err)
-               goto fail;
+               goto fail2;
+
+       err = input_register_device(gunze->dev);
+       if (err)
+               goto fail3;
 
-       input_register_device(gunze->dev);
        return 0;
 
- fail: serio_set_drvdata(serio, NULL);
-       input_free_device(input_dev);
+ fail3:        serio_close(serio);
+ fail2:        serio_set_drvdata(serio, NULL);
+ fail1:        input_free_device(input_dev);
        kfree(gunze);
        return err;
 }
@@ -191,8 +192,7 @@ static struct serio_driver gunze_drv = {
 
 static int __init gunze_init(void)
 {
-       serio_register_driver(&gunze_drv);
-       return 0;
+       return serio_register_driver(&gunze_drv);
 }
 
 static void __exit gunze_exit(void)