[PATCH v11 3/5] tty: serial: sh-sci: Use port ops callbacks
From: Prabhakar
Date: Mon Jun 16 2025 - 17:40:13 EST
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
Replace direct calls to internal helpers such as sci_stop_tx(),
sci_start_tx(), sci_stop_rx(), sci_set_mctrl(), sci_enable_ms(), and
sci_request_port() with their corresponding port ops callbacks.
This change improves consistency and abstraction across the driver and
prepares the codebase for adding support for the RSCI driver on the
Renesas RZ/T2H SoC, which heavily reuses the existing SCI driver.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
---
drivers/tty/serial/sh-sci.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 1c356544a832..24773e265fbe 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -880,7 +880,7 @@ static void sci_transmit_chars(struct uart_port *port)
sci_serial_out(port, SCSCR, ctrl);
}
- sci_stop_tx(port);
+ s->port.ops->stop_tx(port);
}
}
@@ -1497,7 +1497,7 @@ static void sci_dma_tx_work_fn(struct work_struct *work)
switch_to_pio:
uart_port_lock_irqsave(port, &flags);
s->chan_tx = NULL;
- sci_start_tx(port);
+ s->port.ops->start_tx(port);
uart_port_unlock_irqrestore(port, flags);
return;
}
@@ -2289,8 +2289,8 @@ void sci_shutdown(struct uart_port *port)
mctrl_gpio_disable_ms_sync(to_sci_port(port)->gpios);
uart_port_lock_irqsave(port, &flags);
- sci_stop_rx(port);
- sci_stop_tx(port);
+ s->port.ops->stop_rx(port);
+ s->port.ops->stop_tx(port);
s->ops->shutdown_complete(port);
uart_port_unlock_irqrestore(port, flags);
@@ -2684,7 +2684,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
}
if (port->flags & UPF_HARD_FLOW) {
/* Refresh (Auto) RTS */
- sci_set_mctrl(port, port->mctrl);
+ s->port.ops->set_mctrl(port, port->mctrl);
}
/*
@@ -2721,7 +2721,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
sci_port_disable(s);
if (UART_ENABLE_MS(port, termios->c_cflag))
- sci_enable_ms(port);
+ s->port.ops->enable_ms(port);
}
void sci_pm(struct uart_port *port, unsigned int state,
@@ -2827,7 +2827,7 @@ void sci_config_port(struct uart_port *port, int flags)
struct sci_port *sport = to_sci_port(port);
port->type = sport->cfg->type;
- sci_request_port(port);
+ sport->port.ops->request_port(port);
}
}
--
2.49.0