Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: 8250: Use defined IER bits

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>

authored by

Ilpo Järvinen and committed by
Greg Kroah-Hartman
ef460db2 98a59cd2

+10 -5
+5 -5
drivers/tty/serial/8250/8250_port.c
··· 1236 1236 * Mask out IER[7:4] bits for test as some UARTs (e.g. TL 1237 1237 * 16C754B) allow only to modify them if an EFR bit is set. 1238 1238 */ 1239 - scratch2 = serial_in(up, UART_IER) & 0x0f; 1240 - serial_out(up, UART_IER, 0x0F); 1239 + scratch2 = serial_in(up, UART_IER) & UART_IER_ALL_INTR; 1240 + serial_out(up, UART_IER, UART_IER_ALL_INTR); 1241 1241 #ifdef __i386__ 1242 1242 outb(0, 0x080); 1243 1243 #endif 1244 - scratch3 = serial_in(up, UART_IER) & 0x0f; 1244 + scratch3 = serial_in(up, UART_IER) & UART_IER_ALL_INTR; 1245 1245 serial_out(up, UART_IER, scratch); 1246 - if (scratch2 != 0 || scratch3 != 0x0F) { 1246 + if (scratch2 != 0 || scratch3 != UART_IER_ALL_INTR) { 1247 1247 /* 1248 1248 * We failed; there's nothing here 1249 1249 */ ··· 1394 1394 serial8250_out_MCR(up, 1395 1395 UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2); 1396 1396 } 1397 - serial_out(up, UART_IER, 0x0f); /* enable all intrs */ 1397 + serial_out(up, UART_IER, UART_IER_ALL_INTR); 1398 1398 serial_in(up, UART_LSR); 1399 1399 serial_in(up, UART_RX); 1400 1400 serial_in(up, UART_IIR);
+5
include/linux/serial.h
··· 12 12 #include <uapi/linux/serial.h> 13 13 #include <uapi/linux/serial_reg.h> 14 14 15 + #define UART_IER_ALL_INTR (UART_IER_MSI | \ 16 + UART_IER_RLSI | \ 17 + UART_IER_THRI | \ 18 + UART_IER_RDI) 19 + 15 20 /* Helper for dealing with UART_LCR_WLEN* defines */ 16 21 #define UART_LCR_WLEN(x) ((x) - 5) 17 22