diff options
author | Pavel Emelianov <xemul@sw.ru> | 2007-07-16 02:39:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 12:05:42 -0400 |
commit | 46c65b71e6122b89cd7b2bb36c1ba26d07e84fcd (patch) | |
tree | a3ac123150c5a3587664c8706eeceffbf8573ae6 | |
parent | 13d31894b3c459805303325aa5b91f9cd4ed70bc (diff) |
Make /proc/misc use seq_list_xxx helpers
Simple and stupid - just use the helpers.
Signed-off-by: Pavel Emelianov <xemul@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/char/misc.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 4e6fb9651a16..71c8cd7fa15f 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c | |||
@@ -67,25 +67,13 @@ extern int pmu_device_init(void); | |||
67 | #ifdef CONFIG_PROC_FS | 67 | #ifdef CONFIG_PROC_FS |
68 | static void *misc_seq_start(struct seq_file *seq, loff_t *pos) | 68 | static void *misc_seq_start(struct seq_file *seq, loff_t *pos) |
69 | { | 69 | { |
70 | struct miscdevice *p; | ||
71 | loff_t off = 0; | ||
72 | |||
73 | mutex_lock(&misc_mtx); | 70 | mutex_lock(&misc_mtx); |
74 | list_for_each_entry(p, &misc_list, list) { | 71 | return seq_list_start(&misc_list, *pos); |
75 | if (*pos == off++) | ||
76 | return p; | ||
77 | } | ||
78 | return NULL; | ||
79 | } | 72 | } |
80 | 73 | ||
81 | static void *misc_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 74 | static void *misc_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
82 | { | 75 | { |
83 | struct list_head *n = ((struct miscdevice *)v)->list.next; | 76 | return seq_list_next(v, &misc_list, pos); |
84 | |||
85 | ++*pos; | ||
86 | |||
87 | return (n != &misc_list) ? list_entry(n, struct miscdevice, list) | ||
88 | : NULL; | ||
89 | } | 77 | } |
90 | 78 | ||
91 | static void misc_seq_stop(struct seq_file *seq, void *v) | 79 | static void misc_seq_stop(struct seq_file *seq, void *v) |
@@ -95,7 +83,7 @@ static void misc_seq_stop(struct seq_file *seq, void *v) | |||
95 | 83 | ||
96 | static int misc_seq_show(struct seq_file *seq, void *v) | 84 | static int misc_seq_show(struct seq_file *seq, void *v) |
97 | { | 85 | { |
98 | const struct miscdevice *p = v; | 86 | const struct miscdevice *p = list_entry(v, struct miscdevice, list); |
99 | 87 | ||
100 | seq_printf(seq, "%3i %s\n", p->minor, p->name ? p->name : ""); | 88 | seq_printf(seq, "%3i %s\n", p->minor, p->name ? p->name : ""); |
101 | return 0; | 89 | return 0; |