aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/proc/proc_tty.c15
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
70static int show_tty_driver(struct seq_file *m, void *v) 70static 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 */
107static void *t_start(struct seq_file *m, loff_t *pos) 107static 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
119static void *t_next(struct seq_file *m, void *v, loff_t *pos) 113static 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
127static void t_stop(struct seq_file *m, void *v) 118static void t_stop(struct seq_file *m, void *v)