diff options
| author | Pavel Emelianov <xemul@sw.ru> | 2007-07-18 00:38:32 -0400 |
|---|---|---|
| committer | Dmitry Torokhov <dtor@insightbb.com> | 2007-07-18 00:38:32 -0400 |
| commit | ad5d972cdad41ab4d6bfb95f656e508707447c95 (patch) | |
| tree | 63b3eb6b47ecd364b9d501696e5caeba2b6640bb | |
| parent | 080c652d6d68e5524de800b32f0701f9c6834f23 (diff) | |
Input: switch to using seq_list_xxx helpers
This is essentially just a renaming of the existing functions
as copies of seq_list_start() and seq_list_next() already existed
in the input.c.
Signed-off-by: Pavel Emelianov <xemul@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
| -rw-r--r-- | drivers/input/input.c | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c index 75b4d2a83dd9..5fe755586623 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
| @@ -471,37 +471,16 @@ static unsigned int input_proc_devices_poll(struct file *file, poll_table *wait) | |||
| 471 | return 0; | 471 | return 0; |
| 472 | } | 472 | } |
| 473 | 473 | ||
| 474 | static struct list_head *list_get_nth_element(struct list_head *list, loff_t *pos) | ||
| 475 | { | ||
| 476 | struct list_head *node; | ||
| 477 | loff_t i = 0; | ||
| 478 | |||
| 479 | list_for_each(node, list) | ||
| 480 | if (i++ == *pos) | ||
| 481 | return node; | ||
| 482 | |||
| 483 | return NULL; | ||
| 484 | } | ||
| 485 | |||
| 486 | static struct list_head *list_get_next_element(struct list_head *list, struct list_head *element, loff_t *pos) | ||
| 487 | { | ||
| 488 | if (element->next == list) | ||
| 489 | return NULL; | ||
| 490 | |||
| 491 | ++(*pos); | ||
| 492 | return element->next; | ||
| 493 | } | ||
| 494 | |||
| 495 | static void *input_devices_seq_start(struct seq_file *seq, loff_t *pos) | 474 | static void *input_devices_seq_start(struct seq_file *seq, loff_t *pos) |
| 496 | { | 475 | { |
| 497 | /* acquire lock here ... Yes, we do need locking, I knowi, I know... */ | 476 | /* acquire lock here ... Yes, we do need locking, I knowi, I know... */ |
| 498 | 477 | ||
| 499 | return list_get_nth_element(&input_dev_list, pos); | 478 | return seq_list_start(&input_dev_list, *pos); |
| 500 | } | 479 | } |
| 501 | 480 | ||
| 502 | static void *input_devices_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 481 | static void *input_devices_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
| 503 | { | 482 | { |
| 504 | return list_get_next_element(&input_dev_list, v, pos); | 483 | return seq_list_next(v, &input_dev_list, pos); |
| 505 | } | 484 | } |
| 506 | 485 | ||
| 507 | static void input_devices_seq_stop(struct seq_file *seq, void *v) | 486 | static void input_devices_seq_stop(struct seq_file *seq, void *v) |
| @@ -592,13 +571,13 @@ static void *input_handlers_seq_start(struct seq_file *seq, loff_t *pos) | |||
| 592 | { | 571 | { |
| 593 | /* acquire lock here ... Yes, we do need locking, I knowi, I know... */ | 572 | /* acquire lock here ... Yes, we do need locking, I knowi, I know... */ |
| 594 | seq->private = (void *)(unsigned long)*pos; | 573 | seq->private = (void *)(unsigned long)*pos; |
| 595 | return list_get_nth_element(&input_handler_list, pos); | 574 | return seq_list_start(&input_handler_list, *pos); |
| 596 | } | 575 | } |
| 597 | 576 | ||
| 598 | static void *input_handlers_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 577 | static void *input_handlers_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
| 599 | { | 578 | { |
| 600 | seq->private = (void *)(unsigned long)(*pos + 1); | 579 | seq->private = (void *)(unsigned long)(*pos + 1); |
| 601 | return list_get_next_element(&input_handler_list, v, pos); | 580 | return seq_list_next(v, &input_handler_list, pos); |
| 602 | } | 581 | } |
| 603 | 582 | ||
| 604 | static void input_handlers_seq_stop(struct seq_file *seq, void *v) | 583 | static void input_handlers_seq_stop(struct seq_file *seq, void *v) |
