Not all LSR register flags are preserved across reads. Therefore, LSR readers must store the non-preserved bits into lsr_save_flags. This fix was initially mixed into feature commit f6f586102add ("serial: 8250: Handle UART without interrupt on TEMT using em485"). However, that feature change had a flaw and it was reverted to make room for simpler approach providing the same feature. The embedded fix got reverted with the feature change. Re-add the lsr_save_flags fix and properly mark it's a fix.
Unified · Split
| @@ -1517,6 +1517,8 @@ static inline void __stop_tx(struct uart_8250_port *p) · 1516 unmodified lines | |||
| 1517 | unsigned char lsr = serial_in(p, UART_LSR); | 1517 | unsigned char lsr = serial_in(p, UART_LSR); |
| 1518 | u64 stop_delay = 0; | 1518 | u64 stop_delay = 0; |
| 1519 | 1519 | ||
| 1520 | p->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS; | ||
| 1521 | |||
| 1520 | if (!(lsr & UART_LSR_THRE)) | 1522 | if (!(lsr & UART_LSR_THRE)) |
| 1521 | return; | 1523 | return; |
| 1522 | /* | 1524 | /* |