diff options
author | Dmitry Torokhov <dtor@insightbb.com> | 2007-04-12 01:30:00 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2007-04-12 01:30:00 -0400 |
commit | d0ffb9be866519775da19c0a6790f5431c1a8dc6 (patch) | |
tree | 0ded8723264a1e9e41f34ea1e05740496f317e6a /drivers/input/mousedev.c | |
parent | 5b2a08262a8c952fef008154933953f083ca5766 (diff) |
Input: handlers - rename 'list' to 'client'
The naming convention in input handlers was very confusing -
client stuctures were called lists, regular lists were also
called lists making anyone looking at the code go mad.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mousedev.c')
-rw-r--r-- | drivers/input/mousedev.c | 237 |
1 files changed, 122 insertions, 115 deletions
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index 007e72f80251..f6a62687d9e4 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c | |||
@@ -63,7 +63,7 @@ struct mousedev { | |||
63 | int minor; | 63 | int minor; |
64 | char name[16]; | 64 | char name[16]; |
65 | wait_queue_head_t wait; | 65 | wait_queue_head_t wait; |
66 | struct list_head list; | 66 | struct list_head client_list; |
67 | struct input_handle handle; | 67 | struct input_handle handle; |
68 | 68 | ||
69 | struct mousedev_hw_data packet; | 69 | struct mousedev_hw_data packet; |
@@ -85,7 +85,7 @@ struct mousedev_motion { | |||
85 | }; | 85 | }; |
86 | 86 | ||
87 | #define PACKET_QUEUE_LEN 16 | 87 | #define PACKET_QUEUE_LEN 16 |
88 | struct mousedev_list { | 88 | struct mousedev_client { |
89 | struct fasync_struct *fasync; | 89 | struct fasync_struct *fasync; |
90 | struct mousedev *mousedev; | 90 | struct mousedev *mousedev; |
91 | struct list_head node; | 91 | struct list_head node; |
@@ -223,47 +223,47 @@ static void mousedev_key_event(struct mousedev *mousedev, unsigned int code, int | |||
223 | 223 | ||
224 | static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_hw_data *packet) | 224 | static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_hw_data *packet) |
225 | { | 225 | { |
226 | struct mousedev_list *list; | 226 | struct mousedev_client *client; |
227 | struct mousedev_motion *p; | 227 | struct mousedev_motion *p; |
228 | unsigned long flags; | 228 | unsigned long flags; |
229 | int wake_readers = 0; | 229 | int wake_readers = 0; |
230 | 230 | ||
231 | list_for_each_entry(list, &mousedev->list, node) { | 231 | list_for_each_entry(client, &mousedev->client_list, node) { |
232 | spin_lock_irqsave(&list->packet_lock, flags); | 232 | spin_lock_irqsave(&client->packet_lock, flags); |
233 | 233 | ||
234 | p = &list->packets[list->head]; | 234 | p = &client->packets[client->head]; |
235 | if (list->ready && p->buttons != mousedev->packet.buttons) { | 235 | if (client->ready && p->buttons != mousedev->packet.buttons) { |
236 | unsigned int new_head = (list->head + 1) % PACKET_QUEUE_LEN; | 236 | unsigned int new_head = (client->head + 1) % PACKET_QUEUE_LEN; |
237 | if (new_head != list->tail) { | 237 | if (new_head != client->tail) { |
238 | p = &list->packets[list->head = new_head]; | 238 | p = &client->packets[client->head = new_head]; |
239 | memset(p, 0, sizeof(struct mousedev_motion)); | 239 | memset(p, 0, sizeof(struct mousedev_motion)); |
240 | } | 240 | } |
241 | } | 241 | } |
242 | 242 | ||
243 | if (packet->abs_event) { | 243 | if (packet->abs_event) { |
244 | p->dx += packet->x - list->pos_x; | 244 | p->dx += packet->x - client->pos_x; |
245 | p->dy += packet->y - list->pos_y; | 245 | p->dy += packet->y - client->pos_y; |
246 | list->pos_x = packet->x; | 246 | client->pos_x = packet->x; |
247 | list->pos_y = packet->y; | 247 | client->pos_y = packet->y; |
248 | } | 248 | } |
249 | 249 | ||
250 | list->pos_x += packet->dx; | 250 | client->pos_x += packet->dx; |
251 | list->pos_x = list->pos_x < 0 ? 0 : (list->pos_x >= xres ? xres : list->pos_x); | 251 | client->pos_x = client->pos_x < 0 ? 0 : (client->pos_x >= xres ? xres : client->pos_x); |
252 | list->pos_y += packet->dy; | 252 | client->pos_y += packet->dy; |
253 | list->pos_y = list->pos_y < 0 ? 0 : (list->pos_y >= yres ? yres : list->pos_y); | 253 | client->pos_y = client->pos_y < 0 ? 0 : (client->pos_y >= yres ? yres : client->pos_y); |
254 | 254 | ||
255 | p->dx += packet->dx; | 255 | p->dx += packet->dx; |
256 | p->dy += packet->dy; | 256 | p->dy += packet->dy; |
257 | p->dz += packet->dz; | 257 | p->dz += packet->dz; |
258 | p->buttons = mousedev->packet.buttons; | 258 | p->buttons = mousedev->packet.buttons; |
259 | 259 | ||
260 | if (p->dx || p->dy || p->dz || p->buttons != list->last_buttons) | 260 | if (p->dx || p->dy || p->dz || p->buttons != client->last_buttons) |
261 | list->ready = 1; | 261 | client->ready = 1; |
262 | 262 | ||
263 | spin_unlock_irqrestore(&list->packet_lock, flags); | 263 | spin_unlock_irqrestore(&client->packet_lock, flags); |
264 | 264 | ||
265 | if (list->ready) { | 265 | if (client->ready) { |
266 | kill_fasync(&list->fasync, SIGIO, POLL_IN); | 266 | kill_fasync(&client->fasync, SIGIO, POLL_IN); |
267 | wake_readers = 1; | 267 | wake_readers = 1; |
268 | } | 268 | } |
269 | } | 269 | } |
@@ -351,9 +351,9 @@ static void mousedev_event(struct input_handle *handle, unsigned int type, unsig | |||
351 | static int mousedev_fasync(int fd, struct file *file, int on) | 351 | static int mousedev_fasync(int fd, struct file *file, int on) |
352 | { | 352 | { |
353 | int retval; | 353 | int retval; |
354 | struct mousedev_list *list = file->private_data; | 354 | struct mousedev_client *client = file->private_data; |
355 | 355 | ||
356 | retval = fasync_helper(fd, file, on, &list->fasync); | 356 | retval = fasync_helper(fd, file, on, &client->fasync); |
357 | 357 | ||
358 | return retval < 0 ? retval : 0; | 358 | return retval < 0 ? retval : 0; |
359 | } | 359 | } |
@@ -380,32 +380,33 @@ static void mixdev_release(void) | |||
380 | } | 380 | } |
381 | } | 381 | } |
382 | 382 | ||
383 | static int mousedev_release(struct inode * inode, struct file * file) | 383 | static int mousedev_release(struct inode *inode, struct file *file) |
384 | { | 384 | { |
385 | struct mousedev_list *list = file->private_data; | 385 | struct mousedev_client *client = file->private_data; |
386 | struct mousedev *mousedev = client->mousedev; | ||
386 | 387 | ||
387 | mousedev_fasync(-1, file, 0); | 388 | mousedev_fasync(-1, file, 0); |
388 | 389 | ||
389 | list_del(&list->node); | 390 | list_del(&client->node); |
391 | kfree(client); | ||
390 | 392 | ||
391 | if (!--list->mousedev->open) { | 393 | if (!--mousedev->open) { |
392 | if (list->mousedev->minor == MOUSEDEV_MIX) | 394 | if (mousedev->minor == MOUSEDEV_MIX) |
393 | mixdev_release(); | 395 | mixdev_release(); |
394 | else if (!mousedev_mix.open) { | 396 | else if (!mousedev_mix.open) { |
395 | if (list->mousedev->exist) | 397 | if (mousedev->exist) |
396 | input_close_device(&list->mousedev->handle); | 398 | input_close_device(&mousedev->handle); |
397 | else | 399 | else |
398 | mousedev_free(list->mousedev); | 400 | mousedev_free(mousedev); |
399 | } | 401 | } |
400 | } | 402 | } |
401 | 403 | ||
402 | kfree(list); | ||
403 | return 0; | 404 | return 0; |
404 | } | 405 | } |
405 | 406 | ||
406 | static int mousedev_open(struct inode * inode, struct file * file) | 407 | static int mousedev_open(struct inode *inode, struct file *file) |
407 | { | 408 | { |
408 | struct mousedev_list *list; | 409 | struct mousedev_client *client; |
409 | struct input_handle *handle; | 410 | struct input_handle *handle; |
410 | struct mousedev *mousedev; | 411 | struct mousedev *mousedev; |
411 | int i; | 412 | int i; |
@@ -417,31 +418,36 @@ static int mousedev_open(struct inode * inode, struct file * file) | |||
417 | #endif | 418 | #endif |
418 | i = iminor(inode) - MOUSEDEV_MINOR_BASE; | 419 | i = iminor(inode) - MOUSEDEV_MINOR_BASE; |
419 | 420 | ||
420 | if (i >= MOUSEDEV_MINORS || !mousedev_table[i]) | 421 | if (i >= MOUSEDEV_MINORS) |
422 | return -ENODEV; | ||
423 | |||
424 | mousedev = mousedev_table[i]; | ||
425 | if (!mousedev) | ||
421 | return -ENODEV; | 426 | return -ENODEV; |
422 | 427 | ||
423 | if (!(list = kzalloc(sizeof(struct mousedev_list), GFP_KERNEL))) | 428 | client = kzalloc(sizeof(struct mousedev_client), GFP_KERNEL); |
429 | if (!client) | ||
424 | return -ENOMEM; | 430 | return -ENOMEM; |
425 | 431 | ||
426 | spin_lock_init(&list->packet_lock); | 432 | spin_lock_init(&client->packet_lock); |
427 | list->pos_x = xres / 2; | 433 | client->pos_x = xres / 2; |
428 | list->pos_y = yres / 2; | 434 | client->pos_y = yres / 2; |
429 | list->mousedev = mousedev_table[i]; | 435 | client->mousedev = mousedev; |
430 | list_add_tail(&list->node, &mousedev_table[i]->list); | 436 | list_add_tail(&client->node, &mousedev->client_list); |
431 | file->private_data = list; | ||
432 | 437 | ||
433 | if (!list->mousedev->open++) { | 438 | if (!mousedev->open++) { |
434 | if (list->mousedev->minor == MOUSEDEV_MIX) { | 439 | if (mousedev->minor == MOUSEDEV_MIX) { |
435 | list_for_each_entry(handle, &mousedev_handler.h_list, h_node) { | 440 | list_for_each_entry(handle, &mousedev_handler.h_list, h_node) { |
436 | mousedev = handle->private; | 441 | struct mousedev *md = handle->private; |
437 | if (!mousedev->open && mousedev->exist) | 442 | if (!md->open && md->exist) |
438 | input_open_device(handle); | 443 | input_open_device(handle); |
439 | } | 444 | } |
440 | } else | 445 | } else |
441 | if (!mousedev_mix.open && list->mousedev->exist) | 446 | if (!mousedev_mix.open && mousedev->exist) |
442 | input_open_device(&list->mousedev->handle); | 447 | input_open_device(&mousedev->handle); |
443 | } | 448 | } |
444 | 449 | ||
450 | file->private_data = client; | ||
445 | return 0; | 451 | return 0; |
446 | } | 452 | } |
447 | 453 | ||
@@ -450,13 +456,13 @@ static inline int mousedev_limit_delta(int delta, int limit) | |||
450 | return delta > limit ? limit : (delta < -limit ? -limit : delta); | 456 | return delta > limit ? limit : (delta < -limit ? -limit : delta); |
451 | } | 457 | } |
452 | 458 | ||
453 | static void mousedev_packet(struct mousedev_list *list, signed char *ps2_data) | 459 | static void mousedev_packet(struct mousedev_client *client, signed char *ps2_data) |
454 | { | 460 | { |
455 | struct mousedev_motion *p; | 461 | struct mousedev_motion *p; |
456 | unsigned long flags; | 462 | unsigned long flags; |
457 | 463 | ||
458 | spin_lock_irqsave(&list->packet_lock, flags); | 464 | spin_lock_irqsave(&client->packet_lock, flags); |
459 | p = &list->packets[list->tail]; | 465 | p = &client->packets[client->tail]; |
460 | 466 | ||
461 | ps2_data[0] = 0x08 | ((p->dx < 0) << 4) | ((p->dy < 0) << 5) | (p->buttons & 0x07); | 467 | ps2_data[0] = 0x08 | ((p->dx < 0) << 4) | ((p->dy < 0) << 5) | (p->buttons & 0x07); |
462 | ps2_data[1] = mousedev_limit_delta(p->dx, 127); | 468 | ps2_data[1] = mousedev_limit_delta(p->dx, 127); |
@@ -464,44 +470,44 @@ static void mousedev_packet(struct mousedev_list *list, signed char *ps2_data) | |||
464 | p->dx -= ps2_data[1]; | 470 | p->dx -= ps2_data[1]; |
465 | p->dy -= ps2_data[2]; | 471 | p->dy -= ps2_data[2]; |
466 | 472 | ||
467 | switch (list->mode) { | 473 | switch (client->mode) { |
468 | case MOUSEDEV_EMUL_EXPS: | 474 | case MOUSEDEV_EMUL_EXPS: |
469 | ps2_data[3] = mousedev_limit_delta(p->dz, 7); | 475 | ps2_data[3] = mousedev_limit_delta(p->dz, 7); |
470 | p->dz -= ps2_data[3]; | 476 | p->dz -= ps2_data[3]; |
471 | ps2_data[3] = (ps2_data[3] & 0x0f) | ((p->buttons & 0x18) << 1); | 477 | ps2_data[3] = (ps2_data[3] & 0x0f) | ((p->buttons & 0x18) << 1); |
472 | list->bufsiz = 4; | 478 | client->bufsiz = 4; |
473 | break; | 479 | break; |
474 | 480 | ||
475 | case MOUSEDEV_EMUL_IMPS: | 481 | case MOUSEDEV_EMUL_IMPS: |
476 | ps2_data[0] |= ((p->buttons & 0x10) >> 3) | ((p->buttons & 0x08) >> 1); | 482 | ps2_data[0] |= ((p->buttons & 0x10) >> 3) | ((p->buttons & 0x08) >> 1); |
477 | ps2_data[3] = mousedev_limit_delta(p->dz, 127); | 483 | ps2_data[3] = mousedev_limit_delta(p->dz, 127); |
478 | p->dz -= ps2_data[3]; | 484 | p->dz -= ps2_data[3]; |
479 | list->bufsiz = 4; | 485 | client->bufsiz = 4; |
480 | break; | 486 | break; |
481 | 487 | ||
482 | case MOUSEDEV_EMUL_PS2: | 488 | case MOUSEDEV_EMUL_PS2: |
483 | default: | 489 | default: |
484 | ps2_data[0] |= ((p->buttons & 0x10) >> 3) | ((p->buttons & 0x08) >> 1); | 490 | ps2_data[0] |= ((p->buttons & 0x10) >> 3) | ((p->buttons & 0x08) >> 1); |
485 | p->dz = 0; | 491 | p->dz = 0; |
486 | list->bufsiz = 3; | 492 | client->bufsiz = 3; |
487 | break; | 493 | break; |
488 | } | 494 | } |
489 | 495 | ||
490 | if (!p->dx && !p->dy && !p->dz) { | 496 | if (!p->dx && !p->dy && !p->dz) { |
491 | if (list->tail == list->head) { | 497 | if (client->tail == client->head) { |
492 | list->ready = 0; | 498 | client->ready = 0; |
493 | list->last_buttons = p->buttons; | 499 | client->last_buttons = p->buttons; |
494 | } else | 500 | } else |
495 | list->tail = (list->tail + 1) % PACKET_QUEUE_LEN; | 501 | client->tail = (client->tail + 1) % PACKET_QUEUE_LEN; |
496 | } | 502 | } |
497 | 503 | ||
498 | spin_unlock_irqrestore(&list->packet_lock, flags); | 504 | spin_unlock_irqrestore(&client->packet_lock, flags); |
499 | } | 505 | } |
500 | 506 | ||
501 | 507 | ||
502 | static ssize_t mousedev_write(struct file * file, const char __user * buffer, size_t count, loff_t *ppos) | 508 | static ssize_t mousedev_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) |
503 | { | 509 | { |
504 | struct mousedev_list *list = file->private_data; | 510 | struct mousedev_client *client = file->private_data; |
505 | unsigned char c; | 511 | unsigned char c; |
506 | unsigned int i; | 512 | unsigned int i; |
507 | 513 | ||
@@ -510,95 +516,95 @@ static ssize_t mousedev_write(struct file * file, const char __user * buffer, si | |||
510 | if (get_user(c, buffer + i)) | 516 | if (get_user(c, buffer + i)) |
511 | return -EFAULT; | 517 | return -EFAULT; |
512 | 518 | ||
513 | if (c == mousedev_imex_seq[list->imexseq]) { | 519 | if (c == mousedev_imex_seq[client->imexseq]) { |
514 | if (++list->imexseq == MOUSEDEV_SEQ_LEN) { | 520 | if (++client->imexseq == MOUSEDEV_SEQ_LEN) { |
515 | list->imexseq = 0; | 521 | client->imexseq = 0; |
516 | list->mode = MOUSEDEV_EMUL_EXPS; | 522 | client->mode = MOUSEDEV_EMUL_EXPS; |
517 | } | 523 | } |
518 | } else | 524 | } else |
519 | list->imexseq = 0; | 525 | client->imexseq = 0; |
520 | 526 | ||
521 | if (c == mousedev_imps_seq[list->impsseq]) { | 527 | if (c == mousedev_imps_seq[client->impsseq]) { |
522 | if (++list->impsseq == MOUSEDEV_SEQ_LEN) { | 528 | if (++client->impsseq == MOUSEDEV_SEQ_LEN) { |
523 | list->impsseq = 0; | 529 | client->impsseq = 0; |
524 | list->mode = MOUSEDEV_EMUL_IMPS; | 530 | client->mode = MOUSEDEV_EMUL_IMPS; |
525 | } | 531 | } |
526 | } else | 532 | } else |
527 | list->impsseq = 0; | 533 | client->impsseq = 0; |
528 | 534 | ||
529 | list->ps2[0] = 0xfa; | 535 | client->ps2[0] = 0xfa; |
530 | 536 | ||
531 | switch (c) { | 537 | switch (c) { |
532 | 538 | ||
533 | case 0xeb: /* Poll */ | 539 | case 0xeb: /* Poll */ |
534 | mousedev_packet(list, &list->ps2[1]); | 540 | mousedev_packet(client, &client->ps2[1]); |
535 | list->bufsiz++; /* account for leading ACK */ | 541 | client->bufsiz++; /* account for leading ACK */ |
536 | break; | 542 | break; |
537 | 543 | ||
538 | case 0xf2: /* Get ID */ | 544 | case 0xf2: /* Get ID */ |
539 | switch (list->mode) { | 545 | switch (client->mode) { |
540 | case MOUSEDEV_EMUL_PS2: list->ps2[1] = 0; break; | 546 | case MOUSEDEV_EMUL_PS2: client->ps2[1] = 0; break; |
541 | case MOUSEDEV_EMUL_IMPS: list->ps2[1] = 3; break; | 547 | case MOUSEDEV_EMUL_IMPS: client->ps2[1] = 3; break; |
542 | case MOUSEDEV_EMUL_EXPS: list->ps2[1] = 4; break; | 548 | case MOUSEDEV_EMUL_EXPS: client->ps2[1] = 4; break; |
543 | } | 549 | } |
544 | list->bufsiz = 2; | 550 | client->bufsiz = 2; |
545 | break; | 551 | break; |
546 | 552 | ||
547 | case 0xe9: /* Get info */ | 553 | case 0xe9: /* Get info */ |
548 | list->ps2[1] = 0x60; list->ps2[2] = 3; list->ps2[3] = 200; | 554 | client->ps2[1] = 0x60; client->ps2[2] = 3; client->ps2[3] = 200; |
549 | list->bufsiz = 4; | 555 | client->bufsiz = 4; |
550 | break; | 556 | break; |
551 | 557 | ||
552 | case 0xff: /* Reset */ | 558 | case 0xff: /* Reset */ |
553 | list->impsseq = list->imexseq = 0; | 559 | client->impsseq = client->imexseq = 0; |
554 | list->mode = MOUSEDEV_EMUL_PS2; | 560 | client->mode = MOUSEDEV_EMUL_PS2; |
555 | list->ps2[1] = 0xaa; list->ps2[2] = 0x00; | 561 | client->ps2[1] = 0xaa; client->ps2[2] = 0x00; |
556 | list->bufsiz = 3; | 562 | client->bufsiz = 3; |
557 | break; | 563 | break; |
558 | 564 | ||
559 | default: | 565 | default: |
560 | list->bufsiz = 1; | 566 | client->bufsiz = 1; |
561 | break; | 567 | break; |
562 | } | 568 | } |
563 | 569 | ||
564 | list->buffer = list->bufsiz; | 570 | client->buffer = client->bufsiz; |
565 | } | 571 | } |
566 | 572 | ||
567 | kill_fasync(&list->fasync, SIGIO, POLL_IN); | 573 | kill_fasync(&client->fasync, SIGIO, POLL_IN); |
568 | 574 | ||
569 | wake_up_interruptible(&list->mousedev->wait); | 575 | wake_up_interruptible(&client->mousedev->wait); |
570 | 576 | ||
571 | return count; | 577 | return count; |
572 | } | 578 | } |
573 | 579 | ||
574 | static ssize_t mousedev_read(struct file * file, char __user * buffer, size_t count, loff_t *ppos) | 580 | static ssize_t mousedev_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) |
575 | { | 581 | { |
576 | struct mousedev_list *list = file->private_data; | 582 | struct mousedev_client *client = file->private_data; |
577 | int retval = 0; | 583 | int retval = 0; |
578 | 584 | ||
579 | if (!list->ready && !list->buffer && (file->f_flags & O_NONBLOCK)) | 585 | if (!client->ready && !client->buffer && (file->f_flags & O_NONBLOCK)) |
580 | return -EAGAIN; | 586 | return -EAGAIN; |
581 | 587 | ||
582 | retval = wait_event_interruptible(list->mousedev->wait, | 588 | retval = wait_event_interruptible(client->mousedev->wait, |
583 | !list->mousedev->exist || list->ready || list->buffer); | 589 | !client->mousedev->exist || client->ready || client->buffer); |
584 | 590 | ||
585 | if (retval) | 591 | if (retval) |
586 | return retval; | 592 | return retval; |
587 | 593 | ||
588 | if (!list->mousedev->exist) | 594 | if (!client->mousedev->exist) |
589 | return -ENODEV; | 595 | return -ENODEV; |
590 | 596 | ||
591 | if (!list->buffer && list->ready) { | 597 | if (!client->buffer && client->ready) { |
592 | mousedev_packet(list, list->ps2); | 598 | mousedev_packet(client, client->ps2); |
593 | list->buffer = list->bufsiz; | 599 | client->buffer = client->bufsiz; |
594 | } | 600 | } |
595 | 601 | ||
596 | if (count > list->buffer) | 602 | if (count > client->buffer) |
597 | count = list->buffer; | 603 | count = client->buffer; |
598 | 604 | ||
599 | list->buffer -= count; | 605 | client->buffer -= count; |
600 | 606 | ||
601 | if (copy_to_user(buffer, list->ps2 + list->bufsiz - list->buffer - count, count)) | 607 | if (copy_to_user(buffer, client->ps2 + client->bufsiz - client->buffer - count, count)) |
602 | return -EFAULT; | 608 | return -EFAULT; |
603 | 609 | ||
604 | return count; | 610 | return count; |
@@ -607,11 +613,12 @@ static ssize_t mousedev_read(struct file * file, char __user * buffer, size_t co | |||
607 | /* No kernel lock - fine */ | 613 | /* No kernel lock - fine */ |
608 | static unsigned int mousedev_poll(struct file *file, poll_table *wait) | 614 | static unsigned int mousedev_poll(struct file *file, poll_table *wait) |
609 | { | 615 | { |
610 | struct mousedev_list *list = file->private_data; | 616 | struct mousedev_client *client = file->private_data; |
617 | struct mousedev *mousedev = client->mousedev; | ||
611 | 618 | ||
612 | poll_wait(file, &list->mousedev->wait, wait); | 619 | poll_wait(file, &mousedev->wait, wait); |
613 | return ((list->ready || list->buffer) ? (POLLIN | POLLRDNORM) : 0) | | 620 | return ((client->ready || client->buffer) ? (POLLIN | POLLRDNORM) : 0) | |
614 | (list->mousedev->exist ? 0 : (POLLHUP | POLLERR)); | 621 | (mousedev->exist ? 0 : (POLLHUP | POLLERR)); |
615 | } | 622 | } |
616 | 623 | ||
617 | static const struct file_operations mousedev_fops = { | 624 | static const struct file_operations mousedev_fops = { |
@@ -643,7 +650,7 @@ static int mousedev_connect(struct input_handler *handler, struct input_dev *dev | |||
643 | if (!mousedev) | 650 | if (!mousedev) |
644 | return -ENOMEM; | 651 | return -ENOMEM; |
645 | 652 | ||
646 | INIT_LIST_HEAD(&mousedev->list); | 653 | INIT_LIST_HEAD(&mousedev->client_list); |
647 | INIT_LIST_HEAD(&mousedev->mixdev_node); | 654 | INIT_LIST_HEAD(&mousedev->mixdev_node); |
648 | init_waitqueue_head(&mousedev->wait); | 655 | init_waitqueue_head(&mousedev->wait); |
649 | 656 | ||
@@ -699,7 +706,7 @@ static int mousedev_connect(struct input_handler *handler, struct input_dev *dev | |||
699 | static void mousedev_disconnect(struct input_handle *handle) | 706 | static void mousedev_disconnect(struct input_handle *handle) |
700 | { | 707 | { |
701 | struct mousedev *mousedev = handle->private; | 708 | struct mousedev *mousedev = handle->private; |
702 | struct mousedev_list *list; | 709 | struct mousedev_client *client; |
703 | 710 | ||
704 | input_unregister_handle(handle); | 711 | input_unregister_handle(handle); |
705 | 712 | ||
@@ -711,8 +718,8 @@ static void mousedev_disconnect(struct input_handle *handle) | |||
711 | if (mousedev->open) { | 718 | if (mousedev->open) { |
712 | input_close_device(handle); | 719 | input_close_device(handle); |
713 | wake_up_interruptible(&mousedev->wait); | 720 | wake_up_interruptible(&mousedev->wait); |
714 | list_for_each_entry(list, &mousedev->list, node) | 721 | list_for_each_entry(client, &mousedev->client_list, node) |
715 | kill_fasync(&list->fasync, SIGIO, POLL_HUP); | 722 | kill_fasync(&client->fasync, SIGIO, POLL_HUP); |
716 | } else { | 723 | } else { |
717 | if (mousedev_mix.open) | 724 | if (mousedev_mix.open) |
718 | input_close_device(handle); | 725 | input_close_device(handle); |
@@ -745,7 +752,7 @@ static const struct input_device_id mousedev_ids[] = { | |||
745 | .absbit = { BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) | BIT(ABS_TOOL_WIDTH) }, | 752 | .absbit = { BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) | BIT(ABS_TOOL_WIDTH) }, |
746 | }, /* A touchpad */ | 753 | }, /* A touchpad */ |
747 | 754 | ||
748 | { }, /* Terminating entry */ | 755 | { }, /* Terminating entry */ |
749 | }; | 756 | }; |
750 | 757 | ||
751 | MODULE_DEVICE_TABLE(input, mousedev_ids); | 758 | MODULE_DEVICE_TABLE(input, mousedev_ids); |
@@ -777,7 +784,7 @@ static int __init mousedev_init(void) | |||
777 | return error; | 784 | return error; |
778 | 785 | ||
779 | memset(&mousedev_mix, 0, sizeof(struct mousedev)); | 786 | memset(&mousedev_mix, 0, sizeof(struct mousedev)); |
780 | INIT_LIST_HEAD(&mousedev_mix.list); | 787 | INIT_LIST_HEAD(&mousedev_mix.client_list); |
781 | init_waitqueue_head(&mousedev_mix.wait); | 788 | init_waitqueue_head(&mousedev_mix.wait); |
782 | mousedev_table[MOUSEDEV_MIX] = &mousedev_mix; | 789 | mousedev_table[MOUSEDEV_MIX] = &mousedev_mix; |
783 | mousedev_mix.exist = 1; | 790 | mousedev_mix.exist = 1; |