mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Diogo Ivo <diogo.ivo.sx@renesas.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Jiri Slaby <jirislaby@kernel.org>
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-renesas-soc@vger.kernel.org,
	Biju Das <biju.das.jz@bp.renesas.com>,
	 Au Dang <au.dang.jx@renesas.com>,
	 Geert Uytterhoeven <geert+renesas@glider.be>,
	 Wolfram Sang <wsa+renesas@sang-engineering.com>,
	 Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	 Thierry Bultel <thierry.bultel.yh@bp.renesas.com>,
	 Diogo Ivo <diogo.ivo.sx@renesas.com>
Subject: [PATCH v4 7/7] serial: rsci: Simplify rsci_transmit_chars()
Date: Fri, 13 Nov 2026 18:26:32 +0000	[thread overview]
Message-ID: <20261113-g2ul_sci-v4-7-6815e41d90c5@renesas.com> (raw)
In-Reply-To: <20261113-g2ul_sci-v4-0-6815e41d90c5@renesas.com>

Now that sci_er_interrupt() no longer calls sci_tx_interrupt() on RSCI
ports, rsci_transmit_chars() is only invoked when CSR.TDRE and CCR0.TE
are set.

Drop the redundant CCR0.TIE manipulation in the !CSR_TDRE guard and
call rsci_stop_tx() instead of open-coding the CCR0.TIE/CCR0.TEIE
update when transmission stops.

Signed-off-by: Diogo Ivo <diogo.ivo.sx@renesas.com>
---
 drivers/tty/serial/rsci.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/tty/serial/rsci.c b/drivers/tty/serial/rsci.c
index 05703bb31afd..80087be11808 100644
--- a/drivers/tty/serial/rsci.c
+++ b/drivers/tty/serial/rsci.c
@@ -432,19 +432,12 @@ static void rsci_transmit_chars(struct uart_port *port)
 {
 	unsigned int stopped = uart_tx_stopped(port);
 	struct tty_port *tport = &port->state->port;
-	u32 status, ctrl;
+	u32 status;
 	int count;
 
 	status = rsci_serial_in(port, CSR);
-	if (!(status & CSR_TDRE)) {
-		ctrl = rsci_serial_in(port, CCR0);
-		if (kfifo_is_empty(&tport->xmit_fifo))
-			ctrl &= ~CCR0_TIE;
-		else
-			ctrl |= CCR0_TIE;
-		rsci_serial_out(port, CCR0, ctrl);
+	if (!(status & CSR_TDRE))
 		return;
-	}
 
 	count = rsci_txroom(port);
 
@@ -467,12 +460,8 @@ static void rsci_transmit_chars(struct uart_port *port)
 	if (kfifo_len(&tport->xmit_fifo) < WAKEUP_CHARS)
 		uart_write_wakeup(port);
 
-	if (kfifo_is_empty(&tport->xmit_fifo) || stopped) {
-		ctrl = rsci_serial_in(port, CCR0);
-		ctrl &= ~CCR0_TIE;
-		ctrl |= CCR0_TEIE;
-		rsci_serial_out(port, CCR0, ctrl);
-	}
+	if (kfifo_is_empty(&tport->xmit_fifo) || stopped)
+		rsci_stop_tx(port);
 }
 
 static void rsci_receive_chars(struct uart_port *port)

-- 
2.56.0


      parent reply	other threads:[~2026-11-13 18:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 18:26 [PATCH v4 0/7] Fix transmit handling on SCI/RSCI ports Diogo Ivo
2026-11-13 18:26 ` [PATCH v4 1/7] serial: sh-sci: Drop TE disable at end of transmission on SCI Diogo Ivo
2026-11-13 18:26 ` [PATCH v4 2/7] serial: sh-sci: Keep TX enabled on TEI while data is pending Diogo Ivo
2026-11-13 18:26 ` [PATCH v4 3/7] serial: rsci: Enable transmit end interrupt in rsci_stop_tx() Diogo Ivo
2026-11-13 18:26 ` [PATCH v4 4/7] serial: sh-sci: Do not kick TX from sci_er_interrupt() on RSCI Diogo Ivo
2026-11-13 18:26 ` [PATCH v4 5/7] serial: sh-sci: Skip TDxE clear when hardware clears it automatically Diogo Ivo
2026-11-13 18:26 ` [PATCH v4 6/7] serial: sh-sci: Toggle TE when restoring SCSCR in console write on SCI Diogo Ivo
2026-11-13 18:26 ` Diogo Ivo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261113-g2ul_sci-v4-7-6815e41d90c5@renesas.com \
    --to=diogo.ivo.sx@renesas.com \
    --cc=au.dang.jx@renesas.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=thierry.bultel.yh@bp.renesas.com \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®