]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/input/mouse/trackpoint.c
Input: psmouse - add support for Elantech touchpads
[linux-2.6-omap-h63xx.git] / drivers / input / mouse / trackpoint.c
index ae5871a0e060fac36f5899436dc9bea9037b53d0..e68c814c43612f449d4b9976a1cc45fbb7445efd 100644 (file)
@@ -11,7 +11,6 @@
 #include <linux/delay.h>
 #include <linux/serio.h>
 #include <linux/module.h>
-#include <linux/moduleparam.h>
 #include <linux/input.h>
 #include <linux/libps2.h>
 #include <linux/proc_fs.h>
@@ -90,10 +89,8 @@ static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data,
        struct trackpoint_attr_data *attr = data;
        unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset);
        unsigned long value;
-       char *rest;
 
-       value = simple_strtoul(buf, &rest, 10);
-       if (*rest || value > 255)
+       if (strict_strtoul(buf, 10, &value) || value > 255)
                return -EINVAL;
 
        *field = value;
@@ -118,10 +115,8 @@ static ssize_t trackpoint_set_bit_attr(struct psmouse *psmouse, void *data,
        struct trackpoint_attr_data *attr = data;
        unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset);
        unsigned long value;
-       char *rest;
 
-       value = simple_strtoul(buf, &rest, 10);
-       if (*rest || value > 1)
+       if (strict_strtoul(buf, 10, &value) || value > 1)
                return -EINVAL;
 
        if (attr->inverted)
@@ -293,6 +288,7 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties)
        struct ps2dev *ps2dev = &psmouse->ps2dev;
        unsigned char firmware_id;
        unsigned char button_info;
+       int error;
 
        if (trackpoint_start_protocol(psmouse, &firmware_id))
                return -1;
@@ -305,7 +301,7 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties)
                button_info = 0;
        }
 
-       psmouse->private = priv = kcalloc(1, sizeof(struct trackpoint_data), GFP_KERNEL);
+       psmouse->private = priv = kzalloc(sizeof(struct trackpoint_data), GFP_KERNEL);
        if (!priv)
                return -1;
 
@@ -318,7 +314,14 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties)
        trackpoint_defaults(priv);
        trackpoint_sync(psmouse);
 
-       sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group);
+       error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group);
+       if (error) {
+               printk(KERN_ERR
+                       "trackpoint.c: failed to create sysfs attributes, error: %d\n",
+                       error);
+               kfree(priv);
+               return -1;
+       }
 
        printk(KERN_INFO "IBM TrackPoint firmware: 0x%02x, buttons: %d/%d\n",
                firmware_id, (button_info & 0xf0) >> 4, button_info & 0x0f);