]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/proc/proc_tty.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux...
[linux-2.6-omap-h63xx.git] / fs / proc / proc_tty.c
index 15c4455b09eb33200adcc2c6984123fd7592083d..22846225acfaa933b992ed4e787199960b601757 100644 (file)
@@ -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)
 {
-       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 to = from + p->num;
 
@@ -106,24 +106,18 @@ static int show_tty_driver(struct seq_file *m, void *v)
 /* iterator */
 static void *t_start(struct seq_file *m, loff_t *pos)
 {
-       struct list_head *p;
-       loff_t l = *pos;
-       list_for_each(p, &tty_drivers)
-               if (!l--)
-                       return list_entry(p, struct tty_driver, tty_drivers);
-       return NULL;
+       mutex_lock(&tty_mutex);
+       return seq_list_start(&tty_drivers, *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;
-       (*pos)++;
-       return p==&tty_drivers ? NULL :
-                       list_entry(p, struct tty_driver, tty_drivers);
+       return seq_list_next(v, &tty_drivers, pos);
 }
 
 static void t_stop(struct seq_file *m, void *v)
 {
+       mutex_unlock(&tty_mutex);
 }
 
 static struct seq_operations tty_drivers_op = {
@@ -138,7 +132,7 @@ static int tty_drivers_open(struct inode *inode, struct file *file)
        return seq_open(file, &tty_drivers_op);
 }
 
-static struct file_operations proc_tty_drivers_operations = {
+static const struct file_operations proc_tty_drivers_operations = {
        .open           = tty_drivers_open,
        .read           = seq_read,
        .llseek         = seq_lseek,