Skip to content

serial: Some yak shaving

Uwe Kleine-König linux-doc linux-serial lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6serial: txx9: Drop noop probe function and dangerous remove callbackdrivers/tty/serial/serial_txx9.c+3 -520 replies
2/6serial: txx9: Drop usage of uart_match_port()drivers/tty/serial/serial_txx9.c+1 -14 replies
3/6serial: 8250: Make uart_match_port() a 8250 specific functionDocumentation/driver-api/serial/driver.rst drivers/tty/serial/8250/8250_core.c drivers/tty/serial/serial_core.c +1 more+27 -312 replies
4/6serial: 8250: Fix corner case for port matchingdrivers/tty/serial/8250/8250.h drivers/tty/serial/8250/8250_hub6.c drivers/tty/serial/8250/8250_platform.c +2 more+15 -110 replies
5/6serial: 8250: hub6: Add cleanup codedrivers/tty/serial/8250/8250.h drivers/tty/serial/8250/8250_hub6.c drivers/tty/serial/8250/8250_platform.c+11 -10 replies
6/6serial: 8250: pnp: Annotate init and exit functions for conditional discardingdrivers/tty/serial/8250/8250_pnp.c+2 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH v1 0/6] serial: Some yak shaving

Hello,

after the discussion with Hugo about hub6_match_port()[1] I looked into implementing my suggestion. Hugo had a doubt there:

Quoted 3 lines

I am not sure to fully understand what you suggest. Copying the same function code to two drivers seems like a waisted opportunity for code reuse?

I don't think this is a wasted opportunity, as uart_match_port() only becomes a single comparison for the txx9 driver. Also having 8250 specific parts in serial_core is a layer violation.

I was unable to unsee some of the stuff I discovered, so there are a few more patches in this series now ...

The first txx9 patch is a preparation for the second to establish the assertion ".iotype is always UPIO_PORT". It's also a fix that is correct on its own (assuming I understood the driver model misuse in this driver correctly).

After that uart_match_port() is only used by the 8250 driver code and thus can be moved to there in the third patch, simplifying the dependencies a bit which enables fixing the breakage I found in the fourth patch.

The two remaining patches are cleanups I found while working on that driver.

Note this is only compile tested as I don't have a machine with any of the three affected serial hardwares.

Best regards
Uwe

[1] https://lore.kernel.org/linux-serial/amn8Hb2dbv_Sah_Y@monoceros/

Uwe Kleine-König (6):
serial: txx9: Drop noop probe function and dangerous remove callback
serial: txx9: Drop usage of uart_match_port()
serial: 8250: Make uart_match_port() a 8250 specific function
serial: 8250: Fix corner case for port matching
serial: 8250: hub6: Add cleanup code
serial: 8250: pnp: Annotate init and exit functions for conditional
discarding

 Documentation/driver-api/serial/driver.rst |  2 +-
 drivers/tty/serial/8250/8250.h             | 10 +++-
 drivers/tty/serial/8250/8250_core.c        | 27 +++++++++-
 drivers/tty/serial/8250/8250_hub6.c        | 11 ++---
 drivers/tty/serial/8250/8250_platform.c    |  9 +++-
 drivers/tty/serial/8250/8250_pnp.c         |  4 +-
 drivers/tty/serial/8250/Kconfig            |  4 +-
 drivers/tty/serial/8250/Makefile           |  2 +-
 drivers/tty/serial/serial_core.c           | 27 ----------
 drivers/tty/serial/serial_txx9.c           | 57 ++--------------------
 include/linux/serial_core.h                |  2 -
 11 files changed, 58 insertions(+), 97 deletions(-)

base-commit: 95d6a9ccef99117115e41e9adb271243bd5e985b

Signature · 1 line
2.55.0.11.g153666a7d9bb