diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-06-04 07:35:26 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2012-07-28 11:47:58 -0400 |
commit | 060ed31dd9ede0726f8c88aff36c6cd8ec6d0fe8 (patch) | |
tree | 8707cad6d39fc374b7a3983eda6e94a444a9afff /arch | |
parent | 28a33cbc24e4256c143dce96c7d93bf423229f92 (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: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/um/drivers/line.c | 7 | ||||
-rw-r--r-- | arch/um/drivers/line.h | 2 |
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 | ||
34 | struct line { | 34 | struct 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; |