Commit 46c65b71 authored by Pavel Emelianov's avatar Pavel Emelianov Committed by Linus Torvalds

Make /proc/misc use seq_list_xxx helpers

Simple and stupid - just use the helpers.
Signed-off-by: default avatarPavel Emelianov <xemul@openvz.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 13d31894
...@@ -67,25 +67,13 @@ extern int pmu_device_init(void); ...@@ -67,25 +67,13 @@ extern int pmu_device_init(void);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static void *misc_seq_start(struct seq_file *seq, loff_t *pos) static void *misc_seq_start(struct seq_file *seq, loff_t *pos)
{ {
struct miscdevice *p;
loff_t off = 0;
mutex_lock(&misc_mtx); mutex_lock(&misc_mtx);
list_for_each_entry(p, &misc_list, list) { return seq_list_start(&misc_list, *pos);
if (*pos == off++)
return p;
}
return NULL;
} }
static void *misc_seq_next(struct seq_file *seq, void *v, loff_t *pos) static void *misc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{ {
struct list_head *n = ((struct miscdevice *)v)->list.next; return seq_list_next(v, &misc_list, pos);
++*pos;
return (n != &misc_list) ? list_entry(n, struct miscdevice, list)
: NULL;
} }
static void misc_seq_stop(struct seq_file *seq, void *v) 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,7 +83,7 @@ static void misc_seq_stop(struct seq_file *seq, void *v)
static int misc_seq_show(struct seq_file *seq, void *v) static int misc_seq_show(struct seq_file *seq, void *v)
{ {
const struct miscdevice *p = v; const struct miscdevice *p = list_entry(v, struct miscdevice, list);
seq_printf(seq, "%3i %s\n", p->minor, p->name ? p->name : ""); seq_printf(seq, "%3i %s\n", p->minor, p->name ? p->name : "");
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment