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>
This commit is contained in:
Pavel Emelianov 2007-07-15 23:39:54 -07:00 коммит произвёл Linus Torvalds
Родитель 708f4b5223
Коммит 25216b0039
1 изменённых файлов: 3 добавлений и 12 удалений

Просмотреть файл

@ -69,7 +69,7 @@ static void show_tty_range(struct seq_file *m, struct tty_driver *p,
static int show_tty_driver(struct seq_file *m, void *v) static int show_tty_driver(struct seq_file *m, void *v)
{ {
struct tty_driver *p = v; struct tty_driver *p = list_entry(v, struct tty_driver, tty_drivers);
dev_t from = MKDEV(p->major, p->minor_start); dev_t from = MKDEV(p->major, p->minor_start);
dev_t to = from + p->num; dev_t to = from + p->num;
@ -106,22 +106,13 @@ static int show_tty_driver(struct seq_file *m, void *v)
/* iterator */ /* iterator */
static void *t_start(struct seq_file *m, loff_t *pos) static void *t_start(struct seq_file *m, loff_t *pos)
{ {
struct list_head *p;
loff_t l = *pos;
mutex_lock(&tty_mutex); mutex_lock(&tty_mutex);
list_for_each(p, &tty_drivers) return seq_list_start(&tty_drivers, *pos);
if (!l--)
return list_entry(p, struct tty_driver, tty_drivers);
return NULL;
} }
static void *t_next(struct seq_file *m, void *v, loff_t *pos) static void *t_next(struct seq_file *m, void *v, loff_t *pos)
{ {
struct list_head *p = ((struct tty_driver *)v)->tty_drivers.next; return seq_list_next(v, &tty_drivers, pos);
(*pos)++;
return p==&tty_drivers ? NULL :
list_entry(p, struct tty_driver, tty_drivers);
} }
static void t_stop(struct seq_file *m, void *v) static void t_stop(struct seq_file *m, void *v)