[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241216171244.12783-1-john.ogness@linutronix.de>
Date: Mon, 16 Dec 2024 18:18:40 +0106
From: John Ogness <john.ogness@...utronix.de>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Jiri Slaby <jirislaby@...nel.org>,
Esben Haabendal <esben@...nix.com>,
linux-serial@...r.kernel.org,
linux-kernel@...r.kernel.org,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Arnd Bergmann <arnd@...db.de>,
Rengarajan S <rengarajan.s@...rochip.com>,
Bart Van Assche <bvanassche@....org>,
Niklas Schnelle <schnelle@...ux.ibm.com>,
Serge Semin <fancer.lancer@...il.com>,
Lino Sanfilippo <l.sanfilippo@...bus.com>,
Peter Collingbourne <pcc@...gle.com>,
Kevin Hilman <khilman@...libre.com>,
Markus Schneider-Pargmann <msp@...libre.com>,
Udit Kumar <u-kumar1@...com>,
Griffin Kroah-Hartman <griffin@...ah.com>,
Petr Mladek <pmladek@...e.com>,
Tony Lindgren <tony@...mide.com>,
Guenter Roeck <linux@...ck-us.net>,
Jeff Johnson <quic_jjohnson@...cinc.com>
Subject: [PATCH tty-next v1 0/4] serial: 8250: Fix LSR masking
Hi,
During the review process of my 8250 nbcon series, Petr Mladek
mentioned [0] that it was odd that the console driver clears
UART_LSR_DR from @read_status_mask but never sets it.
Since there is literally zero documentation on the
driver-specific fields @read_status_mask and
@ignore_status_mask, I embarked on a journey to figure out what
these fields are for and how they are supposed to be used.
My quest took me back to Linux 1.1.60, where there was the
first significant change in the purpose of these fields. That
purpose was then reverted in Linux 2.1.8, but some of the
pieces were forgotten. Over the years it seems no one really
noticed as these bogus pieces hung around and were even
expanded upon.
And yes, I uncovered a subtle bug that has been around longer
than git.
This series cleans up the usage for the @read_status_mask field
and adds some documentation so that future developers will know
what this field is actually for. And the series also fixes the
subtle bug.
Note that since the 8250 was the original serial driver and was
copy/pasted as a basis for many later serial drivers, the issue
may exist in other drivers as well.
[0] https://lore.kernel.org/lkml/ZyuOX4VVbfAFhMfV@pathway.suse.cz
John Ogness (4):
serial: 8250: Use @ier bits to determine if Rx is stopped
serial: 8250: Do not set UART_LSR_THRE in @read_status_mask
serial: 8250: Never adjust UART_LSR_DR in @read_status_mask
serial: 8250: Explain the role of @read_status_mask
drivers/tty/serial/8250/8250_core.c | 1 -
drivers/tty/serial/8250/8250_omap.c | 9 +++++++--
drivers/tty/serial/8250/8250_port.c | 11 ++++++++---
3 files changed, 15 insertions(+), 6 deletions(-)
base-commit: 30691a59c85c48575b04e849f675660fd8060cad
--
2.39.5
Powered by blists - more mailing lists