Commit b58d13a0 authored by Alan Cox's avatar Alan Cox Committed by Live-CD User

serial: move port users helper

This little helper is now tty_port specific and useful generally so move it
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent bdc04e31
...@@ -52,8 +52,6 @@ static struct lock_class_key port_lock_key; ...@@ -52,8 +52,6 @@ static struct lock_class_key port_lock_key;
#define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) #define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8)
#define uart_users(state) ((state)->port.count + (state)->port.blocked_open)
#ifdef CONFIG_SERIAL_CORE_CONSOLE #ifdef CONFIG_SERIAL_CORE_CONSOLE
#define uart_console(port) ((port)->cons && (port)->cons->index == (port)->line) #define uart_console(port) ((port)->cons && (port)->cons->index == (port)->line)
#else #else
...@@ -758,7 +756,7 @@ static int uart_set_info(struct uart_state *state, ...@@ -758,7 +756,7 @@ static int uart_set_info(struct uart_state *state,
/* /*
* Make sure that we are the sole user of this port. * Make sure that we are the sole user of this port.
*/ */
if (uart_users(state) > 1) if (tty_port_users(port) > 1)
goto exit; goto exit;
/* /*
...@@ -974,7 +972,7 @@ static int uart_do_autoconfig(struct uart_state *state) ...@@ -974,7 +972,7 @@ static int uart_do_autoconfig(struct uart_state *state)
return -ERESTARTSYS; return -ERESTARTSYS;
ret = -EBUSY; ret = -EBUSY;
if (uart_users(state) == 1) { if (tty_port_users(port) == 1) {
uart_shutdown(state); uart_shutdown(state);
/* /*
......
...@@ -467,6 +467,11 @@ extern int tty_port_close_start(struct tty_port *port, ...@@ -467,6 +467,11 @@ extern int tty_port_close_start(struct tty_port *port,
extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty); extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty);
extern void tty_port_close(struct tty_port *port, extern void tty_port_close(struct tty_port *port,
struct tty_struct *tty, struct file *filp); struct tty_struct *tty, struct file *filp);
extern inline int tty_port_users(struct tty_port *port)
{
return port->count + port->blocked_open;
}
extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc); extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
extern int tty_unregister_ldisc(int disc); extern int tty_unregister_ldisc(int disc);
extern int tty_set_ldisc(struct tty_struct *tty, int ldisc); extern int tty_set_ldisc(struct tty_struct *tty, int ldisc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment