TTY: add tty_port_tty_hangup helper
It allows for cleaning up on a considerable amount of places. They did port_get, hangup, kref_put. Now the only thing needed is to call tty_port_tty_hangup which does exactly that. And they can also decide whether to consider CLOCAL or completely ignore that. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
e4408ce3c2
commit
aa27a094e2
@@ -134,7 +134,6 @@ static void sdio_uart_port_put(struct sdio_uart_port *port)
|
||||
static void sdio_uart_port_remove(struct sdio_uart_port *port)
|
||||
{
|
||||
struct sdio_func *func;
|
||||
struct tty_struct *tty;
|
||||
|
||||
BUG_ON(sdio_uart_table[port->index] != port);
|
||||
|
||||
@@ -155,12 +154,8 @@ static void sdio_uart_port_remove(struct sdio_uart_port *port)
|
||||
sdio_claim_host(func);
|
||||
port->func = NULL;
|
||||
mutex_unlock(&port->func_lock);
|
||||
tty = tty_port_tty_get(&port->port);
|
||||
/* tty_hangup is async so is this safe as is ?? */
|
||||
if (tty) {
|
||||
tty_hangup(tty);
|
||||
tty_kref_put(tty);
|
||||
}
|
||||
tty_port_tty_hangup(&port->port, false);
|
||||
mutex_unlock(&port->port.mutex);
|
||||
sdio_release_irq(func);
|
||||
sdio_disable_func(func);
|
||||
@@ -492,11 +487,7 @@ static void sdio_uart_check_modem_status(struct sdio_uart_port *port)
|
||||
wake_up_interruptible(&port->port.open_wait);
|
||||
else {
|
||||
/* DCD drop - hang up if tty attached */
|
||||
tty = tty_port_tty_get(&port->port);
|
||||
if (tty) {
|
||||
tty_hangup(tty);
|
||||
tty_kref_put(tty);
|
||||
}
|
||||
tty_port_tty_hangup(&port->port, false);
|
||||
}
|
||||
}
|
||||
if (status & UART_MSR_DCTS) {
|
||||
|
Reference in New Issue
Block a user