Input: drivers/input/mice - don't access dev->private directly
[powerpc.git] / drivers / input / mouse / logips2pp.c
index 7972eec..9df74b7 100644 (file)
@@ -39,7 +39,7 @@ struct ps2pp_info {
  * Process a PS2++ or PS2T++ packet.
  */
 
-static psmouse_ret_t ps2pp_process_byte(struct psmouse *psmouse, struct pt_regs *regs)
+static psmouse_ret_t ps2pp_process_byte(struct psmouse *psmouse)
 {
        struct input_dev *dev = psmouse->dev;
        unsigned char *packet = psmouse->packet;
@@ -51,8 +51,6 @@ static psmouse_ret_t ps2pp_process_byte(struct psmouse *psmouse, struct pt_regs
  * Full packet accumulated, process it
  */
 
-       input_regs(dev, regs);
-
        if ((packet[0] & 0x48) == 0x48 && (packet[1] & 0x02) == 0x02) {
 
                /* Logitech extended packet */
@@ -202,6 +200,7 @@ static void ps2pp_disconnect(struct psmouse *psmouse)
 static const struct ps2pp_info *get_model_info(unsigned char model)
 {
        static const struct ps2pp_info ps2pp_list[] = {
+               {  1,   0,                      0 },    /* Simple 2-button mouse */
                { 12,   0,                      PS2PP_SIDE_BTN},
                { 13,   0,                      0 },
                { 15,   PS2PP_KIND_MX,                                  /* MX1000 */
@@ -330,6 +329,7 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
        unsigned char model, buttons;
        const struct ps2pp_info *model_info;
        int use_ps2pp = 0;
+       int error;
 
        param[0] = 0;
        ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
@@ -339,12 +339,12 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
        param[1] = 0;
        ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO);
 
-       if (!param[1])
-               return -1;
-
        model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78);
        buttons = param[1];
 
+       if (!model || !buttons)
+               return -1;
+
        if ((model_info = get_model_info(model)) != NULL) {
 
 /*
@@ -395,8 +395,14 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
                                psmouse->set_resolution = ps2pp_set_resolution;
                                psmouse->disconnect = ps2pp_disconnect;
 
-                               device_create_file(&psmouse->ps2dev.serio->dev,
-                                                  &psmouse_attr_smartscroll.dattr);
+                               error = device_create_file(&psmouse->ps2dev.serio->dev,
+                                                          &psmouse_attr_smartscroll.dattr);
+                               if (error) {
+                                       printk(KERN_ERR
+                                               "logips2pp.c: failed to create smartscroll "
+                                               "sysfs attribute, error: %d\n", error);
+                                       return -1;
+                               }
                        }
                }