[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1463042948-12205-26-git-send-email-m.othacehe@gmail.com>
Date: Thu, 12 May 2016 10:48:57 +0200
From: Mathieu OTHACEHE <m.othacehe@...il.com>
To: johan@...nel.org
Cc: gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org,
Mathieu OTHACEHE <m.othacehe@...il.com>
Subject: [PATCH 25/36] usb: serial: ti_usb_3410_5052: Check old_termios parameter in set_termios
The old_termios parameter is never used in set_termios callback.
Add a check to old_termios to see if we can return right away because
there is nothing to change.
Add a check to old_termios CBAUD to see if we can set DTR/RTS because
last speed was B0.
Also pass NULL for old_termios in open callback because it is the
initial call to set_termios.
Signed-off-by: Mathieu OTHACEHE <m.othacehe@...il.com>
---
drivers/usb/serial/ti_usb_3410_5052.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 4769c80..b50f52f 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -710,7 +710,7 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port)
}
if (tty)
- ti_set_termios(tty, port, &tty->termios);
+ ti_set_termios(tty, port, NULL);
status = ti_send_ctrl_urb(serial, TI_OPEN_PORT, open_settings,
TI_UART1_PORT + port_number);
@@ -750,7 +750,7 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port)
usb_clear_halt(serial->dev, port->read_urb->pipe);
if (tty)
- ti_set_termios(tty, port, &tty->termios);
+ ti_set_termios(tty, port, NULL);
status = ti_send_ctrl_urb(serial, TI_OPEN_PORT, open_settings,
TI_UART1_PORT + port_number);
@@ -913,6 +913,13 @@ static void ti_set_termios(struct tty_struct *tty,
cflag = tty->termios.c_cflag;
iflag = tty->termios.c_iflag;
+ if (old_termios &&
+ !tty_termios_hw_change(&tty->termios, old_termios) &&
+ tty->termios.c_iflag == old_termios->c_iflag) {
+ dev_dbg(&port->dev, "%s - nothing to change\n", __func__);
+ return;
+ }
+
dev_dbg(&port->dev,
"%s - cflag 0x%08x, iflag 0x%08x\n", __func__, cflag, iflag);
@@ -1020,6 +1027,9 @@ static void ti_set_termios(struct tty_struct *tty,
/* if baud rate is B0, clear RTS and DTR */
if (C_BAUD(tty) == B0)
mcr &= ~(TI_MCR_DTR | TI_MCR_RTS);
+ else if (old_termios && (old_termios->c_cflag & CBAUD) == B0)
+ mcr |= TI_MCR_DTR | TI_MCR_RTS;
+
status = ti_set_mcr(tport, mcr);
if (status)
dev_err(&port->dev,
--
2.8.2
Powered by blists - more mailing lists