Linux Documentation
 help / color / mirror / Atom feed
* [PATCH v3 0/7] serial: Some yak shaving
@ 2026-08-14  9:19 Uwe Kleine-König (The Capable Hub)
  2026-08-14  9:19 ` [PATCH v3 3/7] serial: 8250: Make uart_match_port() a 8250 specific function Uwe Kleine-König (The Capable Hub)
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-08-14  9:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Andy Shevchenko, Atsushi Nemoto, John Ogness, linux-kernel,
	linux-serial, Jonathan Corbet, Shuah Khan, Randy Dunlap,
	Crescent Hsieh, Fushuai Wang, Hugo Villeneuve, Karl Mehltretter,
	linux-doc, Ilpo Järvinen, Abinash Singh, Rahul Bukte,
	Kees Cook, Lukas Wunner, Gerhard Engleder, Rong Zhang,
	Binbin Zhou, Haowei Zheng, Russell King, Geert Uytterhoeven

Hello,

v2 of this series can be found at
https://lore.kernel.org/linux-serial/cover.1785832297.git.u.kleine-koenig@baylibre.com
. Changes since then:

 - Drop "serial: txx9: Simplify knowing that .iotype is always
   UPIO_PORT" as the assumption that .iotype is always UPIO_PORT proved
   to be wrong. Thanks to Atsushi Nemoto and Geert Uytterhoeven for
   finding and proving that.
 - Reworked commit log of "serial: txx9: Drop usage of
   uart_match_port()" and add a code comment to justify the comparison.
 - Fix a build issue in "serial: 8250: hub6: Add cleanup code"
 - Added tags received in v2. Andy liked the v2 series in reply to the
   cover letter. I applied his Ack to all patches but "serial: txx9:
   Drop usage of uart_match_port()" as this changed. I would expect he
   agrees to this patch, too, but I'm conservative here.
 - (trivially) rebase to yesterday's next
 - Drop Alan Cox from Cc:, fix email address for Russell King

Best regards
Uwe

Uwe Kleine-König (The Capable Hub) (7):
  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: Simplify serial8250_match_port()
  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        | 25 ++++++++-
 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           | 62 ++++------------------
 include/linux/serial_core.h                |  2 -
 11 files changed, 61 insertions(+), 97 deletions(-)


base-commit: 2697ef8943c9985c14708a6429e21812693857b2
-- 
2.55.0.11.g153666a7d9bb


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

* [PATCH v3 3/7] serial: 8250: Make uart_match_port() a 8250 specific function
  2026-08-14  9:19 [PATCH v3 0/7] serial: Some yak shaving Uwe Kleine-König (The Capable Hub)
@ 2026-08-14  9:19 ` Uwe Kleine-König (The Capable Hub)
  0 siblings, 0 replies; 2+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-08-14  9:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Jonathan Corbet, Shuah Khan, Randy Dunlap, John Ogness,
	Crescent Hsieh, Fushuai Wang, Hugo Villeneuve, Karl Mehltretter,
	linux-kernel, linux-serial, linux-doc, Geert Uytterhoeven,
	Andy Shevchenko

The 8250 driver conglomerate is the only user of uart_match_port() and
in fact it already is 8250 specific as it uses hub6_match_port() which
is defined in drivers/tty/serial/8250/8250_hub6.c unless the dummy
implementation is in use.

Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
 Documentation/driver-api/serial/driver.rst |  2 +-
 drivers/tty/serial/8250/8250_core.c        | 27 +++++++++++++++++++++-
 drivers/tty/serial/serial_core.c           | 27 ----------------------
 include/linux/serial_core.h                |  2 --
 4 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/Documentation/driver-api/serial/driver.rst b/Documentation/driver-api/serial/driver.rst
index c1db6a1a67c4..975b0ba53e98 100644
--- a/Documentation/driver-api/serial/driver.rst
+++ b/Documentation/driver-api/serial/driver.rst
@@ -70,7 +70,7 @@ Other functions
 
 .. kernel-doc:: drivers/tty/serial/serial_core.c
    :identifiers: uart_update_timeout uart_get_baud_rate uart_get_divisor
-           uart_match_port uart_write_wakeup uart_register_driver
+           uart_write_wakeup uart_register_driver
            uart_unregister_driver uart_suspend_port uart_resume_port
            uart_add_one_port uart_remove_one_port uart_console_write
            uart_parse_earlycon uart_parse_options uart_set_options
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index b875d394796f..d8199c583830 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -673,6 +673,31 @@ EXPORT_SYMBOL(serial8250_resume_port);
  */
 static DEFINE_MUTEX(serial_mutex);
 
+/**
+ * serial8250_match_port - are the two ports equivalent?
+ * @port1: first port
+ * @port2: second port
+ *
+ * This utility function can be used to determine whether two uart_port
+ * structures describe the same port.
+ */
+static bool serial8250_match_port(const struct uart_port *port1,
+				  const struct uart_port *port2)
+{
+	if (port1->iotype != port2->iotype)
+		return false;
+	else if (port1->iotype == UPIO_PORT)
+		return port1->iobase == port2->iobase;
+	else if (port1->iotype == UPIO_HUB6)
+		return hub6_match_port(port1, port2);
+	else if (uart_iotype_mmio(port1->iotype))
+		return port1->mapbase == port2->mapbase;
+	else if (port1->iotype == UPIO_BUS)
+		return true;
+	else
+		return false;
+}
+
 static struct uart_8250_port *serial8250_find_match_or_unused(const struct uart_port *port)
 {
 	int i;
@@ -681,7 +706,7 @@ static struct uart_8250_port *serial8250_find_match_or_unused(const struct uart_
 	 * First, find a port entry which matches.
 	 */
 	for (i = 0; i < nr_uarts; i++)
-		if (uart_match_port(&serial8250_ports[i].port, port))
+		if (serial8250_match_port(&serial8250_ports[i].port, port))
 			return &serial8250_ports[i];
 
 	/* try line number first if still available */
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 95774b0f1484..ee75f53979bd 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -33,7 +33,6 @@
 #include <linux/uaccess.h>
 
 #include "serial_base.h"
-#include "8250/8250.h" /* For hub6_match_port() */
 
 /*
  * This is used to lock changes in serial line configuration.
@@ -3233,32 +3232,6 @@ static void serial_core_remove_one_port(struct uart_driver *drv,
 	state->uart_port = NULL;
 }
 
-/**
- * uart_match_port - are the two ports equivalent?
- * @port1: first port
- * @port2: second port
- *
- * This utility function can be used to determine whether two uart_port
- * structures describe the same port.
- */
-bool uart_match_port(const struct uart_port *port1,
-		const struct uart_port *port2)
-{
-	if (port1->iotype != port2->iotype)
-		return false;
-	else if (port1->iotype == UPIO_PORT)
-		return port1->iobase == port2->iobase;
-	else if (port1->iotype == UPIO_HUB6)
-		return hub6_match_port(port1, port2);
-	else if (uart_iotype_mmio(port1->iotype))
-		return port1->mapbase == port2->mapbase;
-	else if (port1->iotype == UPIO_BUS)
-		return true;
-	else
-		return false;
-}
-EXPORT_SYMBOL(uart_match_port);
-
 static struct serial_ctrl_device *
 serial_core_get_ctrl_dev(struct serial_port_device *port_dev)
 {
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 904760876ca8..4eeb8253752a 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -1140,8 +1140,6 @@ int uart_add_one_port(struct uart_driver *reg, struct uart_port *port);
 void uart_remove_one_port(struct uart_driver *reg, struct uart_port *port);
 int uart_read_port_properties(struct uart_port *port);
 int uart_read_and_validate_port_properties(struct uart_port *port);
-bool uart_match_port(const struct uart_port *port1,
-		const struct uart_port *port2);
 
 /*
  * Power Management
-- 
2.55.0.11.g153666a7d9bb


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

end of thread, other threads:[~2026-08-14  9:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14  9:19 [PATCH v3 0/7] serial: Some yak shaving Uwe Kleine-König (The Capable Hub)
2026-08-14  9:19 ` [PATCH v3 3/7] serial: 8250: Make uart_match_port() a 8250 specific function Uwe Kleine-König (The Capable Hub)

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