serial: 8250: Use defined IER bits
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 25 Nov 2022 13:05:04 +0000 (15:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Jan 2023 14:01:19 +0000 (15:01 +0100)
Instead of literal 0x0f, add a define for enabling all IER bits the
8250 driver is interested in.

Don't make the define for combined flags part of UAPI.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20221125130509.8482-2-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_port.c
include/linux/serial.h

index beba8f38b3dcb40d22de1edb9a83316b1a7ae3e0..8676f8b7f2e336daed2ffa08c1c2ff88428f7886 100644 (file)
@@ -1236,14 +1236,14 @@ static void autoconfig(struct uart_8250_port *up)
                 * Mask out IER[7:4] bits for test as some UARTs (e.g. TL
                 * 16C754B) allow only to modify them if an EFR bit is set.
                 */
-               scratch2 = serial_in(up, UART_IER) & 0x0f;
-               serial_out(up, UART_IER, 0x0F);
+               scratch2 = serial_in(up, UART_IER) & UART_IER_ALL_INTR;
+               serial_out(up, UART_IER, UART_IER_ALL_INTR);
 #ifdef __i386__
                outb(0, 0x080);
 #endif
-               scratch3 = serial_in(up, UART_IER) & 0x0f;
+               scratch3 = serial_in(up, UART_IER) & UART_IER_ALL_INTR;
                serial_out(up, UART_IER, scratch);
-               if (scratch2 != 0 || scratch3 != 0x0F) {
+               if (scratch2 != 0 || scratch3 != UART_IER_ALL_INTR) {
                        /*
                         * We failed; there's nothing here
                         */
@@ -1394,7 +1394,7 @@ static void autoconfig_irq(struct uart_8250_port *up)
                serial8250_out_MCR(up,
                        UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2);
        }
-       serial_out(up, UART_IER, 0x0f); /* enable all intrs */
+       serial_out(up, UART_IER, UART_IER_ALL_INTR);
        serial_in(up, UART_LSR);
        serial_in(up, UART_RX);
        serial_in(up, UART_IIR);
index 3d6fe3ef92cf3a2a051ca8c6f7bcd97303a77940..ad6e1c37e2d59e5439e14a1b2cb54d121aefe13f 100644 (file)
 #include <uapi/linux/serial.h>
 #include <uapi/linux/serial_reg.h>
 
+#define UART_IER_ALL_INTR      (UART_IER_MSI | \
+                                UART_IER_RLSI | \
+                                UART_IER_THRI | \
+                                UART_IER_RDI)
+
 /* Helper for dealing with UART_LCR_WLEN* defines */
 #define UART_LCR_WLEN(x)       ((x) - 5)