aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-06-04 07:35:26 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-12 18:54:09 -0400
commit042e6c29c16c9c20c31110b611ed60187b0c873a (patch)
tree6a5405b8ef0b195aab51b76f63c1273f8c061cdb /arch
parentc0e7865003ae9929f32bcb7277f591115fa242b7 (diff)
TTY: um/line, add tty_port
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/um/drivers/line.c7
-rw-r--r--arch/um/drivers/line.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index acfd0e0fd0c9..482a7bd4a64c 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -404,7 +404,7 @@ int line_open(struct line *lines, struct tty_struct *tty)
404 goto out_unlock; 404 goto out_unlock;
405 405
406 err = 0; 406 err = 0;
407 if (line->count++) 407 if (line->port.count++)
408 goto out_unlock; 408 goto out_unlock;
409 409
410 BUG_ON(tty->driver_data); 410 BUG_ON(tty->driver_data);
@@ -446,7 +446,7 @@ void line_close(struct tty_struct *tty, struct file * filp)
446 mutex_lock(&line->count_lock); 446 mutex_lock(&line->count_lock);
447 BUG_ON(!line->valid); 447 BUG_ON(!line->valid);
448 448
449 if (--line->count) 449 if (--line->port.count)
450 goto out_unlock; 450 goto out_unlock;
451 451
452 line->tty = NULL; 452 line->tty = NULL;
@@ -478,7 +478,7 @@ int setup_one_line(struct line *lines, int n, char *init,
478 478
479 mutex_lock(&line->count_lock); 479 mutex_lock(&line->count_lock);
480 480
481 if (line->count) { 481 if (line->port.count) {
482 *error_out = "Device is already open"; 482 *error_out = "Device is already open";
483 goto out; 483 goto out;
484 } 484 }
@@ -663,6 +663,7 @@ int register_lines(struct line_driver *line_driver,
663 driver->init_termios = tty_std_termios; 663 driver->init_termios = tty_std_termios;
664 664
665 for (i = 0; i < nlines; i++) { 665 for (i = 0; i < nlines; i++) {
666 tty_port_init(&lines[i].port);
666 spin_lock_init(&lines[i].lock); 667 spin_lock_init(&lines[i].lock);
667 mutex_init(&lines[i].count_lock); 668 mutex_init(&lines[i].count_lock);
668 lines[i].driver = line_driver; 669 lines[i].driver = line_driver;
diff --git a/arch/um/drivers/line.h b/arch/um/drivers/line.h
index 0a1834719dba..0e06a1f441d7 100644
--- a/arch/um/drivers/line.h
+++ b/arch/um/drivers/line.h
@@ -32,9 +32,9 @@ struct line_driver {
32}; 32};
33 33
34struct line { 34struct line {
35 struct tty_port port;
35 struct tty_struct *tty; 36 struct tty_struct *tty;
36 struct mutex count_lock; 37 struct mutex count_lock;
37 unsigned long count;
38 int valid; 38 int valid;
39 39
40 char *init_str; 40 char *init_str;