aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/serial/serial_core.c6
-rw-r--r--include/linux/tty.h5
2 files changed, 7 insertions, 4 deletions
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index e16d15343df..3c45a8d7eb7 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -52,8 +52,6 @@ static struct lock_class_key port_lock_key;
52 52
53#define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) 53#define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8)
54 54
55#define uart_users(state) ((state)->port.count + (state)->port.blocked_open)
56
57#ifdef CONFIG_SERIAL_CORE_CONSOLE 55#ifdef CONFIG_SERIAL_CORE_CONSOLE
58#define uart_console(port) ((port)->cons && (port)->cons->index == (port)->line) 56#define uart_console(port) ((port)->cons && (port)->cons->index == (port)->line)
59#else 57#else
@@ -758,7 +756,7 @@ static int uart_set_info(struct uart_state *state,
758 /* 756 /*
759 * Make sure that we are the sole user of this port. 757 * Make sure that we are the sole user of this port.
760 */ 758 */
761 if (uart_users(state) > 1) 759 if (tty_port_users(port) > 1)
762 goto exit; 760 goto exit;
763 761
764 /* 762 /*
@@ -974,7 +972,7 @@ static int uart_do_autoconfig(struct uart_state *state)
974 return -ERESTARTSYS; 972 return -ERESTARTSYS;
975 973
976 ret = -EBUSY; 974 ret = -EBUSY;
977 if (uart_users(state) == 1) { 975 if (tty_port_users(port) == 1) {
978 uart_shutdown(state); 976 uart_shutdown(state);
979 977
980 /* 978 /*
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 0daa8a72b17..a0e03309a37 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -467,6 +467,11 @@ extern int tty_port_close_start(struct tty_port *port,
467extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty); 467extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty);
468extern void tty_port_close(struct tty_port *port, 468extern void tty_port_close(struct tty_port *port,
469 struct tty_struct *tty, struct file *filp); 469 struct tty_struct *tty, struct file *filp);
470extern inline int tty_port_users(struct tty_port *port)
471{
472 return port->count + port->blocked_open;
473}
474
470extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc); 475extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
471extern int tty_unregister_ldisc(int disc); 476extern int tty_unregister_ldisc(int disc);
472extern int tty_set_ldisc(struct tty_struct *tty, int ldisc); 477extern int tty_set_ldisc(struct tty_struct *tty, int ldisc);