serial: Make uart_handle_cts_change() status param bool active
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 17 Jan 2023 09:03:55 +0000 (11:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Jan 2023 15:04:35 +0000 (16:04 +0100)
Convert uart_handle_cts_change() to bool which is more appropriate
than unsigned int.

Rename status to active to better describe what the parameter means.
While at it, make the comment about the active parameter easier to
parse.

Cleanup callsites from operations that are not necessary with bool.

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230117090358.4796-10-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/imx.c
drivers/tty/serial/max3100.c
drivers/tty/serial/max310x.c
drivers/tty/serial/serial_core.c
include/linux/serial_core.h

index f2b43fb497ff0c57a62a7387216a8c240ed4abba..ae75135dccb8790057c96cfc96ae6609e58531ad 100644 (file)
@@ -773,7 +773,7 @@ static irqreturn_t __imx_uart_rtsint(int irq, void *dev_id)
 
        imx_uart_writel(sport, USR1_RTSD, USR1);
        usr1 = imx_uart_readl(sport, USR1) & USR1_RTSS;
-       uart_handle_cts_change(&sport->port, !!usr1);
+       uart_handle_cts_change(&sport->port, usr1);
        wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
 
        return IRQ_HANDLED;
index bb74f23251fe43973a77409dddf1c949178272ed..86dcbff8faa3edc34012f5d94867ba53b0abe658 100644 (file)
@@ -247,7 +247,7 @@ static int max3100_handlerx(struct max3100_port *s, u16 rx)
        cts = (rx & MAX3100_CTS) > 0;
        if (s->cts != cts) {
                s->cts = cts;
-               uart_handle_cts_change(&s->port, cts ? TIOCM_CTS : 0);
+               uart_handle_cts_change(&s->port, cts);
        }
 
        return ret;
index 4eb24e3407f803970bf0aa85cdf6c49a0438091f..e9cacfe7e03265be6e0908e2bb4a27bc19b9701a 100644 (file)
@@ -819,8 +819,7 @@ static irqreturn_t max310x_port_irq(struct max310x_port *s, int portno)
 
                if (ists & MAX310X_IRQ_CTS_BIT) {
                        lsr = max310x_port_read(port, MAX310X_LSR_IRQSTS_REG);
-                       uart_handle_cts_change(port,
-                                              !!(lsr & MAX310X_LSR_CTS_BIT));
+                       uart_handle_cts_change(port, lsr & MAX310X_LSR_CTS_BIT);
                }
                if (rxlen)
                        max310x_handle_rx(port, rxlen);
index 7319a6f55013826f2a0b18a7dd2b6ae2ec99aa64..371440faa14c0c1cd4b45008c0a69b3ff737749f 100644 (file)
@@ -3287,11 +3287,11 @@ EXPORT_SYMBOL_GPL(uart_handle_dcd_change);
 /**
  * uart_handle_cts_change - handle a change of clear-to-send state
  * @uport: uart_port structure for the open port
- * @status: new clear to send status, nonzero if active
+ * @active: new clear-to-send status
  *
  * Caller must hold uport->lock.
  */
-void uart_handle_cts_change(struct uart_port *uport, unsigned int status)
+void uart_handle_cts_change(struct uart_port *uport, bool active)
 {
        lockdep_assert_held_once(&uport->lock);
 
@@ -3299,13 +3299,13 @@ void uart_handle_cts_change(struct uart_port *uport, unsigned int status)
 
        if (uart_softcts_mode(uport)) {
                if (uport->hw_stopped) {
-                       if (status) {
+                       if (active) {
                                uport->hw_stopped = 0;
                                uport->ops->start_tx(uport);
                                uart_write_wakeup(uport);
                        }
                } else {
-                       if (!status) {
+                       if (!active) {
                                uport->hw_stopped = 1;
                                uport->ops->stop_tx(uport);
                        }
index 8c4187c4884aa638e93ae3ef9ef3c60d33cbfae9..9e3e5e0d11b227bdfa99ea290b88512cd58c9612 100644 (file)
@@ -898,8 +898,7 @@ static inline bool uart_softcts_mode(struct uart_port *uport)
  */
 
 extern void uart_handle_dcd_change(struct uart_port *uport, bool active);
-extern void uart_handle_cts_change(struct uart_port *uport,
-               unsigned int status);
+extern void uart_handle_cts_change(struct uart_port *uport, bool active);
 
 extern void uart_insert_char(struct uart_port *port, unsigned int status,
                 unsigned int overrun, unsigned int ch, unsigned int flag);