linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH tty-next 1/2] serial: 8250: Fix rs485 delay after console write
@ 2020-03-26 12:20 Lukas Wunner
  2020-03-26 12:20 ` [PATCH tty-next 2/2] serial: 8250: Optimize irq enable " Lukas Wunner
  2020-03-26 14:40 ` [PATCH tty-next 1/2] serial: 8250: Fix rs485 delay " Greg Kroah-Hartman
  0 siblings, 2 replies; 4+ messages in thread
From: Lukas Wunner @ 2020-03-26 12:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Matwey V. Kornilov, Heiko Schocher, Giulio Benetti,
	Uwe Kleine-Koenig, Stefan Wahren, Martin Sperl, Heiko Stuebner,
	linux-serial

Due to a silly copy-paste mistake, commit 6194c38fc20d ("serial: 8250:
Support console on software emulated rs485 ports") erroneously pauses
for the duration of delay_rts_before_send after writing to the console,
instead of delay_rts_after_send.  Mea culpa.

Fixes: 6194c38fc20d ("serial: 8250: Support console on software emulated rs485 ports")
Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
 drivers/tty/serial/8250/8250_port.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 2f973280c34a..a1d3aef3c406 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -3271,7 +3271,7 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,
 	serial_port_out(port, UART_IER, ier);
 
 	if (em485) {
-		mdelay(port->rs485.delay_rts_before_send);
+		mdelay(port->rs485.delay_rts_after_send);
 		if (em485->tx_stopped)
 			up->rs485_stop_tx(up);
 	}
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH tty-next 2/2] serial: 8250: Optimize irq enable after console write
  2020-03-26 12:20 [PATCH tty-next 1/2] serial: 8250: Fix rs485 delay after console write Lukas Wunner
@ 2020-03-26 12:20 ` Lukas Wunner
  2020-03-26 14:40 ` [PATCH tty-next 1/2] serial: 8250: Fix rs485 delay " Greg Kroah-Hartman
  1 sibling, 0 replies; 4+ messages in thread
From: Lukas Wunner @ 2020-03-26 12:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Matwey V. Kornilov, Heiko Schocher, Giulio Benetti,
	Uwe Kleine-Koenig, Stefan Wahren, Martin Sperl, Heiko Stuebner,
	linux-serial

Commit 6194c38fc20d ("serial: 8250: Support console on software emulated
rs485 ports") amended serial8250_console_write() with rs485 support, but
positioned the invocation of ->rs485_stop_tx() after re-enablement of
interrupts.  The irq handler and ->console_write() are serialized with
the port spinlock, so no problem there, but due to the rs485 delay, the
irq handler may unnecessarily spin for a while.  Avoid that by moving
->rs485_stop_tx() before re-enablement of interrupts, which also mirrors
the order at the beginning of serial8250_console_write().

Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
 drivers/tty/serial/8250/8250_port.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index a1d3aef3c406..f77bf820b7a3 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -3268,7 +3268,6 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,
 	 *	and restore the IER
 	 */
 	wait_for_xmitr(up, BOTH_EMPTY);
-	serial_port_out(port, UART_IER, ier);
 
 	if (em485) {
 		mdelay(port->rs485.delay_rts_after_send);
@@ -3276,6 +3275,8 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,
 			up->rs485_stop_tx(up);
 	}
 
+	serial_port_out(port, UART_IER, ier);
+
 	/*
 	 *	The receive handling will happen properly because the
 	 *	receive ready bit will still be set; it is not cleared
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH tty-next 1/2] serial: 8250: Fix rs485 delay after console write
  2020-03-26 12:20 [PATCH tty-next 1/2] serial: 8250: Fix rs485 delay after console write Lukas Wunner
  2020-03-26 12:20 ` [PATCH tty-next 2/2] serial: 8250: Optimize irq enable " Lukas Wunner
@ 2020-03-26 14:40 ` Greg Kroah-Hartman
  2020-03-26 15:05   ` Lukas Wunner
  1 sibling, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2020-03-26 14:40 UTC (permalink / raw)
  To: Lukas Wunner
  Cc: Jiri Slaby, Matwey V. Kornilov, Heiko Schocher, Giulio Benetti,
	Uwe Kleine-Koenig, Stefan Wahren, Martin Sperl, Heiko Stuebner,
	linux-serial

On Thu, Mar 26, 2020 at 01:20:15PM +0100, Lukas Wunner wrote:
> Due to a silly copy-paste mistake, commit 6194c38fc20d ("serial: 8250:
> Support console on software emulated rs485 ports") erroneously pauses
> for the duration of delay_rts_before_send after writing to the console,
> instead of delay_rts_after_send.  Mea culpa.
> 
> Fixes: 6194c38fc20d ("serial: 8250: Support console on software emulated rs485 ports")

Where did this commit id come from?

Don't you mean 7f9803072ff6 ("serial: 8250: Support console on software
emulated rs485 ports")?

If so, can you please fix this up and resend the series?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH tty-next 1/2] serial: 8250: Fix rs485 delay after console write
  2020-03-26 14:40 ` [PATCH tty-next 1/2] serial: 8250: Fix rs485 delay " Greg Kroah-Hartman
@ 2020-03-26 15:05   ` Lukas Wunner
  0 siblings, 0 replies; 4+ messages in thread
From: Lukas Wunner @ 2020-03-26 15:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jiri Slaby, Matwey V. Kornilov, Heiko Schocher, Giulio Benetti,
	Uwe Kleine-Koenig, Stefan Wahren, Martin Sperl, Heiko Stuebner,
	linux-serial

On Thu, Mar 26, 2020 at 03:40:47PM +0100, Greg Kroah-Hartman wrote:
> On Thu, Mar 26, 2020 at 01:20:15PM +0100, Lukas Wunner wrote:
> > Due to a silly copy-paste mistake, commit 6194c38fc20d ("serial: 8250:
> > Support console on software emulated rs485 ports") erroneously pauses
> > for the duration of delay_rts_before_send after writing to the console,
> > instead of delay_rts_after_send.  Mea culpa.
> > 
> > Fixes: 6194c38fc20d ("serial: 8250: Support console on software emulated rs485 ports")
> 
> Where did this commit id come from?

Stupid me, it came from my downstream branch. :-(
Thanks a lot for double-checking this, will resend.
Sorry for the noise.

Lukas

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-03-26 15:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26 12:20 [PATCH tty-next 1/2] serial: 8250: Fix rs485 delay after console write Lukas Wunner
2020-03-26 12:20 ` [PATCH tty-next 2/2] serial: 8250: Optimize irq enable " Lukas Wunner
2020-03-26 14:40 ` [PATCH tty-next 1/2] serial: 8250: Fix rs485 delay " Greg Kroah-Hartman
2020-03-26 15:05   ` Lukas Wunner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).