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

Configure Feed

Select the types of activity you want to include in your feed.

serial: 8250: make saved LSR larger

DW flags address received as BIT(8) in LSR. In order to not lose that
on read, enlarge lsr_saved_flags to u16.

Adjust lsr/status variables and related call chains to use u16.
Technically, some of these type conversion would not be needed but it
doesn't hurt to be consistent.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220624204210.11112-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
f8ba5680 34619de1

+20 -20
+2 -2
drivers/tty/serial/8250/8250.h
··· 133 133 * 134 134 * Returns LSR value or'ed with the preserved flags (if any). 135 135 */ 136 - static inline unsigned int serial_lsr_in(struct uart_8250_port *up) 136 + static inline u16 serial_lsr_in(struct uart_8250_port *up) 137 137 { 138 - unsigned int lsr = up->lsr_saved_flags; 138 + u16 lsr = up->lsr_saved_flags; 139 139 140 140 lsr |= serial_in(up, UART_LSR); 141 141 up->lsr_saved_flags = lsr & LSR_SAVE_FLAGS;
+1 -1
drivers/tty/serial/8250/8250_exar.c
··· 195 195 196 196 static void exar_shutdown(struct uart_port *port) 197 197 { 198 - unsigned char lsr; 199 198 bool tx_complete = false; 200 199 struct uart_8250_port *up = up_to_u8250p(port); 201 200 struct circ_buf *xmit = &port->state->xmit; 202 201 int i = 0; 202 + u16 lsr; 203 203 204 204 do { 205 205 lsr = serial_in(up, UART_LSR);
+1 -1
drivers/tty/serial/8250/8250_fsl.c
··· 25 25 26 26 int fsl8250_handle_irq(struct uart_port *port) 27 27 { 28 - unsigned char lsr, orig_lsr; 29 28 unsigned long flags; 29 + u16 lsr, orig_lsr; 30 30 unsigned int iir; 31 31 struct uart_8250_port *up = up_to_u8250p(port); 32 32
+1 -1
drivers/tty/serial/8250/8250_ingenic.c
··· 54 54 55 55 static void ingenic_early_console_putc(struct uart_port *port, unsigned char c) 56 56 { 57 - uint8_t lsr; 57 + u16 lsr; 58 58 59 59 do { 60 60 lsr = early_in(port, UART_LSR);
+3 -4
drivers/tty/serial/8250/8250_omap.c
··· 1115 1115 return omap_8250_rx_dma(up); 1116 1116 } 1117 1117 1118 - static unsigned char omap_8250_handle_rx_dma(struct uart_8250_port *up, 1119 - u8 iir, unsigned char status) 1118 + static u16 omap_8250_handle_rx_dma(struct uart_8250_port *up, u8 iir, u16 status) 1120 1119 { 1121 1120 if ((status & (UART_LSR_DR | UART_LSR_BI)) && 1122 1121 (iir & UART_IIR_RDI)) { ··· 1129 1130 } 1130 1131 1131 1132 static void am654_8250_handle_rx_dma(struct uart_8250_port *up, u8 iir, 1132 - unsigned char status) 1133 + u16 status) 1133 1134 { 1134 1135 /* 1135 1136 * Queue a new transfer if FIFO has data. ··· 1163 1164 { 1164 1165 struct uart_8250_port *up = up_to_u8250p(port); 1165 1166 struct omap8250_priv *priv = up->port.private_data; 1166 - unsigned char status; 1167 + u16 status; 1167 1168 u8 iir; 1168 1169 1169 1170 serial8250_rpm_get(up);
+9 -8
drivers/tty/serial/8250/8250_port.c
··· 1502 1502 struct uart_8250_em485 *em485 = p->em485; 1503 1503 1504 1504 if (em485) { 1505 - unsigned char lsr = serial_lsr_in(p); 1505 + u16 lsr = serial_lsr_in(p); 1506 1506 u64 stop_delay = 0; 1507 1507 1508 1508 p->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS; ··· 1563 1563 1564 1564 if (serial8250_set_THRI(up)) { 1565 1565 if (up->bugs & UART_BUG_TXEN) { 1566 - unsigned char lsr = serial_lsr_in(up); 1566 + u16 lsr = serial_lsr_in(up); 1567 1567 1568 1568 if (lsr & UART_LSR_THRE) 1569 1569 serial8250_tx_chars(up); ··· 1716 1716 serial8250_rpm_put(up); 1717 1717 } 1718 1718 1719 - void serial8250_read_char(struct uart_8250_port *up, unsigned char lsr) 1719 + void serial8250_read_char(struct uart_8250_port *up, u16 lsr) 1720 1720 { 1721 1721 struct uart_port *port = &up->port; 1722 1722 unsigned char ch; ··· 1785 1785 * (such as THRE) because the LSR value might come from an already consumed 1786 1786 * character. 1787 1787 */ 1788 - unsigned char serial8250_rx_chars(struct uart_8250_port *up, unsigned char lsr) 1788 + u16 serial8250_rx_chars(struct uart_8250_port *up, u16 lsr) 1789 1789 { 1790 1790 struct uart_port *port = &up->port; 1791 1791 int max_count = 256; ··· 1905 1905 */ 1906 1906 int serial8250_handle_irq(struct uart_port *port, unsigned int iir) 1907 1907 { 1908 - unsigned char status; 1909 1908 struct uart_8250_port *up = up_to_u8250p(port); 1910 1909 bool skip_rx = false; 1911 1910 unsigned long flags; 1911 + u16 status; 1912 1912 1913 1913 if (iir & UART_IIR_NO_INT) 1914 1914 return 0; ··· 1991 1991 { 1992 1992 struct uart_8250_port *up = up_to_u8250p(port); 1993 1993 unsigned long flags; 1994 - unsigned int lsr; 1994 + u16 lsr; 1995 1995 1996 1996 serial8250_rpm_get(up); 1997 1997 ··· 2114 2114 static int serial8250_get_poll_char(struct uart_port *port) 2115 2115 { 2116 2116 struct uart_8250_port *up = up_to_u8250p(port); 2117 - unsigned char lsr; 2118 2117 int status; 2118 + u16 lsr; 2119 2119 2120 2120 serial8250_rpm_get(up); 2121 2121 ··· 2170 2170 { 2171 2171 struct uart_8250_port *up = up_to_u8250p(port); 2172 2172 unsigned long flags; 2173 - unsigned char lsr, iir; 2173 + unsigned char iir; 2174 2174 int retval; 2175 + u16 lsr; 2175 2176 2176 2177 if (!port->fifosize) 2177 2178 port->fifosize = uart_config[port->type].fifo_size;
+3 -3
include/linux/serial_8250.h
··· 119 119 * be immediately processed. 120 120 */ 121 121 #define LSR_SAVE_FLAGS UART_LSR_BRK_ERROR_BITS 122 - unsigned char lsr_saved_flags; 122 + u16 lsr_saved_flags; 123 123 #define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA 124 124 unsigned char msr_saved_flags; 125 125 ··· 170 170 unsigned int quot_frac); 171 171 extern int fsl8250_handle_irq(struct uart_port *port); 172 172 int serial8250_handle_irq(struct uart_port *port, unsigned int iir); 173 - unsigned char serial8250_rx_chars(struct uart_8250_port *up, unsigned char lsr); 174 - void serial8250_read_char(struct uart_8250_port *up, unsigned char lsr); 173 + u16 serial8250_rx_chars(struct uart_8250_port *up, u16 lsr); 174 + void serial8250_read_char(struct uart_8250_port *up, u16 lsr); 175 175 void serial8250_tx_chars(struct uart_8250_port *up); 176 176 unsigned int serial8250_modem_status(struct uart_8250_port *up); 177 177 void serial8250_init_port(struct uart_8250_port *up);