Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 62172
b: refs/heads/master
c: ad5d972
h: refs/heads/master
v: v3
  • Loading branch information
Pavel Emelianov authored and Dmitry Torokhov committed Jul 18, 2007
1 parent 4098988 commit df901a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 080c652d6d68e5524de800b32f0701f9c6834f23
refs/heads/master: ad5d972cdad41ab4d6bfb95f656e508707447c95
29 changes: 4 additions & 25 deletions trunk/drivers/input/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,37 +471,16 @@ static unsigned int input_proc_devices_poll(struct file *file, poll_table *wait)
return 0;
}

static struct list_head *list_get_nth_element(struct list_head *list, loff_t *pos)
{
struct list_head *node;
loff_t i = 0;

list_for_each(node, list)
if (i++ == *pos)
return node;

return NULL;
}

static struct list_head *list_get_next_element(struct list_head *list, struct list_head *element, loff_t *pos)
{
if (element->next == list)
return NULL;

++(*pos);
return element->next;
}

static void *input_devices_seq_start(struct seq_file *seq, loff_t *pos)
{
/* acquire lock here ... Yes, we do need locking, I knowi, I know... */

return list_get_nth_element(&input_dev_list, pos);
return seq_list_start(&input_dev_list, *pos);
}

static void *input_devices_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
return list_get_next_element(&input_dev_list, v, pos);
return seq_list_next(v, &input_dev_list, pos);
}

static void input_devices_seq_stop(struct seq_file *seq, void *v)
Expand Down Expand Up @@ -592,13 +571,13 @@ static void *input_handlers_seq_start(struct seq_file *seq, loff_t *pos)
{
/* acquire lock here ... Yes, we do need locking, I knowi, I know... */
seq->private = (void *)(unsigned long)*pos;
return list_get_nth_element(&input_handler_list, pos);
return seq_list_start(&input_handler_list, *pos);
}

static void *input_handlers_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
seq->private = (void *)(unsigned long)(*pos + 1);
return list_get_next_element(&input_handler_list, v, pos);
return seq_list_next(v, &input_handler_list, pos);
}

static void input_handlers_seq_stop(struct seq_file *seq, void *v)
Expand Down

0 comments on commit df901a6

Please sign in to comment.