linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] tty: various cleanups
@ 2022-04-11 10:45 Jiri Slaby
  2022-04-11 10:45 ` [PATCH 1/3] tty: serial: mpc52xx_uart: remove double ifdeffery Jiri Slaby
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jiri Slaby @ 2022-04-11 10:45 UTC (permalink / raw)
  To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby

This is another couple of tty cleanup patches for 5.19. See the
respective patches.

Jiri Slaby (3):
  tty: serial: mpc52xx_uart: remove double ifdeffery
  tty: serial: owl-uart, send x_char even if stopped
  tty: serial: altera: use altera_jtaguart_stop_tx()

 drivers/tty/serial/altera_jtaguart.c | 6 ++----
 drivers/tty/serial/mpc52xx_uart.c    | 3 ---
 drivers/tty/serial/owl-uart.c        | 6 +++---
 3 files changed, 5 insertions(+), 10 deletions(-)

-- 
2.35.1


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

* [PATCH 1/3] tty: serial: mpc52xx_uart: remove double ifdeffery
  2022-04-11 10:45 [PATCH 0/3] tty: various cleanups Jiri Slaby
@ 2022-04-11 10:45 ` Jiri Slaby
  2022-04-11 10:45 ` [PATCH 2/3] tty: serial: owl-uart, send x_char even if stopped Jiri Slaby
  2022-04-11 10:45 ` [PATCH 3/3] tty: serial: altera: use altera_jtaguart_stop_tx() Jiri Slaby
  2 siblings, 0 replies; 5+ messages in thread
From: Jiri Slaby @ 2022-04-11 10:45 UTC (permalink / raw)
  To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby

The code now contains:
 #ifdef CONFIG_PPC_MPC512x
 ...
 #endif

 #ifdef CONFIG_PPC_MPC512x
 ...
 #endif

So remove the endif+ifdef from the middle, provided it's about the same
define.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/serial/mpc52xx_uart.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/tty/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx_uart.c
index 3acc0f185762..c4b590dd6f23 100644
--- a/drivers/tty/serial/mpc52xx_uart.c
+++ b/drivers/tty/serial/mpc52xx_uart.c
@@ -754,9 +754,6 @@ static void mpc512x_psc_get_irq(struct uart_port *port, struct device_node *np)
 	port->irqflags = IRQF_SHARED;
 	port->irq = psc_fifoc_irq;
 }
-#endif
-
-#ifdef CONFIG_PPC_MPC512x
 
 #define PSC_5125(port) ((struct mpc5125_psc __iomem *)((port)->membase))
 #define FIFO_5125(port) ((struct mpc512x_psc_fifo __iomem *)(PSC_5125(port)+1))
-- 
2.35.1


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

* [PATCH 2/3] tty: serial: owl-uart, send x_char even if stopped
  2022-04-11 10:45 [PATCH 0/3] tty: various cleanups Jiri Slaby
  2022-04-11 10:45 ` [PATCH 1/3] tty: serial: mpc52xx_uart: remove double ifdeffery Jiri Slaby
@ 2022-04-11 10:45 ` Jiri Slaby
  2022-04-11 10:45 ` [PATCH 3/3] tty: serial: altera: use altera_jtaguart_stop_tx() Jiri Slaby
  2 siblings, 0 replies; 5+ messages in thread
From: Jiri Slaby @ 2022-04-11 10:45 UTC (permalink / raw)
  To: gregkh
  Cc: linux-serial, linux-kernel, Jiri Slaby, Andreas Färber,
	Manivannan Sadhasivam

Flow control characters should be sent even if the TX is stopped. So fix
owl-uart to behave the same as other drivers.

This unification also allows the use of the TX helper in the future.

Cc: "Andreas Färber" <afaerber@suse.de>
Cc: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/serial/owl-uart.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/owl-uart.c b/drivers/tty/serial/owl-uart.c
index 5250bd7d390a..5ff7c89aeb06 100644
--- a/drivers/tty/serial/owl-uart.c
+++ b/drivers/tty/serial/owl-uart.c
@@ -184,9 +184,6 @@ static void owl_uart_send_chars(struct uart_port *port)
 	struct circ_buf *xmit = &port->state->xmit;
 	unsigned int ch;
 
-	if (uart_tx_stopped(port))
-		return;
-
 	if (port->x_char) {
 		while (!(owl_uart_read(port, OWL_UART_STAT) & OWL_UART_STAT_TFFU))
 			cpu_relax();
@@ -195,6 +192,9 @@ static void owl_uart_send_chars(struct uart_port *port)
 		port->x_char = 0;
 	}
 
+	if (uart_tx_stopped(port))
+		return;
+
 	while (!(owl_uart_read(port, OWL_UART_STAT) & OWL_UART_STAT_TFFU)) {
 		if (uart_circ_empty(xmit))
 			break;
-- 
2.35.1


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

* [PATCH 3/3] tty: serial: altera: use altera_jtaguart_stop_tx()
  2022-04-11 10:45 [PATCH 0/3] tty: various cleanups Jiri Slaby
  2022-04-11 10:45 ` [PATCH 1/3] tty: serial: mpc52xx_uart: remove double ifdeffery Jiri Slaby
  2022-04-11 10:45 ` [PATCH 2/3] tty: serial: owl-uart, send x_char even if stopped Jiri Slaby
@ 2022-04-11 10:45 ` Jiri Slaby
  2022-04-12 11:24   ` Tobias Klauser
  2 siblings, 1 reply; 5+ messages in thread
From: Jiri Slaby @ 2022-04-11 10:45 UTC (permalink / raw)
  To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby, Tobias Klauser

altera_jtaguart_tx_chars() duplicates what altera_jtaguart_stop_tx()
already does. So instead of the duplication, call the helper instead.

Not only it makes the code cleaner, but it also says what the "if"
really does.

Cc: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/serial/altera_jtaguart.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c
index 1c16345d0a1f..cb791c5149a3 100644
--- a/drivers/tty/serial/altera_jtaguart.c
+++ b/drivers/tty/serial/altera_jtaguart.c
@@ -168,10 +168,8 @@ static void altera_jtaguart_tx_chars(struct altera_jtaguart *pp)
 		}
 	}
 
-	if (pending == 0) {
-		pp->imr &= ~ALTERA_JTAGUART_CONTROL_WE_MSK;
-		writel(pp->imr, port->membase + ALTERA_JTAGUART_CONTROL_REG);
-	}
+	if (pending == 0)
+		altera_jtaguart_stop_tx(port);
 }
 
 static irqreturn_t altera_jtaguart_interrupt(int irq, void *data)
-- 
2.35.1


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

* Re: [PATCH 3/3] tty: serial: altera: use altera_jtaguart_stop_tx()
  2022-04-11 10:45 ` [PATCH 3/3] tty: serial: altera: use altera_jtaguart_stop_tx() Jiri Slaby
@ 2022-04-12 11:24   ` Tobias Klauser
  0 siblings, 0 replies; 5+ messages in thread
From: Tobias Klauser @ 2022-04-12 11:24 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: gregkh, linux-serial, linux-kernel

On 2022-04-11 at 12:45:06 +0200, Jiri Slaby <jslaby@suse.cz> wrote:
> altera_jtaguart_tx_chars() duplicates what altera_jtaguart_stop_tx()
> already does. So instead of the duplication, call the helper instead.
> 
> Not only it makes the code cleaner, but it also says what the "if"
> really does.
> 
> Cc: Tobias Klauser <tklauser@distanz.ch>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>

Acked-by: Tobias Klauser <tklauser@distanz.ch>

Thanks

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

end of thread, other threads:[~2022-04-12 12:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-11 10:45 [PATCH 0/3] tty: various cleanups Jiri Slaby
2022-04-11 10:45 ` [PATCH 1/3] tty: serial: mpc52xx_uart: remove double ifdeffery Jiri Slaby
2022-04-11 10:45 ` [PATCH 2/3] tty: serial: owl-uart, send x_char even if stopped Jiri Slaby
2022-04-11 10:45 ` [PATCH 3/3] tty: serial: altera: use altera_jtaguart_stop_tx() Jiri Slaby
2022-04-12 11:24   ` Tobias Klauser

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).