Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Hugo Villeneuve <hugo@hugovil.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Jiri Slaby <jirislaby@kernel.org>
Cc: hugo@hugovil.com, ilpo.jarvinen@linux.intel.com,
	 linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	 Hugo Villeneuve <hvilleneuve@dimonoff.com>
Subject: [PATCH v2 01/15] serial: 8250_hub6: add hub6_match_port()
Date: Tue, 28 Apr 2026 13:53:47 -0400	[thread overview]
Message-ID: <20260428-tty-upio-v2-1-01c1857cf761@dimonoff.com> (raw)
In-Reply-To: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com>

From: Hugo Villeneuve <hvilleneuve@dimonoff.com>

Move the entire hub6 related match port check into its own function in
8250_hub6.c and add a stub for the case when hub6 code is not even built
into kernel.

Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
---
 drivers/tty/serial/8250/8250.h      | 7 +++++++
 drivers/tty/serial/8250/8250_hub6.c | 6 ++++++
 drivers/tty/serial/serial_core.c    | 4 ++--
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
index 77fe0588fd6bd5c5baac0fa03b7c466742aa9432..9d1068d0489dc4285b1d30489926bd676bcbe60e 100644
--- a/drivers/tty/serial/8250/8250.h
+++ b/drivers/tty/serial/8250/8250.h
@@ -334,6 +334,13 @@ int fintek_8250_probe(struct uart_8250_port *uart);
 static inline int fintek_8250_probe(struct uart_8250_port *uart) { return 0; }
 #endif
 
+#ifdef CONFIG_SERIAL_8250_HUB6
+bool hub6_match_port(const struct uart_port *port1, const struct uart_port *port2);
+#else
+static inline bool hub6_match_port(const struct uart_port *port1, const struct uart_port *port2)
+{ return false; }
+#endif
+
 #ifdef CONFIG_ARCH_OMAP1
 #include <linux/soc/ti/omap1-soc.h>
 static inline int is_omap1_8250(struct uart_8250_port *pt)
diff --git a/drivers/tty/serial/8250/8250_hub6.c b/drivers/tty/serial/8250/8250_hub6.c
index 273f59b9bca555e9fb035005d3df2089c5b0a039..eae32c924e29bcaf608d66988aca461b9a53dc91 100644
--- a/drivers/tty/serial/8250/8250_hub6.c
+++ b/drivers/tty/serial/8250/8250_hub6.c
@@ -41,6 +41,12 @@ static struct platform_device hub6_device = {
 	},
 };
 
+bool hub6_match_port(const struct uart_port *port1, const struct uart_port *port2)
+{
+	return port1->iobase == port2->iobase && port1->hub6 == port2->hub6;
+}
+EXPORT_SYMBOL_GPL(hub6_match_port);
+
 static int __init hub6_init(void)
 {
 	return platform_device_register(&hub6_device);
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 89cebdd278410a5a97f3f5ee1b9c171715145067..7354f8af4853d34e5e819c2887f287970c653b69 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -33,6 +33,7 @@
 #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.
@@ -3198,8 +3199,7 @@ bool uart_match_port(const struct uart_port *port1,
 	case UPIO_PORT:
 		return port1->iobase == port2->iobase;
 	case UPIO_HUB6:
-		return port1->iobase == port2->iobase &&
-		       port1->hub6   == port2->hub6;
+		return hub6_match_port(port1, port2);
 	case UPIO_MEM:
 	case UPIO_MEM16:
 	case UPIO_MEM32:

-- 
2.47.3


  reply	other threads:[~2026-04-28 17:54 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 17:53 [PATCH v2 00/15] serial: add new I/O type for SPI and I2C bus devices Hugo Villeneuve
2026-04-28 17:53 ` Hugo Villeneuve [this message]
2026-04-28 17:53 ` [PATCH v2 02/15] serial: core: add uart_iotype_mmio/legacy_io helper functions Hugo Villeneuve
2026-04-30 15:08   ` Andy Shevchenko
2026-04-30 15:30     ` Hugo Villeneuve
2026-05-01 11:48       ` Andy Shevchenko
2026-05-02 23:25     ` Maciej W. Rozycki
2026-05-04  8:48       ` Andy Shevchenko
2026-05-04 11:44         ` Maciej W. Rozycki
2026-05-04 14:30           ` Andy Shevchenko
2026-05-04 15:20             ` Maciej W. Rozycki
2026-05-04 15:59               ` Andy Shevchenko
2026-04-28 17:53 ` [PATCH v2 03/15] serial: core: use uart_iotype_*() to simplify uart_match_port() Hugo Villeneuve
2026-04-28 17:53 ` [PATCH v2 04/15] serial: core: use uart_iotype_*() to simplify uart_line_info() Hugo Villeneuve
2026-04-28 17:53 ` [PATCH v2 05/15] serial: core: replace snprintf with more robust scnprintf Hugo Villeneuve
2026-04-30 15:07   ` Andy Shevchenko
2026-05-04 15:27     ` Hugo Villeneuve
2026-05-04 15:59       ` Andy Shevchenko
2026-04-28 17:53 ` [PATCH v2 06/15] serial: core: fix indentation/alignment Hugo Villeneuve
2026-04-28 17:53 ` [PATCH v2 07/15] serial: core: use uart_iotype_*() to simplify uart_report_port() Hugo Villeneuve
2026-04-28 17:53 ` [PATCH v2 08/15] serial: earlycon: use uart_iotype_*() to simplify code Hugo Villeneuve
2026-04-30 15:03   ` Andy Shevchenko
2026-05-04 15:40     ` Hugo Villeneuve
2026-05-04 16:01       ` Andy Shevchenko
2026-04-28 17:53 ` [PATCH v2 09/15] serial: 8250: " Hugo Villeneuve
2026-04-28 17:53 ` [PATCH v2 10/15] serial: 8250_rsa: " Hugo Villeneuve
2026-04-28 17:53 ` [PATCH v2 11/15] serial: core: add new I/O type for SPI and I2C bus devices Hugo Villeneuve
2026-04-28 17:53 ` [PATCH v2 12/15] serial: sc16is7xx: use new UPIO_BUS as iotype Hugo Villeneuve
2026-04-28 17:53 ` [PATCH v2 13/15] serial: max310x: " Hugo Villeneuve
2026-04-28 17:54 ` [PATCH v2 14/15] serial: max3100: " Hugo Villeneuve
2026-04-28 17:54 ` [PATCH v2 15/15] serial: uniformize serial port I/O infos display Hugo Villeneuve

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260428-tty-upio-v2-1-01c1857cf761@dimonoff.com \
    --to=hugo@hugovil.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hvilleneuve@dimonoff.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox