]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
TTY: um/line, add tty_port
authorJiri Slaby <jslaby@suse.cz>
Mon, 4 Jun 2012 11:35:26 +0000 (13:35 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Jun 2012 22:54:09 +0000 (15:54 -0700)
And use count from there.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: user-mode-linux-devel@lists.sourceforge.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/um/drivers/line.c
arch/um/drivers/line.h

index acfd0e0fd0c98cfcabe626581eea0a722c86b6ff..482a7bd4a64c2c1342f4dd33035d6250f1ab102a 100644 (file)
@@ -404,7 +404,7 @@ int line_open(struct line *lines, struct tty_struct *tty)
                goto out_unlock;
 
        err = 0;
-       if (line->count++)
+       if (line->port.count++)
                goto out_unlock;
 
        BUG_ON(tty->driver_data);
@@ -446,7 +446,7 @@ void line_close(struct tty_struct *tty, struct file * filp)
        mutex_lock(&line->count_lock);
        BUG_ON(!line->valid);
 
-       if (--line->count)
+       if (--line->port.count)
                goto out_unlock;
 
        line->tty = NULL;
@@ -478,7 +478,7 @@ int setup_one_line(struct line *lines, int n, char *init,
 
        mutex_lock(&line->count_lock);
 
-       if (line->count) {
+       if (line->port.count) {
                *error_out = "Device is already open";
                goto out;
        }
@@ -663,6 +663,7 @@ int register_lines(struct line_driver *line_driver,
        driver->init_termios = tty_std_termios;
        
        for (i = 0; i < nlines; i++) {
+               tty_port_init(&lines[i].port);
                spin_lock_init(&lines[i].lock);
                mutex_init(&lines[i].count_lock);
                lines[i].driver = line_driver;
index 0a1834719dbaff1e0d6afa6333c1df3a4f8274db..0e06a1f441d7819f26ee084d48215b4c752cbfb5 100644 (file)
@@ -32,9 +32,9 @@ struct line_driver {
 };
 
 struct line {
+       struct tty_port port;
        struct tty_struct *tty;
        struct mutex count_lock;
-       unsigned long count;
        int valid;
 
        char *init_str;