]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
serial: Replace driver usage of UPF_CONS_FLOW
authorJohn Ogness <john.ogness@linutronix.de>
Wed, 6 May 2026 12:15:57 +0000 (14:21 +0206)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 11 May 2026 14:58:38 +0000 (16:58 +0200)
Rather than using the UPF_CONS_FLOW bit of uart_port.flags to track
the user configuration of console flow control, use the newly added
uart_port.cons_flow (via its getter/setter functions).

A coccinelle script was used to perform the search/replace.

Note1: The sh-sci driver is blindly copying platform data configuration
       flags to uart_port.flags. Thus UPF_CONS_FLOW could get set for
       uart_port.flags. A follow-up commit will address this.

Note2: The samsung_tty driver is using UPF_CONS_FLOW as a platform data
       configuration flag. However, the driver explicitly checks for
       this configuration flag and thus setting UPF_CONS_FLOW in
       uart_port.flags is avoided.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Link: https://patch.msgid.link/20260506121606.5805-3-john.ogness@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_port.c
drivers/tty/serial/bcm63xx_uart.c
drivers/tty/serial/omap-serial.c
drivers/tty/serial/pch_uart.c
drivers/tty/serial/pxa.c
drivers/tty/serial/samsung_tty.c
drivers/tty/serial/serial_txx9.c
drivers/tty/serial/sunsu.c

index 02e6cdefdbac933d00a2d400b25a24a93894ea93..e4e6a53ebea39c376162690219347c1d2729c349 100644 (file)
@@ -1990,7 +1990,7 @@ static void wait_for_xmitr(struct uart_8250_port *up, int bits)
        wait_for_lsr(up, bits);
 
        /* Wait up to 1s for flow control if necessary */
-       if (up->port.flags & UPF_CONS_FLOW) {
+       if (uart_cons_flow_enabled(&up->port)) {
                for (tmout = 1000000; tmout; tmout--) {
                        unsigned int msr = serial_in(up, UART_MSR);
                        up->msr_saved_flags |= msr & MSR_SAVE_FLAGS;
@@ -3353,7 +3353,7 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,
                 * it regardless of the CTS state. Therefore, only use fifo
                 * if we don't use control flow.
                 */
-               !(up->port.flags & UPF_CONS_FLOW);
+               !uart_cons_flow_enabled(&up->port);
 
        if (likely(use_fifo))
                serial8250_console_fifo_write(up, s, count);
index 51df9d2d8bfc5470b21762e920587b8a5b17ac68..544695cb184c3301592ecd536215fcac117f4182 100644 (file)
@@ -675,7 +675,7 @@ static void wait_for_xmitr(struct uart_port *port)
        }
 
        /* Wait up to 1s for flow control if necessary */
-       if (port->flags & UPF_CONS_FLOW) {
+       if (uart_cons_flow_enabled(port)) {
                tmout = 1000000;
                while (--tmout) {
                        unsigned int val;
index 0b85f47ff19e041f9e10202a07bd9f9e640ce0af..a689d190940cf65ed3eb1450b34bb40a4931cde8 100644 (file)
@@ -1092,7 +1092,7 @@ static void __maybe_unused wait_for_xmitr(struct uart_omap_port *up)
        } while (!uart_lsr_tx_empty(status));
 
        /* Wait up to 1s for flow control if necessary */
-       if (up->port.flags & UPF_CONS_FLOW) {
+       if (uart_cons_flow_enabled(&up->port)) {
                for (tmout = 1000000; tmout; tmout--) {
                        unsigned int msr = serial_in(up, UART_MSR);
 
index 6729d8e83c3c542f513262d5772af5bed5dae134..2f72cd62e2488f9d5fc9f1033a42fa95451917d3 100644 (file)
@@ -1444,7 +1444,7 @@ static void wait_for_xmitr(struct eg20t_port *up, int bits)
        }
 
        /* Wait up to 1s for flow control if necessary */
-       if (up->port.flags & UPF_CONS_FLOW) {
+       if (uart_cons_flow_enabled(&up->port)) {
                unsigned int tmout;
                for (tmout = 1000000; tmout; tmout--) {
                        unsigned int msr = ioread8(up->membase + UART_MSR);
index fea0255067ccd0c3cba1836bf6f6d6fd171a91ff..10fc8990579b5c2937b77f5b53b983148f87db0c 100644 (file)
@@ -573,7 +573,7 @@ static void wait_for_xmitr(struct uart_pxa_port *up)
        } while (!uart_lsr_tx_empty(status));
 
        /* Wait up to 1s for flow control if necessary */
-       if (up->port.flags & UPF_CONS_FLOW) {
+       if (uart_cons_flow_enabled(&up->port)) {
                tmout = 1000000;
                while (--tmout &&
                       ((serial_in(up, UART_MSR) & UART_MSR_CTS) == 0))
index e27806bf2cf3e571599444373b9ca07e9d61f0ad..2f94fc798cffb6ed83052cc7aba120b0970e6fbd 100644 (file)
@@ -319,7 +319,7 @@ static void s3c24xx_serial_stop_tx(struct uart_port *port)
        ourport->tx_enabled = 0;
        ourport->tx_in_progress = 0;
 
-       if (port->flags & UPF_CONS_FLOW)
+       if (uart_cons_flow_enabled(port))
                s3c24xx_serial_rx_enable(port);
 
        ourport->tx_mode = 0;
@@ -493,7 +493,7 @@ static void s3c24xx_serial_start_tx(struct uart_port *port)
        struct tty_port *tport = &port->state->port;
 
        if (!ourport->tx_enabled) {
-               if (port->flags & UPF_CONS_FLOW)
+               if (uart_cons_flow_enabled(port))
                        s3c24xx_serial_rx_disable(port);
 
                ourport->tx_enabled = 1;
@@ -781,7 +781,7 @@ static void s3c24xx_serial_rx_drain_fifo(struct s3c24xx_uart_port *ourport)
                uerstat = rd_regl(port, S3C2410_UERSTAT);
                ch = rd_reg(port, S3C2410_URXH);
 
-               if (port->flags & UPF_CONS_FLOW) {
+               if (uart_cons_flow_enabled(port)) {
                        bool txe = s3c24xx_serial_txempty_nofifo(port);
 
                        if (ourport->rx_enabled) {
@@ -1830,7 +1830,7 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
 
        if (cfg->uart_flags & UPF_CONS_FLOW) {
                dev_dbg(port->dev, "enabling flow control\n");
-               port->flags |= UPF_CONS_FLOW;
+               uart_set_cons_flow_enabled(port, true);
        }
 
        /* sort our the physical and virtual addresses for each UART */
index 436a559234dfe7539da2b4793578af642ce08f82..4ae9a45c8e3a32aa2d2a936236031075a8ae107f 100644 (file)
@@ -422,7 +422,7 @@ static void wait_for_xmitr(struct uart_port *up)
                udelay(1);
 
        /* Wait up to 1s for flow control if necessary */
-       if (up->flags & UPF_CONS_FLOW) {
+       if (uart_cons_flow_enabled(up)) {
                tmout = 1000000;
                while (--tmout &&
                       (sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS))
@@ -857,7 +857,7 @@ serial_txx9_console_write(struct console *co, const char *s, unsigned int count)
         *      Disable flow-control if enabled (and unnecessary)
         */
        flcr = sio_in(up, TXX9_SIFLCR);
-       if (!(up->flags & UPF_CONS_FLOW) && (flcr & TXX9_SIFLCR_TES))
+       if (!uart_cons_flow_enabled(up) && (flcr & TXX9_SIFLCR_TES))
                sio_out(up, TXX9_SIFLCR, flcr & ~TXX9_SIFLCR_TES);
 
        uart_console_write(up, s, count, serial_txx9_console_putchar);
index 6505a1930da9ad4d651da25c6c106bb2db5b5c9c..4ff3e5c41dab956a6268d97090c83cd841d3c9b4 100644 (file)
@@ -1245,7 +1245,7 @@ static void wait_for_xmitr(struct uart_sunsu_port *up)
        } while (!uart_lsr_tx_empty(status));
 
        /* Wait up to 1s for flow control if necessary */
-       if (up->port.flags & UPF_CONS_FLOW) {
+       if (uart_cons_flow_enabled(&up->port)) {
                tmout = 1000000;
                while (--tmout &&
                       ((serial_in(up, UART_MSR) & UART_MSR_CTS) == 0))