Merge branch 'drm-patches' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
[pandora-kernel.git] / drivers / input / mouse / vsxxxaa.c
index 36e9442..c3d64fc 100644 (file)
@@ -81,7 +81,6 @@
 #include <linux/slab.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
-#include <linux/config.h>
 #include <linux/serio.h>
 #include <linux/init.h>
 
@@ -153,22 +152,25 @@ vsxxxaa_detection_done (struct vsxxxaa *mouse)
 {
        switch (mouse->type) {
                case 0x02:
-                       sprintf (mouse->name, "DEC VSXXX-AA/-GA mouse");
+                       strlcpy (mouse->name, "DEC VSXXX-AA/-GA mouse",
+                                sizeof (mouse->name));
                        break;
 
                case 0x04:
-                       sprintf (mouse->name, "DEC VSXXX-AB digitizer");
+                       strlcpy (mouse->name, "DEC VSXXX-AB digitizer",
+                                sizeof (mouse->name));
                        break;
 
                default:
-                       sprintf (mouse->name, "unknown DEC pointer device "
-                                       "(type = 0x%02x)", mouse->type);
+                       snprintf (mouse->name, sizeof (mouse->name),
+                                 "unknown DEC pointer device (type = 0x%02x)",
+                                 mouse->type);
                        break;
        }
 
-       printk (KERN_INFO "Found %s version 0x%02x from country 0x%02x "
-                       "on port %s\n", mouse->name, mouse->version,
-                       mouse->country, mouse->phys);
+       printk (KERN_INFO
+               "Found %s version 0x%02x from country 0x%02x on port %s\n",
+               mouse->name, mouse->version, mouse->country, mouse->phys);
 }
 
 /*
@@ -209,7 +211,7 @@ vsxxxaa_smells_like_packet (struct vsxxxaa *mouse, unsigned char type, size_t le
 }
 
 static void
-vsxxxaa_handle_REL_packet (struct vsxxxaa *mouse, struct pt_regs *regs)
+vsxxxaa_handle_REL_packet (struct vsxxxaa *mouse)
 {
        struct input_dev *dev = mouse->dev;
        unsigned char *buf = mouse->buf;
@@ -256,7 +258,6 @@ vsxxxaa_handle_REL_packet (struct vsxxxaa *mouse, struct pt_regs *regs)
        /*
         * Report what we've found so far...
         */
-       input_regs (dev, regs);
        input_report_key (dev, BTN_LEFT, left);
        input_report_key (dev, BTN_MIDDLE, middle);
        input_report_key (dev, BTN_RIGHT, right);
@@ -267,7 +268,7 @@ vsxxxaa_handle_REL_packet (struct vsxxxaa *mouse, struct pt_regs *regs)
 }
 
 static void
-vsxxxaa_handle_ABS_packet (struct vsxxxaa *mouse, struct pt_regs *regs)
+vsxxxaa_handle_ABS_packet (struct vsxxxaa *mouse)
 {
        struct input_dev *dev = mouse->dev;
        unsigned char *buf = mouse->buf;
@@ -310,7 +311,6 @@ vsxxxaa_handle_ABS_packet (struct vsxxxaa *mouse, struct pt_regs *regs)
        /*
         * Report what we've found so far...
         */
-       input_regs (dev, regs);
        input_report_key (dev, BTN_LEFT, left);
        input_report_key (dev, BTN_MIDDLE, middle);
        input_report_key (dev, BTN_RIGHT, right);
@@ -321,7 +321,7 @@ vsxxxaa_handle_ABS_packet (struct vsxxxaa *mouse, struct pt_regs *regs)
 }
 
 static void
-vsxxxaa_handle_POR_packet (struct vsxxxaa *mouse, struct pt_regs *regs)
+vsxxxaa_handle_POR_packet (struct vsxxxaa *mouse)
 {
        struct input_dev *dev = mouse->dev;
        unsigned char *buf = mouse->buf;
@@ -365,7 +365,6 @@ vsxxxaa_handle_POR_packet (struct vsxxxaa *mouse, struct pt_regs *regs)
 
        if (error <= 0x1f) {
                /* No (serious) error. Report buttons */
-               input_regs (dev, regs);
                input_report_key (dev, BTN_LEFT, left);
                input_report_key (dev, BTN_MIDDLE, middle);
                input_report_key (dev, BTN_RIGHT, right);
@@ -393,7 +392,7 @@ vsxxxaa_handle_POR_packet (struct vsxxxaa *mouse, struct pt_regs *regs)
 }
 
 static void
-vsxxxaa_parse_buffer (struct vsxxxaa *mouse, struct pt_regs *regs)
+vsxxxaa_parse_buffer (struct vsxxxaa *mouse)
 {
        unsigned char *buf = mouse->buf;
        int stray_bytes;
@@ -430,7 +429,7 @@ vsxxxaa_parse_buffer (struct vsxxxaa *mouse, struct pt_regs *regs)
                                continue;
                        }
 
-                       vsxxxaa_handle_REL_packet (mouse, regs);
+                       vsxxxaa_handle_REL_packet (mouse);
                        continue; /* More to parse? */
                }
 
@@ -444,7 +443,7 @@ vsxxxaa_parse_buffer (struct vsxxxaa *mouse, struct pt_regs *regs)
                                continue;
                        }
 
-                       vsxxxaa_handle_ABS_packet (mouse, regs);
+                       vsxxxaa_handle_ABS_packet (mouse);
                        continue; /* More to parse? */
                }
 
@@ -458,7 +457,7 @@ vsxxxaa_parse_buffer (struct vsxxxaa *mouse, struct pt_regs *regs)
                                continue;
                        }
 
-                       vsxxxaa_handle_POR_packet (mouse, regs);
+                       vsxxxaa_handle_POR_packet (mouse);
                        continue; /* More to parse? */
                }
 
@@ -467,13 +466,12 @@ vsxxxaa_parse_buffer (struct vsxxxaa *mouse, struct pt_regs *regs)
 }
 
 static irqreturn_t
-vsxxxaa_interrupt (struct serio *serio, unsigned char data, unsigned int flags,
-               struct pt_regs *regs)
+vsxxxaa_interrupt (struct serio *serio, unsigned char data, unsigned int flags)
 {
        struct vsxxxaa *mouse = serio_get_drvdata (serio);
 
        vsxxxaa_queue_byte (mouse, data);
-       vsxxxaa_parse_buffer (mouse, regs);
+       vsxxxaa_parse_buffer (mouse);
 
        return IRQ_HANDLED;
 }
@@ -499,12 +497,13 @@ vsxxxaa_connect (struct serio *serio, struct serio_driver *drv)
        mouse = kzalloc (sizeof (struct vsxxxaa), GFP_KERNEL);
        input_dev = input_allocate_device ();
        if (!mouse || !input_dev)
-               goto fail;
+               goto fail1;
 
        mouse->dev = input_dev;
        mouse->serio = serio;
-       sprintf (mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer");
-       sprintf (mouse->phys, "%s/input0", serio->phys);
+       strlcat (mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer",
+                sizeof (mouse->name));
+       snprintf (mouse->phys, sizeof (mouse->phys), "%s/input0", serio->phys);
 
        input_dev->name = mouse->name;
        input_dev->phys = mouse->phys;
@@ -528,7 +527,7 @@ vsxxxaa_connect (struct serio *serio, struct serio_driver *drv)
 
        err = serio_open (serio, drv);
        if (err)
-               goto fail;
+               goto fail2;
 
        /*
         * Request selftest. Standard packet format and differential
@@ -536,12 +535,15 @@ vsxxxaa_connect (struct serio *serio, struct serio_driver *drv)
         */
        serio->write (serio, 'T'); /* Test */
 
-       input_register_device (input_dev);
+       err = input_register_device (input_dev);
+       if (err)
+               goto fail3;
 
        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 (mouse);
        return err;
 }
@@ -572,8 +574,7 @@ static struct serio_driver vsxxxaa_drv = {
 static int __init
 vsxxxaa_init (void)
 {
-       serio_register_driver(&vsxxxaa_drv);
-       return 0;
+       return serio_register_driver(&vsxxxaa_drv);
 }
 
 static void __exit