[PATCH 10/19] mxser: use tty_port_close() in mxser_close()

From: Jiri Slaby
Date: Thu Nov 18 2021 - 02:32:19 EST


Finally, the mxser_close() code in is mostly identical to
tty_port_close(), so replace the code by a single call to the function.

Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
---
drivers/tty/mxser.c | 22 +---------------------
1 file changed, 1 insertion(+), 21 deletions(-)

diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index 4dafa16aa29c..6ab8899ada9c 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -896,29 +896,9 @@ static void mxser_flush_buffer(struct tty_struct *tty)
tty_wakeup(tty);
}

-/*
- * This routine is called when the serial port gets closed. First, we
- * wait for the last remaining data to be sent. Then, we unlink its
- * async structure from the interrupt chain if necessary, and we free
- * that IRQ if nothing is left in the chain.
- */
static void mxser_close(struct tty_struct *tty, struct file *filp)
{
- struct mxser_port *info = tty->driver_data;
- struct tty_port *port = &info->port;
-
- if (tty_port_close_start(port, tty, filp) == 0)
- return;
- mutex_lock(&port->mutex);
- if (tty_port_initialized(port) && C_HUPCL(tty))
- tty_port_lower_dtr_rts(port);
- mxser_shutdown_port(port);
- tty_port_set_initialized(port, 0);
- mutex_unlock(&port->mutex);
- /* Right now the tty_port set is done outside of the close_end helper
- as we don't yet have everyone using refcounts */
- tty_port_close_end(port, tty);
- tty_port_tty_set(port, NULL);
+ tty_port_close(tty->port, tty, filp);
}

static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int count)
--
2.33.1