aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/hil_ptr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/mouse/hil_ptr.c')
-rw-r--r--drivers/input/mouse/hil_ptr.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/drivers/input/mouse/hil_ptr.c b/drivers/input/mouse/hil_ptr.c
index bc22849c6c79..c2bf2ed07dc6 100644
--- a/drivers/input/mouse/hil_ptr.c
+++ b/drivers/input/mouse/hil_ptr.c
@@ -196,7 +196,7 @@ static irqreturn_t hil_ptr_interrupt(struct serio *serio,
196 hil_packet packet; 196 hil_packet packet;
197 int idx; 197 int idx;
198 198
199 ptr = (struct hil_ptr *)serio->private; 199 ptr = serio_get_drvdata(serio);
200 if (ptr == NULL) { 200 if (ptr == NULL) {
201 BUG(); 201 BUG();
202 return IRQ_HANDLED; 202 return IRQ_HANDLED;
@@ -227,7 +227,7 @@ static void hil_ptr_disconnect(struct serio *serio)
227{ 227{
228 struct hil_ptr *ptr; 228 struct hil_ptr *ptr;
229 229
230 ptr = (struct hil_ptr *)serio->private; 230 ptr = serio_get_drvdata(serio);
231 if (ptr == NULL) { 231 if (ptr == NULL) {
232 BUG(); 232 BUG();
233 return; 233 return;
@@ -238,21 +238,19 @@ static void hil_ptr_disconnect(struct serio *serio)
238 kfree(ptr); 238 kfree(ptr);
239} 239}
240 240
241static void hil_ptr_connect(struct serio *serio, struct serio_driver *driver) 241static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
242{ 242{
243 struct hil_ptr *ptr; 243 struct hil_ptr *ptr;
244 char *txt; 244 char *txt;
245 unsigned int i, naxsets, btntype; 245 unsigned int i, naxsets, btntype;
246 uint8_t did, *idd; 246 uint8_t did, *idd;
247 247
248 if (serio->type != (SERIO_HIL_MLC | SERIO_HIL)) return; 248 if (!(ptr = kmalloc(sizeof(struct hil_ptr), GFP_KERNEL))) return -ENOMEM;
249
250 if (!(ptr = kmalloc(sizeof(struct hil_ptr), GFP_KERNEL))) return;
251 memset(ptr, 0, sizeof(struct hil_ptr)); 249 memset(ptr, 0, sizeof(struct hil_ptr));
252 250
253 if (serio_open(serio, driver)) goto bail0; 251 if (serio_open(serio, driver)) goto bail0;
254 252
255 serio->private = ptr; 253 serio_set_drvdata(serio, ptr);
256 ptr->serio = serio; 254 ptr->serio = serio;
257 ptr->dev.private = ptr; 255 ptr->dev.private = ptr;
258 256
@@ -380,23 +378,34 @@ static void hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
380 (btntype == BTN_MOUSE) ? "HIL mouse":"HIL tablet or touchpad", 378 (btntype == BTN_MOUSE) ? "HIL mouse":"HIL tablet or touchpad",
381 did); 379 did);
382 380
383 return; 381 return 0;
384 bail1: 382 bail1:
385 serio_close(serio); 383 serio_close(serio);
386 bail0: 384 bail0:
387 kfree(ptr); 385 kfree(ptr);
388 return; 386 serio_set_drvdata(serio, NULL);
387 return -ENODEV;
389} 388}
390 389
390static struct serio_device_id hil_ptr_ids[] = {
391 {
392 .type = SERIO_HIL_MLC,
393 .proto = SERIO_HIL,
394 .id = SERIO_ANY,
395 .extra = SERIO_ANY,
396 },
397 { 0 }
398};
391 399
392static struct serio_driver hil_ptr_serio_driver = { 400static struct serio_driver hil_ptr_serio_driver = {
393 .driver = { 401 .driver = {
394 .name = "hil_ptr", 402 .name = "hil_ptr",
395 }, 403 },
396 .description = "HP HIL mouse/tablet driver", 404 .description = "HP HIL mouse/tablet driver",
397 .connect = hil_ptr_connect, 405 .id_table = hil_ptr_ids,
398 .disconnect = hil_ptr_disconnect, 406 .connect = hil_ptr_connect,
399 .interrupt = hil_ptr_interrupt 407 .disconnect = hil_ptr_disconnect,
408 .interrupt = hil_ptr_interrupt
400}; 409};
401 410
402static int __init hil_ptr_init(void) 411static int __init hil_ptr_init(void)