Skip to content

serial: 8250: make port operations work on struct uart_8250_port

Jiri Slaby (SUSE) linux-arm-kernel linux-aspeed linux-hardening linux-mediatek linux-mips linux-parisc linux-serial linux-tegra netdev sashiko-reviews stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest6 patches 12 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6serial: 8250: drop err label from serial8250_register_8250_port()drivers/tty/serial/8250/8250_core.c+52 -460 replies
2/6serial: 8250_exar: remove useless void * castsdrivers/tty/serial/8250/8250_exar.c+2 -20 replies
3/6serial: 8250_exar: store the GPIO platform device in struct exar8250drivers/tty/serial/8250/8250_exar.c+18 -180 replies
4/6serial: 8250_lpss: do not touch uninitialized line in ehl_serial_exit()drivers/tty/serial/8250/8250_lpss.c+4 -31 reply
5/6serial: 8250_omap: set priv->line before enabling the IRQdrivers/tty/serial/8250/8250_omap.c+3 -00 replies
6/6serial: 8250: make port operations work on struct uart_8250_portdrivers/ptp/ptp_ocp.c drivers/tty/serial/8250/8250_acorn.c drivers/tty/serial/8250/8250_airoha.c +35 more+349 -40711 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH v2 0/6] serial: 8250: make port operations work on struct uart_8250_port

Hi,

the 8250 port operations work on line numbers. serial8250_register_8250_port() returns a line, and drivers pass it back to serial8250_unregister_port(), serial8250_suspend_port() and serial8250_resume_port(). Many drivers also convert it back to the port using serial8250_get_port() whenever they need the port itself.

The last patch switches this interface to struct uart_8250_port. serial8250_register_8250_port() now returns the port (or an ERR_PTR()), and the other operations take it. All users are converted, and serial8250_get_port() is no longer exported.

The first patch is a preparatory cleanup. It splits serial8250_register_8250_port() into a helper, so that the function no longer mixes guard() with goto-based error handling -- Sashiko.

The second patch is a trivial exar cleanup.

While doing the conversion, we (me, Claude and Sashiko) found three bugs in how drivers handle a line that is not set (yet). Patches 3-5 fix them separately, so that they can go to stable:

* 8250_exar: pci_xr17v35x_exit() looks up the GPIO platform device via port 0, which need not exist when its registration failed. The GPIO device is now stored in struct exar8250.
* 8250_lpss: the probe error path calls ehl_serial_exit(), which clears the dma pointer of serial8250_ports[0] (usually the console) when no port was registered.
* 8250_omap: the IRQ handler can run before probe stores priv->line, and then it uses serial8250_get_port(-ENODEV).

The conversion also fixes two latent issues: CIR ports (registration used to return 0, so callers operated on ttyS0) and 8250_acorn (a port on line 0 was never unregistered).

[v2]
* new patch 1: drop the err label from serial8250_register_8250_port()
* new patches 2-3: exar cleanup and fix of the GPIO device lookup (reported by Sashiko)
* 8250_lpss: no declaration in the middle of a function (Ilpo)
* conversion: include err.h (Ilpo)

Link to v1: https://lore.kernel.org/all/ef47d676a44346e058f29a00c8701484db722831.1791524724.git.jirislaby@kernel.org/

Jiri Slaby (SUSE) (6):
serial: 8250: drop err label from serial8250_register_8250_port()
serial: 8250_exar: remove useless void * casts
serial: 8250_exar: store the GPIO platform device in struct exar8250
serial: 8250_lpss: do not touch uninitialized line in
ehl_serial_exit()
serial: 8250_omap: set priv->line before enabling the IRQ
serial: 8250: make port operations work on struct uart_8250_port

 drivers/ptp/ptp_ocp.c                       |  36 +++---
 drivers/tty/serial/8250/8250_acorn.c        |   5 +-
 drivers/tty/serial/8250/8250_airoha.c       |  23 ++--
 drivers/tty/serial/8250/8250_aspeed_vuart.c |  13 +-
 drivers/tty/serial/8250/8250_bcm2835aux.c   |  20 +--
 drivers/tty/serial/8250/8250_bcm7271.c      |  33 +++--
 drivers/tty/serial/8250/8250_core.c         | 128 ++++++++++----------
 drivers/tty/serial/8250/8250_dfl.c          |  22 ++--
 drivers/tty/serial/8250/8250_dw.c           |  13 +-
 drivers/tty/serial/8250/8250_dwlib.h        |   2 +-
 drivers/tty/serial/8250/8250_em.c           |  26 ++--
 drivers/tty/serial/8250/8250_exar.c         |  59 +++++----
 drivers/tty/serial/8250/8250_fsl.c          |  24 ++--
 drivers/tty/serial/8250/8250_hp300.c        |  27 ++---
 drivers/tty/serial/8250/8250_ingenic.c      |  11 +-
 drivers/tty/serial/8250/8250_ioc3.c         |  26 ++--
 drivers/tty/serial/8250/8250_keba.c         |  13 +-
 drivers/tty/serial/8250/8250_loongson.c     |  20 +--
 drivers/tty/serial/8250/8250_lpc18xx.c      |  11 +-
 drivers/tty/serial/8250/8250_lpss.c         |  17 +--
 drivers/tty/serial/8250/8250_men_mcb.c      |  14 +--
 drivers/tty/serial/8250/8250_mid.c          |  13 +-
 drivers/tty/serial/8250/8250_mtk.c          |  19 +--
 drivers/tty/serial/8250/8250_mxpcie.c       |  13 +-
 drivers/tty/serial/8250/8250_ni.c           |  12 +-
 drivers/tty/serial/8250/8250_of.c           |  25 ++--
 drivers/tty/serial/8250/8250_omap.c         |  41 +++----
 drivers/tty/serial/8250/8250_parisc.c       |  14 +--
 drivers/tty/serial/8250/8250_pci.c          |  21 ++--
 drivers/tty/serial/8250/8250_pci1xxxx.c     |  41 +++----
 drivers/tty/serial/8250/8250_pericom.c      |  15 +--
 drivers/tty/serial/8250/8250_platform.c     |  23 ++--
 drivers/tty/serial/8250/8250_pnp.c          |  21 ++--
 drivers/tty/serial/8250/8250_pxa.c          |  17 +--
 drivers/tty/serial/8250/8250_tegra.c        |  20 +--
 drivers/tty/serial/8250/8250_uniphier.c     |  21 ++--
 drivers/tty/serial/8250/serial_cs.c         |  15 ++-
 include/linux/serial_8250.h                 |   8 +-
 38 files changed, 417 insertions(+), 465 deletions(-)
Signature · 1 line
2.56.0