fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / input / joystick / twidjoy.c
index 7f8b009..9cf17d6 100644 (file)
@@ -104,7 +104,7 @@ struct twidjoy {
  * Twiddler. It updates the data accordingly.
  */
 
-static void twidjoy_process_packet(struct twidjoy *twidjoy, struct pt_regs *regs)
+static void twidjoy_process_packet(struct twidjoy *twidjoy)
 {
        struct input_dev *dev = twidjoy->dev;
        unsigned char *data = twidjoy->data;
@@ -113,8 +113,6 @@ static void twidjoy_process_packet(struct twidjoy *twidjoy, struct pt_regs *regs
 
        button_bits = ((data[1] & 0x7f) << 7) | (data[0] & 0x7f);
 
-       input_regs(dev, regs);
-
        for (bp = twidjoy_buttons; bp->bitmask; bp++) {
                int value = (button_bits & (bp->bitmask << bp->bitshift)) >> bp->bitshift;
                int i;
@@ -141,7 +139,7 @@ static void twidjoy_process_packet(struct twidjoy *twidjoy, struct pt_regs *regs
  * packet processing routine.
  */
 
-static irqreturn_t twidjoy_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs)
+static irqreturn_t twidjoy_interrupt(struct serio *serio, unsigned char data, unsigned int flags)
 {
        struct twidjoy *twidjoy = serio_get_drvdata(serio);
 
@@ -158,7 +156,7 @@ static irqreturn_t twidjoy_interrupt(struct serio *serio, unsigned char data, un
                twidjoy->data[twidjoy->idx++] = data;
 
        if (twidjoy->idx == TWIDJOY_MAX_LENGTH) {
-               twidjoy_process_packet(twidjoy, regs);
+               twidjoy_process_packet(twidjoy);
                twidjoy->idx = 0;
        }
 
@@ -196,10 +194,10 @@ static int twidjoy_connect(struct serio *serio, struct serio_driver *drv)
        twidjoy = kzalloc(sizeof(struct twidjoy), GFP_KERNEL);
        input_dev = input_allocate_device();
        if (!twidjoy || !input_dev)
-               goto fail;
+               goto fail1;
 
        twidjoy->dev = input_dev;
-       sprintf(twidjoy->phys, "%s/input0", serio->phys);
+       snprintf(twidjoy->phys, sizeof(twidjoy->phys), "%s/input0", serio->phys);
 
        input_dev->name = "Handykey Twiddler";
        input_dev->phys = twidjoy->phys;
@@ -223,13 +221,17 @@ static int twidjoy_connect(struct serio *serio, struct serio_driver *drv)
 
        err = serio_open(serio, drv);
        if (err)
-               goto fail;
+               goto fail2;
+
+       err = input_register_device(twidjoy->dev);
+       if (err)
+               goto fail3;
 
-       input_register_device(twidjoy->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(twidjoy);
        return err;
 }
@@ -267,8 +269,7 @@ static struct serio_driver twidjoy_drv = {
 
 static int __init twidjoy_init(void)
 {
-       serio_register_driver(&twidjoy_drv);
-       return 0;
+       return serio_register_driver(&twidjoy_drv);
 }
 
 static void __exit twidjoy_exit(void)