diff mbox series

[3/6] serial: core: fully suppress raising DTR & RTS on open if manual_rtsdtr

Message ID 20220527222718.A21433740218@freecalypso.org
State Superseded
Headers show
Series [1/6] tty: add port flag to suppress raising DTR & RTS on open | expand

Commit Message

Mychaela N. Falconia May 27, 2022, 10:27 p.m. UTC
When manual_rtsdtr sysfs attribute is written as 1,
TTY_PORT_MANUAL_RTSDTR is set, and the call to raise DTR & RTS in
tty_port_raise_dtr_rts() is suppressed.  However, there is one other
place where these signals are also raised on open: uart_port_startup()
in drivers/tty/serial/serial_core.c - this other point of raising
DTR & RTS also needs to be suppressed if TTY_PORT_MANUAL_RTSDTR is set.

Signed-off-by: Mychaela N. Falconia <falcon@freecalypso.org>
---
 drivers/tty/serial/serial_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Andy Shevchenko May 30, 2022, 1:36 p.m. UTC | #1
On Sat, May 28, 2022 at 9:53 PM Mychaela N. Falconia
<falcon@freecalypso.org> wrote:
>
> When manual_rtsdtr sysfs attribute is written as 1,
> TTY_PORT_MANUAL_RTSDTR is set, and the call to raise DTR & RTS in
> tty_port_raise_dtr_rts() is suppressed.  However, there is one other
> place where these signals are also raised on open: uart_port_startup()
> in drivers/tty/serial/serial_core.c - this other point of raising
> DTR & RTS also needs to be suppressed if TTY_PORT_MANUAL_RTSDTR is set.

...

> -               if (init_hw && C_BAUD(tty))
> +               if (init_hw && !tty_port_manual_rtsdtr(&state->port) &&
> +                   C_BAUD(tty))
>                         uart_port_dtr_rts(uport, 1);
>         }

As per patch 1, I would put the custom flag check first.
diff mbox series

Patch

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index b47004a3fb77..e5e00732e8fa 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -236,7 +236,8 @@  static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,
 		 * Setup the RTS and DTR signals once the
 		 * port is open and ready to respond.
 		 */
-		if (init_hw && C_BAUD(tty))
+		if (init_hw && !tty_port_manual_rtsdtr(&state->port) &&
+		    C_BAUD(tty))
 			uart_port_dtr_rts(uport, 1);
 	}