diff options
Diffstat (limited to 'drivers/input/mouse/maplemouse.c')
-rw-r--r-- | drivers/input/mouse/maplemouse.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/input/mouse/maplemouse.c b/drivers/input/mouse/maplemouse.c index e90c60cbbf05..b5b34fe4fee8 100644 --- a/drivers/input/mouse/maplemouse.c +++ b/drivers/input/mouse/maplemouse.c | |||
@@ -41,13 +41,12 @@ static int dc_mouse_connect(struct maple_device *dev) | |||
41 | unsigned long data = be32_to_cpu(dev->devinfo.function_data[0]); | 41 | unsigned long data = be32_to_cpu(dev->devinfo.function_data[0]); |
42 | struct input_dev *input_dev; | 42 | struct input_dev *input_dev; |
43 | 43 | ||
44 | if (!(input_dev = kmalloc(sizeof(struct input_dev), GFP_KERNEL))) | 44 | dev->private_data = input_dev = input_allocate_device(); |
45 | return -1; | 45 | if (!input_dev) |
46 | return -ENOMEM; | ||
46 | 47 | ||
47 | dev->private_data = input_dev; | 48 | dev->private_data = input_dev; |
48 | 49 | ||
49 | memset(input_dev, 0, sizeof(struct dc_mouse)); | ||
50 | init_input_dev(input_dev); | ||
51 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); | 50 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); |
52 | input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); | 51 | input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); |
53 | input_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y) | BIT(REL_WHEEL); | 52 | input_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y) | BIT(REL_WHEEL); |
@@ -59,8 +58,6 @@ static int dc_mouse_connect(struct maple_device *dev) | |||
59 | 58 | ||
60 | maple_getcond_callback(dev, dc_mouse_callback, 1, MAPLE_FUNC_MOUSE); | 59 | maple_getcond_callback(dev, dc_mouse_callback, 1, MAPLE_FUNC_MOUSE); |
61 | 60 | ||
62 | printk(KERN_INFO "input: mouse(0x%lx): %s\n", data, input_dev->name); | ||
63 | |||
64 | return 0; | 61 | return 0; |
65 | } | 62 | } |
66 | 63 | ||
@@ -70,7 +67,6 @@ static void dc_mouse_disconnect(struct maple_device *dev) | |||
70 | struct input_dev *input_dev = dev->private_data; | 67 | struct input_dev *input_dev = dev->private_data; |
71 | 68 | ||
72 | input_unregister_device(input_dev); | 69 | input_unregister_device(input_dev); |
73 | kfree(input_dev); | ||
74 | } | 70 | } |
75 | 71 | ||
76 | 72 | ||