public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH tty-next v1 0/4] serial: 8250: Fix LSR masking
@ 2024-12-16 17:12 John Ogness
  2024-12-16 17:12 ` [PATCH tty-next v1 1/4] serial: 8250: Use @ier bits to determine if Rx is stopped John Ogness
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: John Ogness @ 2024-12-16 17:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jiri Slaby, Esben Haabendal, linux-serial, linux-kernel,
	Andy Shevchenko, Arnd Bergmann, Rengarajan S, Bart Van Assche,
	Niklas Schnelle, Serge Semin, Lino Sanfilippo,
	Peter Collingbourne, Kevin Hilman, Markus Schneider-Pargmann,
	Udit Kumar, Griffin Kroah-Hartman, Petr Mladek, Tony Lindgren,
	Guenter Roeck, Jeff Johnson

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-12-24 15:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-16 17:12 [PATCH tty-next v1 0/4] serial: 8250: Fix LSR masking John Ogness
2024-12-16 17:12 ` [PATCH tty-next v1 1/4] serial: 8250: Use @ier bits to determine if Rx is stopped John Ogness
2024-12-16 20:31   ` Andy Shevchenko
2024-12-16 20:43     ` Andy Shevchenko
2024-12-20 11:50       ` John Ogness
2024-12-24 15:59         ` Andy Shevchenko
2024-12-16 17:12 ` [PATCH tty-next v1 2/4] serial: 8250: Do not set UART_LSR_THRE in @read_status_mask John Ogness
2024-12-16 20:36   ` Andy Shevchenko
2024-12-16 17:12 ` [PATCH tty-next v1 3/4] serial: 8250: Never adjust UART_LSR_DR " John Ogness
2024-12-16 17:12 ` [PATCH tty-next v1 4/4] serial: 8250: Explain the role of @read_status_mask John Ogness

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox