diff options
author | Pavel Emelianov <xemul@sw.ru> | 2007-07-16 02:39:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 12:05:42 -0400 |
commit | 25216b00395dfb52bfe06e4886a6ad831ede7b4b (patch) | |
tree | 94b65088457a5b641cc4acc9f0409b4d9a2bf50e /fs/proc/proc_tty.c | |
parent | 708f4b522371da5e6c615a49e1844195aff84cb4 (diff) |
Make /proc/tty/drivers use seq_list_xxx helpers
Simple and stupid like some previous ones. Just use new API.
Signed-off-by: Pavel Emelianov <xemul@openvz.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc/proc_tty.c')
-rw-r--r-- | fs/proc/proc_tty.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/fs/proc/proc_tty.c b/fs/proc/proc_tty.c index b3a473b0a191..22846225acfa 100644 --- a/fs/proc/proc_tty.c +++ b/fs/proc/proc_tty.c | |||
@@ -69,7 +69,7 @@ static void show_tty_range(struct seq_file *m, struct tty_driver *p, | |||
69 | 69 | ||
70 | static int show_tty_driver(struct seq_file *m, void *v) | 70 | static int show_tty_driver(struct seq_file *m, void *v) |
71 | { | 71 | { |
72 | struct tty_driver *p = v; | 72 | struct tty_driver *p = list_entry(v, struct tty_driver, tty_drivers); |
73 | dev_t from = MKDEV(p->major, p->minor_start); | 73 | dev_t from = MKDEV(p->major, p->minor_start); |
74 | dev_t to = from + p->num; | 74 | dev_t to = from + p->num; |
75 | 75 | ||
@@ -106,22 +106,13 @@ static int show_tty_driver(struct seq_file *m, void *v) | |||
106 | /* iterator */ | 106 | /* iterator */ |
107 | static void *t_start(struct seq_file *m, loff_t *pos) | 107 | static void *t_start(struct seq_file *m, loff_t *pos) |
108 | { | 108 | { |
109 | struct list_head *p; | ||
110 | loff_t l = *pos; | ||
111 | |||
112 | mutex_lock(&tty_mutex); | 109 | mutex_lock(&tty_mutex); |
113 | list_for_each(p, &tty_drivers) | 110 | return seq_list_start(&tty_drivers, *pos); |
114 | if (!l--) | ||
115 | return list_entry(p, struct tty_driver, tty_drivers); | ||
116 | return NULL; | ||
117 | } | 111 | } |
118 | 112 | ||
119 | static void *t_next(struct seq_file *m, void *v, loff_t *pos) | 113 | static void *t_next(struct seq_file *m, void *v, loff_t *pos) |
120 | { | 114 | { |
121 | struct list_head *p = ((struct tty_driver *)v)->tty_drivers.next; | 115 | return seq_list_next(v, &tty_drivers, pos); |
122 | (*pos)++; | ||
123 | return p==&tty_drivers ? NULL : | ||
124 | list_entry(p, struct tty_driver, tty_drivers); | ||
125 | } | 116 | } |
126 | 117 | ||
127 | static void t_stop(struct seq_file *m, void *v) | 118 | static void t_stop(struct seq_file *m, void *v) |