diff options
Diffstat (limited to 'drivers/input/mouse/trackpoint.c')
-rw-r--r-- | drivers/input/mouse/trackpoint.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index e354362f2971..0643e49ca603 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * Trademarks are the property of their respective owners. | 8 | * Trademarks are the property of their respective owners. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/slab.h> | ||
11 | #include <linux/delay.h> | 12 | #include <linux/delay.h> |
12 | #include <linux/serio.h> | 13 | #include <linux/serio.h> |
13 | #include <linux/module.h> | 14 | #include <linux/module.h> |
@@ -284,7 +285,6 @@ static int trackpoint_reconnect(struct psmouse *psmouse) | |||
284 | 285 | ||
285 | int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | 286 | int trackpoint_detect(struct psmouse *psmouse, bool set_properties) |
286 | { | 287 | { |
287 | struct trackpoint_data *priv; | ||
288 | struct ps2dev *ps2dev = &psmouse->ps2dev; | 288 | struct ps2dev *ps2dev = &psmouse->ps2dev; |
289 | unsigned char firmware_id; | 289 | unsigned char firmware_id; |
290 | unsigned char button_info; | 290 | unsigned char button_info; |
@@ -301,8 +301,8 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | |||
301 | button_info = 0; | 301 | button_info = 0; |
302 | } | 302 | } |
303 | 303 | ||
304 | psmouse->private = priv = kzalloc(sizeof(struct trackpoint_data), GFP_KERNEL); | 304 | psmouse->private = kzalloc(sizeof(struct trackpoint_data), GFP_KERNEL); |
305 | if (!priv) | 305 | if (!psmouse->private) |
306 | return -1; | 306 | return -1; |
307 | 307 | ||
308 | psmouse->vendor = "IBM"; | 308 | psmouse->vendor = "IBM"; |
@@ -311,7 +311,10 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | |||
311 | psmouse->reconnect = trackpoint_reconnect; | 311 | psmouse->reconnect = trackpoint_reconnect; |
312 | psmouse->disconnect = trackpoint_disconnect; | 312 | psmouse->disconnect = trackpoint_disconnect; |
313 | 313 | ||
314 | trackpoint_defaults(priv); | 314 | if ((button_info & 0x0f) >= 3) |
315 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | ||
316 | |||
317 | trackpoint_defaults(psmouse->private); | ||
315 | trackpoint_sync(psmouse); | 318 | trackpoint_sync(psmouse); |
316 | 319 | ||
317 | error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group); | 320 | error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group); |
@@ -319,7 +322,8 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | |||
319 | printk(KERN_ERR | 322 | printk(KERN_ERR |
320 | "trackpoint.c: failed to create sysfs attributes, error: %d\n", | 323 | "trackpoint.c: failed to create sysfs attributes, error: %d\n", |
321 | error); | 324 | error); |
322 | kfree(priv); | 325 | kfree(psmouse->private); |
326 | psmouse->private = NULL; | ||
323 | return -1; | 327 | return -1; |
324 | } | 328 | } |
325 | 329 | ||