From nobody Wed Jun 17 01:42:26 2026 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 711A744DB6B; Tue, 28 Apr 2026 17:54:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398878; cv=none; b=XX2wLdKESdmo5Yvai7NmxjwiJmGhpP9uc7MwgoBzklGgU8baVYMx2Mt4o9Tj8JyCUNIyy2o0NL7PQn78bSKoxzad0DuD/GWWZPlGQUZhlfY6TtcCqhnRxNoFXOEtLk6ThSsiYKjNAMzrLrNFYXI0r2NQen5Kprmwki4eXxIxTbU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398878; c=relaxed/simple; bh=TLYDd+Yy/gHnM4LTrPqLjWEuY3pH1D3wpPYh7GiMDZE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kY6xbyf8FhD6JGQbg73JiLBXyi0LSvTTdYSxW2t00eNYYJKKVY8TkhYvxqAnjS1A4wee7YoTOzBJsTcyOUgoRBRuj9LEofimibab+aPpZnAmwZKpHrMjaHeQkgEO2x5FgbK7tDluR/7ufvx1v2PHW3CFsV65wFFbaAtoyC1436k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=f3hxVY/W; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="f3hxVY/W" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=default; h=Cc:To:Message-Id:Content-Transfer-Encoding:MIME-Version: Subject:Date:From:subject:date:message-id:reply-to; bh=NTgU9JuUtBjg1NMLiyaOg4aZowwK2cJ1L0NIxrv2fdY=; b=f3hxVY/WdUdrEI7K8Ld1T+9TJ7 XkaWA9sDmJzgVmr76XDLck/JL7tn2nSVv0z8ueVMg4dDbTROifU2/ly4AOaoY6tOOm7lfcgNz4MO8 /0kUcMegMae/0d6sHBxVlfWIcy22CyCqa8z22Z610tenv+GzAVUUDeWSc/cdCRKfa+iw=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168] helo=pettiford.lan) by mail.hugovil.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wHmdg-000000004cz-0ZeR; Tue, 28 Apr 2026 13:54:28 -0400 From: Hugo Villeneuve Date: Tue, 28 Apr 2026 13:53:47 -0400 Subject: [PATCH v2 01/15] serial: 8250_hub6: add hub6_match_port() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260428-tty-upio-v2-1-01c1857cf761@dimonoff.com> References: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> In-Reply-To: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> To: Greg Kroah-Hartman , Jiri Slaby Cc: hugo@hugovil.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Hugo Villeneuve X-Mailer: b4 0.14.2 X-Spam_score: -1.0 X-Spam_bar: - From: Hugo Villeneuve 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=C3=A4rvinen Signed-off-by: Hugo Villeneuve --- 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..9d1068d0489dc4285b1d3048992= 6bd676bcbe60e 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 =20 +#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 st= ruct uart_port *port2) +{ return false; } +#endif + #ifdef CONFIG_ARCH_OMAP1 #include 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..eae32c924e29bcaf608d66988ac= a461b9a53dc91 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 =3D { }, }; =20 +bool hub6_match_port(const struct uart_port *port1, const struct uart_port= *port2) +{ + return port1->iobase =3D=3D port2->iobase && port1->hub6 =3D=3D port2->hu= b6; +} +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_c= ore.c index 89cebdd278410a5a97f3f5ee1b9c171715145067..7354f8af4853d34e5e819c2887f= 287970c653b69 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -33,6 +33,7 @@ #include =20 #include "serial_base.h" +#include "8250/8250.h" /* For hub6_match_port() */ =20 /* * 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 =3D=3D port2->iobase; case UPIO_HUB6: - return port1->iobase =3D=3D port2->iobase && - port1->hub6 =3D=3D port2->hub6; + return hub6_match_port(port1, port2); case UPIO_MEM: case UPIO_MEM16: case UPIO_MEM32: --=20 2.47.3 From nobody Wed Jun 17 01:42:26 2026 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7124144DB6D; Tue, 28 Apr 2026 17:54:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398879; cv=none; b=AquujrWSwxX6bdAOAWX8kEgx8vo8OvRB69aKc53DsOo5X6u3OzSCAsU0qkN1LyqmRa1inKmDPLGg6s6f92t/zDtCkdqYTD8cDCqEI1ErJfUACX9zOdUSYcFIbTUZyArUwef6RfAZKKw+hkUrHngtJWgMGw1OmAwFkhtlpudEf38= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398879; c=relaxed/simple; bh=CeIiTqoZcxa2tOkKe32jvVCAACcagbzwysrTsxrN/ok=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=egZw+AyqY+hocm6VffkKmuL89rm7svGyacSfzaVxEe47glf+PFrtNdyvrw19+TIr16L0omeFif760HwCZpWERmzi/fj0UYJtzXOUDTOT2Ed3S2FCYAehzuK9Qstukid7WSlI5zLv9u82xoyb1uXnFnyieXJMDWRFf+ofnAeja7w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=OYiT6cSU; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="OYiT6cSU" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=default; h=Cc:To:Message-Id:Content-Transfer-Encoding:MIME-Version: Subject:Date:From:subject:date:message-id:reply-to; bh=E9JpJuDQgSm0emq6f6ms1gLWl5NexXzvKruVtR1yZkM=; b=OYiT6cSUnTm9sTuC6XWzrcua2l ktFVPIRRvH05cRFkBTyC79s8C5soTIRyC2HLy1z9fr1kXGxiWX8cs4sRjjrZ+WKvBDAFN+4h9QmO6 awM7pfhJzuD8fVDIsEw1NJYhLyaigbJaiEIylps1whVyPmRzrd1ITvD5xAIya12Ixcdg=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168] helo=pettiford.lan) by mail.hugovil.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wHmdg-000000004cz-2RMF; Tue, 28 Apr 2026 13:54:28 -0400 From: Hugo Villeneuve Date: Tue, 28 Apr 2026 13:53:48 -0400 Subject: [PATCH v2 02/15] serial: core: add uart_iotype_mmio/legacy_io helper functions Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260428-tty-upio-v2-2-01c1857cf761@dimonoff.com> References: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> In-Reply-To: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> To: Greg Kroah-Hartman , Jiri Slaby Cc: hugo@hugovil.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Hugo Villeneuve X-Mailer: b4 0.14.2 X-Spam_score: -1.0 X-Spam_bar: - From: Hugo Villeneuve To help simplify code that check on the io type mode of the port. Signed-off-by: Hugo Villeneuve --- Will also be used by future commit that add UPIO_BUS. --- drivers/tty/serial/serial_core.c | 28 ++++++++++++++++++++++++++++ include/linux/serial_core.h | 4 ++++ 2 files changed, 32 insertions(+) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_c= ore.c index 7354f8af4853d34e5e819c2887f287970c653b69..c177054f9515e1cb5a1e557c0da= c096cb1cbd8cf 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -1967,6 +1967,34 @@ static const char *uart_type(struct uart_port *port) return str; } =20 +bool uart_iotype_mmio(enum uart_iotype iotype) +{ + switch (iotype) { + case UPIO_MEM: + case UPIO_MEM32: + case UPIO_AU: + case UPIO_TSI: + case UPIO_MEM32BE: + case UPIO_MEM16: + return true; + default: + return false; + } +} +EXPORT_SYMBOL_GPL(uart_iotype_mmio); + +bool uart_iotype_legacy_io(enum uart_iotype iotype) +{ + switch (iotype) { + case UPIO_PORT: + case UPIO_HUB6: + return true; + default: + return false; + } +} +EXPORT_SYMBOL_GPL(uart_iotype_legacy_io); + #ifdef CONFIG_PROC_FS =20 static void uart_line_info(struct seq_file *m, struct uart_state *state) diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 666430b4789977ae19641442b369eb1c773233f4..fc3f5ebe389658c197ffc105ce4= ac11cacef59bb 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -1306,4 +1306,8 @@ static inline int uart_handle_break(struct uart_port = *port) !((cflag) & CLOCAL)) =20 int uart_get_rs485_mode(struct uart_port *port); + +bool uart_iotype_mmio(enum uart_iotype iotype); +bool uart_iotype_legacy_io(enum uart_iotype iotype); + #endif /* LINUX_SERIAL_CORE_H */ --=20 2.47.3 From nobody Wed Jun 17 01:42:26 2026 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C99DD450904; Tue, 28 Apr 2026 17:54:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398878; cv=none; b=cQRaKkyuCR0m5PPSjuIdjP36tKCh4GbfEBf7N3V58X+JArc+EdfW3tmfgnvbpxZCDyae4hlNnO+997KD36YwdROzvBbyf2opVlEW3V1OXb4mWff0r69X0XHYiI1Cmw5iel522ixcApru37LBNC6FLBHgski0Bbw69iyh5odWDm4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398878; c=relaxed/simple; bh=mSX+YMcMNc234FLBPQBYcbeIV/YtsjAT0oWvxdygpzA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a7wFWwoxGlwCLPZi+ks/R+ikQIMfzdU9eUPLxtUrNX429N9v6pfcGbFwq4hGMmdWAyM3weKqhIQF9II/B+eiu72Z76UsaQWbNTf4m8Sbt0fQp91AzN+UHAOEvciU3KE0PBVz5x7MOwegFA7YsBhZQ3dXKZJv288ER2N089t62xk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=Cwdx1TPK; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="Cwdx1TPK" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=default; h=Cc:To:Message-Id:Content-Transfer-Encoding:MIME-Version: Subject:Date:From:subject:date:message-id:reply-to; bh=ppfz3B+6vbs6lg6kmFok2Y5LS0XWmMCrAVuhcJ0eV5Y=; b=Cwdx1TPKDgVC58jFArlPCCsE0V JpiBvyritwhElbi8d+cMLd1t+c8WNvLsnRiijle2NQbpx4cWGnqyuSMz0edrK8Ts+sPeR4nvBiSQW GTO0oIerrTmXH0I+r0cZ/dSaC8vEyHQFinqNSUIGHvZAFn05v9gJCCxyflIvjdC4o9DA=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168] helo=pettiford.lan) by mail.hugovil.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wHmdh-000000004cz-0bPG; Tue, 28 Apr 2026 13:54:29 -0400 From: Hugo Villeneuve Date: Tue, 28 Apr 2026 13:53:49 -0400 Subject: [PATCH v2 03/15] serial: core: use uart_iotype_*() to simplify uart_match_port() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260428-tty-upio-v2-3-01c1857cf761@dimonoff.com> References: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> In-Reply-To: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> To: Greg Kroah-Hartman , Jiri Slaby Cc: hugo@hugovil.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Hugo Villeneuve X-Mailer: b4 0.14.2 X-Spam_score: -1.0 X-Spam_bar: - From: Hugo Villeneuve Make use of new functions uart_iotype_mmio() and uart_iotype_legacy_io() to simplify and improve code readability. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/serial_core.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_c= ore.c index c177054f9515e1cb5a1e557c0dac096cb1cbd8cf..06a774f93652d65bc8e0f1ed912= aa3e5c95e2bfa 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -3222,22 +3222,14 @@ bool uart_match_port(const struct uart_port *port1, { if (port1->iotype !=3D port2->iotype) return false; - - switch (port1->iotype) { - case UPIO_PORT: + else if (port1->iotype =3D=3D UPIO_PORT) return port1->iobase =3D=3D port2->iobase; - case UPIO_HUB6: + else if (port1->iotype =3D=3D UPIO_HUB6) return hub6_match_port(port1, port2); - case UPIO_MEM: - case UPIO_MEM16: - case UPIO_MEM32: - case UPIO_MEM32BE: - case UPIO_AU: - case UPIO_TSI: + else if (uart_iotype_mmio(port1->iotype)) return port1->mapbase =3D=3D port2->mapbase; - default: + else return false; - } } EXPORT_SYMBOL(uart_match_port); =20 --=20 2.47.3 From nobody Wed Jun 17 01:42:26 2026 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C98E9450902; Tue, 28 Apr 2026 17:54:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398877; cv=none; b=VFEOOEH2RQkazUx5AZZ47CIDey8Wvep2Oj5Ui3rmxtS8K/wOj5QdyKF6oJUXxKKPxiUUYWmSXFFEIPRa2FQWruRRzKS7IHhs+a3SwLtKyx5kqkPbf2eXMK7mV4TXWqekrs3dF66UW1i2VqjAiz4ie1A6pjpG0NncZ7i0CnRLGWs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398877; c=relaxed/simple; bh=UxVMPpn7m+RcR50JAqBVm584prUuCO73GAPpglJe6zc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tmh5bo4hB0GrvlTT/1BJGpgR0cK4u0KZGeaZMABU5udrI7wntMRtR734bWB8ityRwK7ljCmllbR2XiKox7+7mzmL/7JcwOJNA6e8B+8cg9uaQew/YKOtCRGaJXidsrswtB+FM9YektsHrjfKl4O/0ek0ppJvf3Nw51MeqPprEw0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=EVzAIe/m; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="EVzAIe/m" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=default; h=Cc:To:Message-Id:Content-Transfer-Encoding:MIME-Version: Subject:Date:From:subject:date:message-id:reply-to; bh=1izpAZ5eNLLl2K3v+q3EgZzclIA8uUqw9Q9Ay/LtyqU=; b=EVzAIe/moGUm4tTVFawWUXR/8U gDHSVdci/M5eHXHH5yIb2Pfyv3FiaQT9W6h2o2naK4IbHs8X2grmsdRq8Hj/PndYj+S4PH2vvHcUe Z6u0eZsEn6veJmD2vCPSb+mMx1dP6vKDuW1fBAwQMUn272wAi0htua9dnBujfuxny4Sw=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168] helo=pettiford.lan) by mail.hugovil.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wHmdh-000000004cz-2HrH; Tue, 28 Apr 2026 13:54:29 -0400 From: Hugo Villeneuve Date: Tue, 28 Apr 2026 13:53:50 -0400 Subject: [PATCH v2 04/15] serial: core: use uart_iotype_*() to simplify uart_line_info() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260428-tty-upio-v2-4-01c1857cf761@dimonoff.com> References: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> In-Reply-To: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> To: Greg Kroah-Hartman , Jiri Slaby Cc: hugo@hugovil.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Hugo Villeneuve X-Mailer: b4 0.14.2 X-Spam_score: -1.0 X-Spam_bar: - From: Hugo Villeneuve Make use of new functions uart_iotype_mmio() and uart_iotype_legacy_io() to simplify and improve code readability. This will prevent displaying irrelevant information for future IO types (ex: UPIO_BUS), while also addressing the (eventually) invalid check for "iotype >=3D UPIO_MEM". This also allows us to remove the confusing cast to (unsigned long long) for iobase which is defined as an unsigned long, and use %pa to display the mapbase pointer, as it is done in earlycon_print_info(). Signed-off-by: Hugo Villeneuve --- On 32-bit cpu: no changes. On 64-bit cpu: # cat /proc/tty/driver/sci before serinfo:1.0 driver revision: 0: uart:scif mmio:0x1004B800 irq:35 tx:11192 rx:37 RTS|CTS|DTR|DSR|CD after: serinfo:1.0 driver revision: 0: uart:scif mmio:0x000000001004b800 irq:35 tx:11339 rx:35 RTS|CTS|DTR|= DSR|CD --- drivers/tty/serial/serial_core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_c= ore.c index 06a774f93652d65bc8e0f1ed912aa3e5c95e2bfa..c5ef2dd00a9c9ad57c4010c05da= ea34fd2053676 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2004,7 +2004,6 @@ static void uart_line_info(struct seq_file *m, struct= uart_state *state) struct uart_port *uport; char stat_buf[32]; unsigned int status; - int mmio; =20 guard(mutex)(&port->mutex); =20 @@ -2012,13 +2011,14 @@ static void uart_line_info(struct seq_file *m, stru= ct uart_state *state) if (!uport) return; =20 - mmio =3D uport->iotype >=3D UPIO_MEM; - seq_printf(m, "%u: uart:%s %s%08llX irq:%u", - uport->line, uart_type(uport), - mmio ? "mmio:0x" : "port:", - mmio ? (unsigned long long)uport->mapbase - : (unsigned long long)uport->iobase, - uport->irq); + seq_printf(m, "%u: uart:%s", uport->line, uart_type(uport)); + + if (uart_iotype_mmio(uport->iotype)) + seq_printf(m, " mmio:%pa", &uport->mapbase); + else if (uart_iotype_legacy_io(uport->iotype)) + seq_printf(m, " port:%08lX", uport->iobase); + + seq_printf(m, " irq:%u", uport->irq); =20 if (uport->type =3D=3D PORT_UNKNOWN) { seq_putc(m, '\n'); --=20 2.47.3 From nobody Wed Jun 17 01:42:26 2026 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC81B32AABC; Tue, 28 Apr 2026 17:54:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398877; cv=none; b=CM5ImWCia7wQPATSHYstnWqSGh89qmH8AeLNus1Z9Zf0gXwzAyqxHmG2C7u0CNgWsy0o+UhjLT51rbVRG0U0fSSMfR191lJS15oRKcE2ZpHLERe2KE0ZUrWy3fmwG0NTPyzTS+qu32mwCLFDSy77qxsz/5x0cCF0VAvULXrkYSw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398877; c=relaxed/simple; bh=Iut/Jt4Q4CrQ/X0ofuQRrVed6i8XkZo3LdnY6PMmjNM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tD4VmNABxejnTx6WHyh7Z4ixHnB6uRC93gY99yOd1H5rc4kiANVGJ0CflKK7p0UG/HyhfHuVtxaJ28D/XzF32fzVz5bmESENieBeEJnYJUsnVl3AZT7aLqID8m0DBP143+/t0b0t0hKNzeNkUMYUdFkrqj5fESZBfXwu3qXqm48= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=mBqFYX+M; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="mBqFYX+M" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=default; h=Cc:To:Message-Id:Content-Transfer-Encoding:MIME-Version: Subject:Date:From:subject:date:message-id:reply-to; bh=LDAG2CLo+vvi235SDH0ibljwB66+qJO9KRi9UYV+e80=; b=mBqFYX+MiSHtOV0mwvT6TaoRU7 4a+U/1BoP8tQTdH+WDFp/vBukw4DDfopzC/b4hth0JQ+z2km5Q1QmT60NJWhpMEiT+/mo8UKKBMPr 7t3zRiZxY/ovrzLsMV/d6obOn7APCZMzTxY1ZWwN/yAdUAEjTzu/z7Pq0oEiI1Gq4VEQ=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168] helo=pettiford.lan) by mail.hugovil.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wHmdh-000000004cz-3z2C; Tue, 28 Apr 2026 13:54:29 -0400 From: Hugo Villeneuve Date: Tue, 28 Apr 2026 13:53:51 -0400 Subject: [PATCH v2 05/15] serial: core: replace snprintf with more robust scnprintf Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260428-tty-upio-v2-5-01c1857cf761@dimonoff.com> References: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> In-Reply-To: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> To: Greg Kroah-Hartman , Jiri Slaby Cc: hugo@hugovil.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Hugo Villeneuve X-Mailer: b4 0.14.2 X-Spam_score: -1.0 X-Spam_bar: - From: Hugo Villeneuve Use scnprintf() so we could perhaps one day get rid of snprintf() entirely. Suggested-by: Ilpo J=C3=A4rvinen Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/serial_core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_c= ore.c index c5ef2dd00a9c9ad57c4010c05daea34fd2053676..3c909b8a82135a6245e98a9ae6b= b050fc32590cc 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2487,11 +2487,11 @@ uart_report_port(struct uart_driver *drv, struct ua= rt_port *port) =20 switch (port->iotype) { case UPIO_PORT: - snprintf(address, sizeof(address), "I/O 0x%lx", port->iobase); + scnprintf(address, sizeof(address), "I/O 0x%lx", port->iobase); break; case UPIO_HUB6: - snprintf(address, sizeof(address), - "I/O 0x%lx offset 0x%x", port->iobase, port->hub6); + scnprintf(address, sizeof(address), + "I/O 0x%lx offset 0x%x", port->iobase, port->hub6); break; case UPIO_MEM: case UPIO_MEM16: @@ -2499,8 +2499,8 @@ uart_report_port(struct uart_driver *drv, struct uart= _port *port) case UPIO_MEM32BE: case UPIO_AU: case UPIO_TSI: - snprintf(address, sizeof(address), - "MMIO 0x%llx", (unsigned long long)port->mapbase); + scnprintf(address, sizeof(address), + "MMIO 0x%llx", (unsigned long long)port->mapbase); break; default: strscpy(address, "*unknown*", sizeof(address)); --=20 2.47.3 From nobody Wed Jun 17 01:42:26 2026 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDE3145104C; Tue, 28 Apr 2026 17:54:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398878; cv=none; b=jId/m7e2IJQsCkeU+nH8tcB9D/imA2I0Vs+BhfG5+y0FEjDxLI7x/oTfD0ZjQGaEMzaJIP1FnyE6r8Jzb82TtJDlisntYItCSAiDIXmoKUjUV3j24k9dvRSnqSOG2sAjRzO3O+IGTpNlSuvspsgqO/I3TXcIS/AygSPk+zva54k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398878; c=relaxed/simple; bh=bi0Piu0ervyfZdqbZSg8KN9t7BUiwhRV40djFdqlRtk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fNkA4tN7SfnMWJ16sjyjzzM1a7ykHBhvRVyM4sY2CWW/Zz4d4d+sOW/2GnY6gD9lALZgeyWPwbtZ/C+ZOspZK0gfAFCuneZ15R1Pk+Uujane59+l/zPsBZzmsfZ+edk6pCV98rPcLTD5PkE7TrFgD5pLrF+cGFIrtdHuq8Pd0Go= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=hgd4W2+b; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="hgd4W2+b" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=default; h=Cc:To:Message-Id:Content-Transfer-Encoding:MIME-Version: Subject:Date:From:subject:date:message-id:reply-to; bh=g3mtZQJHziRkotRRHZ7P8tdIbi9wvg4N62GgZGSBbCs=; b=hgd4W2+bpYNvE32oRA/AFLaitW bQuADkoqBh8v7j8QfWYi7wANT7VeBA9h47s/0rvqMLdaFa4O9OdNHcjI+JdwZdcAXWv9cmyGy1AxB iatqEfHHqjG+vkaJVSXQ44wCCu2WliRAFWqktxe7xsqyBN/Ytw8OOTZ/133eEJmSm+p8=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168] helo=pettiford.lan) by mail.hugovil.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wHmdi-000000004cz-1LB9; Tue, 28 Apr 2026 13:54:30 -0400 From: Hugo Villeneuve Date: Tue, 28 Apr 2026 13:53:52 -0400 Subject: [PATCH v2 06/15] serial: core: fix indentation/alignment Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260428-tty-upio-v2-6-01c1857cf761@dimonoff.com> References: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> In-Reply-To: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> To: Greg Kroah-Hartman , Jiri Slaby Cc: hugo@hugovil.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Hugo Villeneuve X-Mailer: b4 0.14.2 X-Spam_score: -1.0 X-Spam_bar: - From: Hugo Villeneuve Fixes the following checkpatch warnings: CHECK: Alignment should match open parenthesis Signed-off-by: Hugo Villeneuve --- Without this, the next patch will have a checkpatch warning. --- drivers/tty/serial/serial_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_c= ore.c index 3c909b8a82135a6245e98a9ae6bb050fc32590cc..e9986f9221f946c9075a8eea7ac= 28d2ad818f095 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2508,10 +2508,10 @@ uart_report_port(struct uart_driver *drv, struct ua= rt_port *port) } =20 pr_info("%s%s%s at %s (irq =3D %u, base_baud =3D %u) is a %s\n", - port->dev ? dev_name(port->dev) : "", - port->dev ? ": " : "", - port->name, - address, port->irq, port->uartclk / 16, uart_type(port)); + port->dev ? dev_name(port->dev) : "", + port->dev ? ": " : "", + port->name, + address, port->irq, port->uartclk / 16, uart_type(port)); =20 /* The magic multiplier feature is a bit obscure, so report it too. */ if (port->flags & UPF_MAGIC_MULTIPLIER) --=20 2.47.3 From nobody Wed Jun 17 01:42:26 2026 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A518B45BD57; Tue, 28 Apr 2026 17:54:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398879; cv=none; b=fcTDbptE6+BQkZSZVzg+TqTPLX6uP+1dKT0NCVwmy90NJKs0B4XSDQIydQkzSzngKsTm933gSHxZ640GBkfyyWhjffxcpBbhres4havDidVn7nsKD5vkoJ0os1YkaWHR4K816HcSgYEpWdzYhHsJKJWpPFuYh8PAcv0OPgwrHuE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398879; c=relaxed/simple; bh=iZPMGPt9wRMFYzKXfEfBzoq53zZoKlJ/IYKhZLS1dHg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ldpovO5gLTQNqGKwLKymnNHMWJ7HTLGzwq2pfw+8CylamIBI88AWWL5ls2GYhDMv2VrOT6A6dbCPSPN+7rcyb9YJYbEDiCm/A4OkqnJ3KG3RYkK4LYFNq802qfgo9P4vYBppDLmTwTG2quiCTlM4KJdwwOd8xZ5s8xLyD7Fsr8M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=vGoemfAD; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="vGoemfAD" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=default; h=Cc:To:Message-Id:Content-Transfer-Encoding:MIME-Version: Subject:Date:From:subject:date:message-id:reply-to; bh=kSikfwMOTFC1nv1oE1sWrNsPzqXqxKIVOB637a3FBFM=; b=vGoemfAD3WAm5KGpYSzpL6gp7I 5ynPab+Lwa8gvmxG4QzYEWdPpJSfLtZ1NbvacmEjcR7Xh3HeNm1lVDN3lZwSJnr21NbtwP9Borim5 oShD8Qlavrsqx1txglqT1g6Se43iNeRmdVBy9oNlqDJkEU8WHY7QCpgyd6O92jrTaOhc=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168] helo=pettiford.lan) by mail.hugovil.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wHmdi-000000004cz-3B2D; Tue, 28 Apr 2026 13:54:30 -0400 From: Hugo Villeneuve Date: Tue, 28 Apr 2026 13:53:53 -0400 Subject: [PATCH v2 07/15] serial: core: use uart_iotype_*() to simplify uart_report_port() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260428-tty-upio-v2-7-01c1857cf761@dimonoff.com> References: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> In-Reply-To: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> To: Greg Kroah-Hartman , Jiri Slaby Cc: hugo@hugovil.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Hugo Villeneuve X-Mailer: b4 0.14.2 X-Spam_score: -1.0 X-Spam_bar: - From: Hugo Villeneuve Make use of new functions uart_iotype_mmio() and uart_iotype_legacy_io() to simplify and improve code readability. It will also prevent displaying irrelevant I/O information for future IO types (ex: UPIO_BUS). Use %pa to display the mapbase pointer, as it is done in earlycon_print_info(). Signed-off-by: Hugo Villeneuve --- On 32-bit cpu: no changes. On 64-bit cpu: before: 1004b800.serial: ttySC0 at MMIO 0x1004b800 (irq =3D 35, base_baud =3D 0= ) is a scif 1004bc00.serial: ttySC1 at MMIO 0x1004bc00 (irq =3D 40, base_baud =3D 0= ) is a scif after: 1004b800.serial: ttySC0 at MMIO 0x000000001004b800 (irq =3D 35, base_ba= ud =3D 0) is a scif 1004bc00.serial: ttySC1 at MMIO 0x000000001004bc00 (irq =3D 40, base_ba= ud =3D 0) is a scif --- drivers/tty/serial/serial_core.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_c= ore.c index e9986f9221f946c9075a8eea7ac28d2ad818f095..d0d4dba41fb9ee43403391d9d59= 9abc1d64b48ec 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2483,31 +2483,19 @@ EXPORT_SYMBOL(uart_resume_port); static inline void uart_report_port(struct uart_driver *drv, struct uart_port *port) { - char address[64]; + char address[64] =3D ""; =20 - switch (port->iotype) { - case UPIO_PORT: - scnprintf(address, sizeof(address), "I/O 0x%lx", port->iobase); - break; - case UPIO_HUB6: - scnprintf(address, sizeof(address), - "I/O 0x%lx offset 0x%x", port->iobase, port->hub6); - break; - case UPIO_MEM: - case UPIO_MEM16: - case UPIO_MEM32: - case UPIO_MEM32BE: - case UPIO_AU: - case UPIO_TSI: - scnprintf(address, sizeof(address), - "MMIO 0x%llx", (unsigned long long)port->mapbase); - break; - default: - strscpy(address, "*unknown*", sizeof(address)); - break; + if (uart_iotype_mmio(port->iotype)) + scnprintf(address, sizeof(address), " at MMIO %pa", &port->mapbase); + else if (uart_iotype_legacy_io(port->iotype)) { + if (port->iotype =3D=3D UPIO_PORT) + scnprintf(address, sizeof(address), " at I/O 0x%lx", port->iobase); + else if (port->iotype =3D=3D UPIO_HUB6) + scnprintf(address, sizeof(address), " at I/O 0x%lx offset 0x%x", + port->iobase, port->hub6); } =20 - pr_info("%s%s%s at %s (irq =3D %u, base_baud =3D %u) is a %s\n", + pr_info("%s%s%s%s (irq =3D %u, base_baud =3D %u) is a %s\n", port->dev ? dev_name(port->dev) : "", port->dev ? ": " : "", port->name, --=20 2.47.3 From nobody Wed Jun 17 01:42:26 2026 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5DE545BD67; Tue, 28 Apr 2026 17:54:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398879; cv=none; b=fJvfpmMLuFDmWK4Fiu1B49azd38pOYiQjPnwFDCB5MTBNcUn8xPoZiJOJIKS4Vd+EAYK9bMvVxErsZOD/3yjubKdvDcRebDgMUDesVD5DKnXN6sHeK6wX83+NzeCXOi/OLMKHga538BrZa2d6uqJs2SRtTkG8tA3UpulWiGY2pY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398879; c=relaxed/simple; bh=+V/mY1nW7HBDCQmc/EEhBi9nr7yaB2jSs9MoClG95eU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tPcpM3sNm0FjwGCiVQlOu4/Mdtb+3nVeWS56sgrEZaMCvG1RGBJ0cwAQgybMn+fEsCnjjiTfDEC/FSrl7C1FV629Ul1H7E0oNODHhf3qYVcavk86fFIfzO9rziN0tz1vCQNkkCqIqX2XqWtwhCK5zJyK8OU3Q6yh+EHB+Seu1Ts= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=qKJiaAfO; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="qKJiaAfO" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=default; h=Cc:To:Message-Id:Content-Transfer-Encoding:MIME-Version: Subject:Date:From:subject:date:message-id:reply-to; bh=t4/xAFit2cI4F9RacEqfbIiOtR5Mf/htDi+ZgiNIm7Q=; b=qKJiaAfOXUY4aRNzsxS/cQhg0q UzI8nJRBuB5PXO5uSCbiZGWms0sjLWYJae6HpZUdqDyVv/J+vWOnihp2J9KU7CT+Vhzdm//bjc/fL 0Fh/ygbGw74e9b63EgsKsKk+kZuBtn/oUUZ/5A226t6Xs3Zf/huactInLCeO3yYuZr08=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168] helo=pettiford.lan) by mail.hugovil.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wHmdj-000000004cz-1DzO; Tue, 28 Apr 2026 13:54:31 -0400 From: Hugo Villeneuve Date: Tue, 28 Apr 2026 13:53:54 -0400 Subject: [PATCH v2 08/15] serial: earlycon: use uart_iotype_*() to simplify code Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260428-tty-upio-v2-8-01c1857cf761@dimonoff.com> References: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> In-Reply-To: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> To: Greg Kroah-Hartman , Jiri Slaby Cc: hugo@hugovil.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Hugo Villeneuve X-Mailer: b4 0.14.2 X-Spam_score: -1.0 X-Spam_bar: - From: Hugo Villeneuve Make use of new functions uart_iotype_mmio() and uart_iotype_legacy_io() to simplify and improve code readability. Signed-off-by: Hugo Villeneuve --- Using uart_iotype_mmio() now includes the case for UPIO_TSI and UPIO_AU, which fell before this patch in the else clause. UPIO_TSI is no longer used by any driver, so not an issue. UPIO_AU, if this is even possible for earlycon, falls into the "MMIO" categ= ory in uart_line_info() and uart_report_port()... --- drivers/tty/serial/earlycon.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c index ab9af37f6cda35ea2e3ea966fdac8ba5c4475cb2..e799feaa14bf1ac7c1a5677cd84= 490e7c486449b 100644 --- a/drivers/tty/serial/earlycon.c +++ b/drivers/tty/serial/earlycon.c @@ -75,19 +75,19 @@ static void __init earlycon_print_info(struct earlycon_= device *device) { struct console *earlycon =3D device->con; struct uart_port *port =3D &device->port; + char address[64] =3D ""; =20 - if (port->iotype =3D=3D UPIO_MEM || port->iotype =3D=3D UPIO_MEM16 || - port->iotype =3D=3D UPIO_MEM32 || port->iotype =3D=3D UPIO_MEM32BE) - pr_info("%s%d at MMIO%s %pa (options '%s')\n", - earlycon->name, earlycon->index, - (port->iotype =3D=3D UPIO_MEM) ? "" : - (port->iotype =3D=3D UPIO_MEM16) ? "16" : - (port->iotype =3D=3D UPIO_MEM32) ? "32" : "32be", - &port->mapbase, device->options); - else - pr_info("%s%d at I/O port 0x%lx (options '%s')\n", - earlycon->name, earlycon->index, - port->iobase, device->options); + if (uart_iotype_mmio(port->iotype)) + scnprintf(address, sizeof(address), " at MMIO%s %pa", + (port->iotype =3D=3D UPIO_MEM) ? "" : + (port->iotype =3D=3D UPIO_MEM16) ? "16" : + (port->iotype =3D=3D UPIO_MEM32) ? "32" : "32be", + &port->mapbase); + else if (uart_iotype_legacy_io(port->iotype)) + scnprintf(address, sizeof(address), " at I/O port 0x%lx", port->iobase); + + pr_info("%s%d%s (options '%s')\n", earlycon->name, earlycon->index, + address, device->options); } =20 static int __init parse_options(struct earlycon_device *device, char *opti= ons) --=20 2.47.3 From nobody Wed Jun 17 01:42:26 2026 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A50F145BD4E; Tue, 28 Apr 2026 17:54:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398879; cv=none; b=eucj4div0KIyetzFmGzM510egdjExn/PkqFYc9zGrC2uFJq2WMKCRUNH69EcNxFCwAcP4j+I3zqQ6U8f8+SiII/lC8GCGB7JE7v9g+9+vtVoTQvuaonsihtP8HrQrqAg6aGkjDsMTAP7IEbf57pxEk/QRtvC5sWAxJDafz4zVeE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398879; c=relaxed/simple; bh=ebCdWMYWlez7UfIVV2TE4pe+AYW+8zJDAGyWak9OG2Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AjWzCFtnzBB2cNfAAlSmGmOt4bOkefo18ctjI+N1NuXRzsdZJJNGGLJ+pjtqpCv4eE8qngWWeCaUMFyvSoDfnmimbvNegRhMv95A+IZ3abaeT5IO0ngyxR/9sr9Nu0p1tYYse90hFjknOZNh0Uu/rh8FsJrXNETgF+RL81x7IGc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=nPoaeDXo; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="nPoaeDXo" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=default; h=Cc:To:Message-Id:Content-Transfer-Encoding:MIME-Version: Subject:Date:From:subject:date:message-id:reply-to; bh=WS5V+EdKE+IibOat+j1aDaCma+9TS5kYykyDoF5k13s=; b=nPoaeDXoNEIOpPX+c4yEiJAmiZ Tpo7ux8gmwOvH2SIzmOYpE83vsbd1gEHvv67xi8V7cZhAM/XcQ8MTzic4xodRh08M98CZPNcMyHw9 TCCLQedBAVjyTFLOswHVmTjWagvF7rSRhu5YZU9v2E7utdjVbTuL9/EvrwNMB4Vjut8c=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168] helo=pettiford.lan) by mail.hugovil.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wHmdj-000000004cz-33JM; Tue, 28 Apr 2026 13:54:31 -0400 From: Hugo Villeneuve Date: Tue, 28 Apr 2026 13:53:55 -0400 Subject: [PATCH v2 09/15] serial: 8250: use uart_iotype_*() to simplify code Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260428-tty-upio-v2-9-01c1857cf761@dimonoff.com> References: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> In-Reply-To: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> To: Greg Kroah-Hartman , Jiri Slaby Cc: hugo@hugovil.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Hugo Villeneuve X-Mailer: b4 0.14.2 X-Spam_score: -1.0 X-Spam_bar: - From: Hugo Villeneuve Make use of new functions uart_iotype_mmio() and uart_iotype_legacy_io() to simplify and improve code readability. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/8250/8250_port.c | 43 ++++++---------------------------= ---- 1 file changed, 7 insertions(+), 36 deletions(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/= 8250_port.c index af78cc02f38e719573becd0aea226f7790555a3e..20b7de120b1bab596de22d09fde= ff8361afd8b17 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -472,16 +472,10 @@ static void set_io_from_upio(struct uart_port *p) static void serial_port_out_sync(struct uart_port *p, int offset, int value) { - switch (p->iotype) { - case UPIO_MEM: - case UPIO_MEM16: - case UPIO_MEM32: - case UPIO_MEM32BE: - case UPIO_AU: + if (uart_iotype_mmio(p->iotype)) { p->serial_out(p, offset, value); p->serial_in(p, UART_LCR); /* safe, no side-effects */ - break; - default: + } else { p->serial_out(p, offset, value); } } @@ -2863,13 +2857,7 @@ static int serial8250_request_std_resource(struct ua= rt_8250_port *up) unsigned int size =3D serial8250_port_size(up); struct uart_port *port =3D &up->port; =20 - switch (port->iotype) { - case UPIO_AU: - case UPIO_TSI: - case UPIO_MEM32: - case UPIO_MEM32BE: - case UPIO_MEM16: - case UPIO_MEM: + if (uart_iotype_mmio(port->iotype)) { if (!port->mapbase) return -EINVAL; =20 @@ -2883,14 +2871,9 @@ static int serial8250_request_std_resource(struct ua= rt_8250_port *up) return -ENOMEM; } } - return 0; - case UPIO_HUB6: - case UPIO_PORT: + } else if (uart_iotype_legacy_io(port->iotype)) { if (!request_region(port->iobase, size, "serial")) return -EBUSY; - return 0; - case UPIO_UNKNOWN: - break; } =20 return 0; @@ -2901,15 +2884,9 @@ static void serial8250_release_std_resource(struct u= art_8250_port *up) unsigned int size =3D serial8250_port_size(up); struct uart_port *port =3D &up->port; =20 - switch (port->iotype) { - case UPIO_AU: - case UPIO_TSI: - case UPIO_MEM32: - case UPIO_MEM32BE: - case UPIO_MEM16: - case UPIO_MEM: + if (uart_iotype_mmio(port->iotype)) { if (!port->mapbase) - break; + return; =20 if (port->flags & UPF_IOREMAP) { iounmap(port->membase); @@ -2917,14 +2894,8 @@ static void serial8250_release_std_resource(struct u= art_8250_port *up) } =20 release_mem_region(port->mapbase, size); - break; - - case UPIO_HUB6: - case UPIO_PORT: + } else if (uart_iotype_legacy_io(port->iotype)) { release_region(port->iobase, size); - break; - case UPIO_UNKNOWN: - break; } } =20 --=20 2.47.3 From nobody Wed Jun 17 01:42:26 2026 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A75154657D8; Tue, 28 Apr 2026 17:54:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398880; cv=none; b=ENMSt03z3Mt+dTcg5RXRepokQeFyg8bezLRl3NiUeugC2VdTALjRcdW6QF0IyOCzvM9ZzqeKJSMWGBk8KBYwxfDcIvZvRHlV+1EZXd5iy7CCY+Jcuh45uOnDXcGTJaQUnQToCkMPtScgUV7QnBYj+QHS9S00mY46Xw+16BetPTE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398880; c=relaxed/simple; bh=akFwuQtWodlVwYhtO9cNqwvsgK1oNMhO6zl8UMcg0cE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=i98n6vJSkQ8XVbN8pWdvqC7Q5m2n4DP8m+SBWTNma1unURqnx1ZEHLn2lxIdp0c6XXWhKnDwFDPBf/0ohBXa3hX+CQ5j7jvd3TYQEOgrirurb8VpdXzuXu6qhIqkKIBdZao03K8h2z/zJK7lmr7n9/XX5E7W2sgt88xAV7LQhwc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=Aeqo7Ikq; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="Aeqo7Ikq" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=default; h=Cc:To:Message-Id:Content-Transfer-Encoding:MIME-Version: Subject:Date:From:subject:date:message-id:reply-to; bh=FMP94OsqG4giphi7dQUK7+QsuCRxV5fNe1oTNPsf76w=; b=Aeqo7Ikqk8WTNYIuV30yUpQNOo YWvzC8rP1MP6rSAyLP4tU93qywXYNnlh9n96236GwluakG6pVj6rv4UhkgTTpBNiF5ILMJQPIUqq1 fOylyEgWSIzTOchhMLQA5fBF7IugsfUKNfXdvbcBLkZUX5hQ+o59MdKOEdrdngEW+gAY=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168] helo=pettiford.lan) by mail.hugovil.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wHmdk-000000004cz-0pkH; Tue, 28 Apr 2026 13:54:32 -0400 From: Hugo Villeneuve Date: Tue, 28 Apr 2026 13:53:56 -0400 Subject: [PATCH v2 10/15] serial: 8250_rsa: use uart_iotype_*() to simplify code Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260428-tty-upio-v2-10-01c1857cf761@dimonoff.com> References: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> In-Reply-To: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> To: Greg Kroah-Hartman , Jiri Slaby Cc: hugo@hugovil.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Hugo Villeneuve X-Mailer: b4 0.14.2 X-Spam_score: -1.0 X-Spam_bar: - From: Hugo Villeneuve Make use of new functions uart_iotype_mmio() and uart_iotype_legacy_io() to simplify and improve code readability, as well as avoid some variables init if the iotype is not valid. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/8250/8250_rsa.c | 40 ++++++++++++++++++----------------= ---- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/drivers/tty/serial/8250/8250_rsa.c b/drivers/tty/serial/8250/8= 250_rsa.c index fff9395948e33be6b08355bace70275b7515b608..010ba5af81a08e737e0198d06d1= 50bbe470e6688 100644 --- a/drivers/tty/serial/8250/8250_rsa.c +++ b/drivers/tty/serial/8250/8250_rsa.c @@ -19,35 +19,33 @@ static const struct uart_ops *core_port_base_ops; static int rsa8250_request_resource(struct uart_8250_port *up) { struct uart_port *port =3D &up->port; - unsigned long start =3D UART_RSA_BASE << port->regshift; - unsigned int size =3D 8 << port->regshift; + unsigned long start; + unsigned int size; =20 - switch (port->iotype) { - case UPIO_HUB6: - case UPIO_PORT: - start +=3D port->iobase; - if (!request_region(start, size, "serial-rsa")) - return -EBUSY; - return 0; - default: + if (!uart_iotype_legacy_io(port->iotype)) return -EINVAL; - } + + start =3D UART_RSA_BASE << port->regshift; + start +=3D port->iobase; + size =3D 8 << port->regshift; + + if (!request_region(start, size, "serial-rsa")) + return -EBUSY; + return 0; } =20 static void rsa8250_release_resource(struct uart_8250_port *up) { struct uart_port *port =3D &up->port; - unsigned long offset =3D UART_RSA_BASE << port->regshift; - unsigned int size =3D 8 << port->regshift; + unsigned long offset; + unsigned int size; =20 - switch (port->iotype) { - case UPIO_HUB6: - case UPIO_PORT: - release_region(port->iobase + offset, size); - break; - default: - break; - } + if (!uart_iotype_legacy_io(port->iotype)) + return; + + offset =3D UART_RSA_BASE << port->regshift; + size =3D 8 << port->regshift; + release_region(port->iobase + offset, size); } =20 static void univ8250_config_port(struct uart_port *port, int flags) --=20 2.47.3 From nobody Wed Jun 17 01:42:26 2026 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B512D4657DA; Tue, 28 Apr 2026 17:54:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398880; cv=none; b=oNwfGo7akliuR+y2bj0b4JJpIaQLeFevLQ+tIzgTAgDN4A9L99bQeqQRyeoFe+Jr+kwPvFj+u1YI57lQIRyDOY1DP7PRYarfBy0W54oU3I0XZeHrOho8bBEgeUQxrjb/jVzhyJLeQ+2kbNIpJnkGBADAK8ofG7MOOF9PsNjvB6U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398880; c=relaxed/simple; bh=zAXU2SdSD7A3mNzmBEJdbSK4E3xriyxmzzVnV4SFz0o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Q+KzTg8KmqrmHWssiRT9yvJK9CWpnQz8F+znLeBvoZlpwSMbcf9zFh8C9K1EqYyNHQNkdOmXjC1uZxGfPGBaesgzH5TVshaI4xQtRi1JMsQf7qOrK4se39zHzng5jRbbuovVemAO6Fh0UtHuuKG+K8z80+TVdIIncEKCprU103U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=sDp1CTl4; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="sDp1CTl4" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=default; h=Cc:To:Message-Id:Content-Transfer-Encoding:MIME-Version: Subject:Date:From:subject:date:message-id:reply-to; bh=GvahBXX0LqIbjoZ82Y4DwbPRt/Flvj94EgzONMQXHuo=; b=sDp1CTl4+B9NutE4czC2JZwZjo a6AEIB9qConfZRNWu0HnD8MrU83M8/XV87ZXYvNgAcDXIcSfqqBrYHKDSbkzlAMbiZIuXPioVRuQP qUkTAjXGiAHTjcOncwRHcDHUBBiEbsPF4O8sKmb3sssPrS//nRP0cDJu1S1utn6t2iZA=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168] helo=pettiford.lan) by mail.hugovil.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wHmdk-000000004cz-2pqi; Tue, 28 Apr 2026 13:54:32 -0400 From: Hugo Villeneuve Date: Tue, 28 Apr 2026 13:53:57 -0400 Subject: [PATCH v2 11/15] serial: core: add new I/O type for SPI and I2C bus devices Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260428-tty-upio-v2-11-01c1857cf761@dimonoff.com> References: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> In-Reply-To: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> To: Greg Kroah-Hartman , Jiri Slaby Cc: hugo@hugovil.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Hugo Villeneuve X-Mailer: b4 0.14.2 X-Spam_score: -1.0 X-Spam_bar: - From: Hugo Villeneuve I2C/SPI serial drivers don't use the following struct uart_port variables: port->membase port->mapbase port->iobase However, they are forced to set membase to a non-zero value so that uart_configure_port() will succeed because of the following check: /* If there isn't a port here, don't do anything further. */ if (!port->iobase && !port->mapbase && !port->membase) return; Add a new I/O type for SPI and I2C bus devices to remove the need to implement the kind of above-mentioned ambiguous workarounds to make them work. Now that UART report functions are using uart_iotype_*() functions, no more irrelevant I/O information are being printed for UPIO_BUS iotypes. Signed-off-by: Hugo Villeneuve --- With this change, uart_match_port() will always return true for UPIO_BUS types, and this function is not used by any of the SPI/I2C drivers. --- drivers/tty/serial/serial_core.c | 11 ++++++----- include/linux/serial_core.h | 1 + include/uapi/linux/serial.h | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_c= ore.c index d0d4dba41fb9ee43403391d9d599abc1d64b48ec..0e015477848504e37afb34c8088= 957083f1662c7 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2516,11 +2516,10 @@ uart_configure_port(struct uart_driver *drv, struct= uart_state *state, { unsigned int flags; =20 - /* - * If there isn't a port here, don't do anything further. - */ - if (!port->iobase && !port->mapbase && !port->membase) - return; + /* If there isn't a port here, don't do anything further. */ + if (uart_iotype_mmio(port->iotype) || uart_iotype_legacy_io(port->iotype)) + if (!port->iobase && !port->mapbase && !port->membase) + return; =20 /* * Now do the auto configuration stuff. Note that config_port @@ -3216,6 +3215,8 @@ bool uart_match_port(const struct uart_port *port1, return hub6_match_port(port1, port2); else if (uart_iotype_mmio(port1->iotype)) return port1->mapbase =3D=3D port2->mapbase; + else if (port1->iotype =3D=3D UPIO_BUS) + return true; else return false; } diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index fc3f5ebe389658c197ffc105ce4ac11cacef59bb..626dd939c53c9f920d71aadd360= ec0ea0bacce0d 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -437,6 +437,7 @@ enum uart_iotype { UPIO_TSI =3D SERIAL_IO_TSI, /* Tsi108/109 type IO */ UPIO_MEM32BE =3D SERIAL_IO_MEM32BE, /* 32b big endian */ UPIO_MEM16 =3D SERIAL_IO_MEM16, /* 16b little endian */ + UPIO_BUS =3D SERIAL_IO_BUS, /* Serial bus I/O access (ex: SPI, I2C) */ }; =20 struct uart_port { diff --git a/include/uapi/linux/serial.h b/include/uapi/linux/serial.h index de9b4733607e6b61b08ff7089ff90070168ff4a2..e6f61538fc2837a264d27942afa= af3f12e743445 100644 --- a/include/uapi/linux/serial.h +++ b/include/uapi/linux/serial.h @@ -72,6 +72,7 @@ struct serial_struct { #define SERIAL_IO_TSI 5 #define SERIAL_IO_MEM32BE 6 #define SERIAL_IO_MEM16 7 +#define SERIAL_IO_BUS 8 =20 #define UART_CLEAR_FIFO 0x01 #define UART_USE_FIFO 0x02 --=20 2.47.3 From nobody Wed Jun 17 01:42:26 2026 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9CC12451052; Tue, 28 Apr 2026 17:54:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398882; cv=none; b=rkW0gILhoGt009T0JI/U8Z68ep16JkLdRVWDqf5ijxxfiwe3fTUfzujCGIGO/wNmfMipnLFSZ9+CLlR4XhTlhU1ltbtlyMZNn/qmkZ81mwaxkJtENmdWw7Fplr/UIQDYXbz40CQGKB/bjawZ7ldlAbeXphLcmsn/7tTLFl6Y+jA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398882; c=relaxed/simple; bh=LTUpd3TmgtJfdNwrIKLkibUpsbTlF2k8wljPMrLkzgY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cnhhMH8WvxQekNPrds1a1b34H5mZ+H/eomttdBKKA8wGw2mLoZeAOU/8mRS6iIGjlJj+abJs4642QSCzxo5Ltw+IVAOaOiFGBK44nicHHWgUl7+PoDRJEXiSYAjePpUqMFblsubAPN16bhrygBCNOBYmLZiGsLno/z3RmaH/EGA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=DVrqwXZU; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="DVrqwXZU" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=default; h=Cc:To:Message-Id:Content-Transfer-Encoding:MIME-Version: Subject:Date:From:subject:date:message-id:reply-to; bh=6bJXCPaRHdWGSrG/PwXfrp8LFCOjxN3HY3yqJS4aCtw=; b=DVrqwXZUyqi6Ldh+I2xuUCL7rE 9wGV+8Mr6bRJ95Xg3MQgZSk3Y8VKy3Z+5eMOAi6Hy3Hf+NQcCheIqodcoI8pmzmgXsiBpNnyGXjwd 3dC1b58Gq4sx6L2K3n8WyXahyhJyi/OOPdqFWHjJrHl6+o2vekGatXp+m7QSODxuS3oA=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168] helo=pettiford.lan) by mail.hugovil.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wHmdl-000000004cz-0v8B; Tue, 28 Apr 2026 13:54:33 -0400 From: Hugo Villeneuve Date: Tue, 28 Apr 2026 13:53:58 -0400 Subject: [PATCH v2 12/15] serial: sc16is7xx: use new UPIO_BUS as iotype Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260428-tty-upio-v2-12-01c1857cf761@dimonoff.com> References: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> In-Reply-To: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> To: Greg Kroah-Hartman , Jiri Slaby Cc: hugo@hugovil.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Hugo Villeneuve X-Mailer: b4 0.14.2 X-Spam_score: -1.0 X-Spam_bar: - From: Hugo Villeneuve Now that we have a new UPIO_BUS I/O type, use it to register our serial port and remove ambiguous membase/iobase workaround. Note that commit 5da6b1c079e6 ("sc16is7xx: Set iobase to device index") used the iobase field as an index within the device to allow infering the order through sysfs, but this is no longer needed since commit 1ef2c2df1199 ("serial: core: Fix serial core controller port name to show controller id"). Signed-off-by: Hugo Villeneuve --- This means that displaying iomem_base will now always be zero: cat /sys/class/tty/ttySC0/iomem_base 0x0 cat /sys/class/tty/ttySC1/iomem_base 0x0 ... But the index can be properly displayed with this instead (example with two sc16is7xx devices): $> ls -al /sys/class/tty/ttySC*/device ... /sys/class/tty/ttySC0/device -> ../../../spi1.0:0.0 ... /sys/class/tty/ttySC1/device -> ../../../spi1.0:0.1 ... /sys/class/tty/ttySC2/device -> ../../../spi3.0:0.0 ... /sys/class/tty/ttySC3/device -> ../../../spi3.0:0.1 --- drivers/tty/serial/sc16is7xx.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 1fd64a47341d8263c82fcadd90a4c2e549193e19..4b638e69f36f2d20253d8de31f5= 2ecfe349aa39f 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1472,14 +1472,7 @@ static int sc16is7xx_setup_channel(struct sc16is7xx_= one *one, int i, port->type =3D PORT_SC16IS7XX; port->fifosize =3D SC16IS7XX_FIFO_SIZE; port->flags =3D UPF_FIXED_TYPE | UPF_LOW_LATENCY; - port->iobase =3D i; - /* - * Use all ones as membase to make sure uart_configure_port() in - * serial_core.c does not abort for SPI/I2C devices where the - * membase address is not applicable. - */ - port->membase =3D (void __iomem *)~0; - port->iotype =3D UPIO_PORT; + port->iotype =3D UPIO_BUS; port->rs485_config =3D sc16is7xx_config_rs485; port->rs485_supported =3D sc16is7xx_rs485_supported; port->ops =3D &sc16is7xx_ops; --=20 2.47.3 From nobody Wed Jun 17 01:42:26 2026 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE4D0466B69; Tue, 28 Apr 2026 17:54:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398881; cv=none; b=ZTeRP+0ixNpq5QoZUoLE4mHD2mlFCv9ArscUAvGu2WEg6ymsmL5lD/7s6YVfWKoZa1LpAdkRHCjHQFDXs1l/+VoNG6adPQM9S5Wuio2SKQomWzFoGU9kpq8U33pJb4kENFD7aLPFo2EgGIOVCq7Yj/ekxzFs8yZFqHawhMjqKAE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398881; c=relaxed/simple; bh=iLLo/F+Zqk49oSOm6IOqU5eaDxZEgFxpY8X6Ei152tM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qUQA1RQkbpkW3aKc5YEDUIQRUvyc20gDdLB53JNCnbAk4ug1DfuwfPCMbDe7KAI1VBjWnZo1J7UkQJQPHVeUloV6g16bDuutU4R3Qmfwin+yDy3XQZi38Mqnzuqa2ivooIZW4MyuwQzUPMigvGc9NjVfA7A2IGyZEQMc/rtdBRM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=Xw5nmdTd; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="Xw5nmdTd" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=default; h=Cc:To:Message-Id:Content-Transfer-Encoding:MIME-Version: Subject:Date:From:subject:date:message-id:reply-to; bh=yzXpb/zzeucTfNpYVg6pG6UVGJTqJuRg/3w0Quig9hE=; b=Xw5nmdTdUrY4xOcjdFlP9bG4uw A8dH50rEEH9RFcJsMhIK5PuElJmnXA0qBJ7V/XTTmyq6fHDYy+gFG4dyYzM/odv364P8qRMfFuktT c8+4pTbrc/rF2/uXiGzbgMo88ETsbuq0eiI+/E1Y9M/MO2JdV/eHq15f8Kq+y/xyCBr8=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168] helo=pettiford.lan) by mail.hugovil.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wHmdl-000000004cz-31z2; Tue, 28 Apr 2026 13:54:33 -0400 From: Hugo Villeneuve Date: Tue, 28 Apr 2026 13:53:59 -0400 Subject: [PATCH v2 13/15] serial: max310x: use new UPIO_BUS as iotype Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260428-tty-upio-v2-13-01c1857cf761@dimonoff.com> References: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> In-Reply-To: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> To: Greg Kroah-Hartman , Jiri Slaby Cc: hugo@hugovil.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Hugo Villeneuve X-Mailer: b4 0.14.2 X-Spam_score: -1.0 X-Spam_bar: - From: Hugo Villeneuve Now that we have a new UPIO_BUS I/O type, use it to register our serial port and remove obscure membase/iobase workaround. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/max310x.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c index ac7d3f197c3a5ce3531d5607f48e21a807314021..cd0496e307091dae1f53911abf8= 6726f52d5770d 100644 --- a/drivers/tty/serial/max310x.c +++ b/drivers/tty/serial/max310x.c @@ -1380,14 +1380,7 @@ static int max310x_probe(struct device *dev, const s= truct max310x_devtype *devty s->p[i].port.type =3D PORT_MAX310X; s->p[i].port.fifosize =3D MAX310X_FIFO_SIZE; s->p[i].port.flags =3D UPF_FIXED_TYPE | UPF_LOW_LATENCY; - s->p[i].port.iotype =3D UPIO_PORT; - s->p[i].port.iobase =3D i; - /* - * Use all ones as membase to make sure uart_configure_port() in - * serial_core.c does not abort for SPI/I2C devices where the - * membase address is not applicable. - */ - s->p[i].port.membase =3D (void __iomem *)~0; + s->p[i].port.iotype =3D UPIO_BUS; s->p[i].port.uartclk =3D uartclk; s->p[i].port.rs485_config =3D max310x_rs485_config; s->p[i].port.rs485_supported =3D max310x_rs485_supported; --=20 2.47.3 From nobody Wed Jun 17 01:42:26 2026 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7139B450901; Tue, 28 Apr 2026 17:54:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398877; cv=none; b=qbWcr0HWzP/+RXgzVduD7B9KU5lQvPa33oeHnuElZi/mun9ZjYN8T7NV2ey74rZ+kf4lWuBpUPj5qu1pmb1yjbYBbBLBRUFDQjIGNMFd7lUWcCuiTncdzHxRKPEObh31oA7eoPu7aTbtotK3q94/m2zfY9bkAw2cbK4l/EdfefU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398877; c=relaxed/simple; bh=EJPrKqBxkdjXERiK4cwkc7VD6yOaOR5y0dyDPxd8axY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=naz963K4e9oDQOD+w6MYpYHnnf4528xTudW8KfpAhqDXjSNNBOQ7lmVMICtbglzlwk4ICE/Ki6jvm+SyOoiGT2uaDtS/wOHCGr2PRHqPnWm/twi8eBi6EehkX/FJEzMwCc6SHxgaaZSrLZuteClqvrbJ5gZumZMfqmE8NOd+1/c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=nTXCqGHk; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="nTXCqGHk" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=default; h=Cc:To:Message-Id:Content-Transfer-Encoding:MIME-Version: Subject:Date:From:subject:date:message-id:reply-to; bh=nQwpibKU/Kvu4xinmgisjbECDkB88p4i9/qMW2ej3g0=; b=nTXCqGHkmUMPAT9R0ivY0rxWPp cc5nj17WB8KyBzUmOtg7AT+LTIV8eNzsvkT9vzHpePP0N7hfKvp7gx0tMCR2WVqNEQatoAX6DH+Gw OXibjeamMApb3xzuk9nXeVrLamQsjiWtcmwA6MztVFwDclhTTF9NQHabYT6mK0eQx7Y4=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168] helo=pettiford.lan) by mail.hugovil.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wHmdm-000000004cz-0XQI; Tue, 28 Apr 2026 13:54:34 -0400 From: Hugo Villeneuve Date: Tue, 28 Apr 2026 13:54:00 -0400 Subject: [PATCH v2 14/15] serial: max3100: use new UPIO_BUS as iotype Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260428-tty-upio-v2-14-01c1857cf761@dimonoff.com> References: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> In-Reply-To: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> To: Greg Kroah-Hartman , Jiri Slaby Cc: hugo@hugovil.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Hugo Villeneuve X-Mailer: b4 0.14.2 X-Spam_score: -1.0 X-Spam_bar: - From: Hugo Villeneuve Now that we have a new UPIO_BUS I/O type, use it to register our serial port. This allows the driver to work properly when using DT where membase/iobase are not set. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/max3100.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c index 475b0a6efce4bec36aa4b94ccff83934dbdf9246..17a2ff410305142798ddbbb22b4= 6f18eadce91aa 100644 --- a/drivers/tty/serial/max3100.c +++ b/drivers/tty/serial/max3100.c @@ -725,6 +725,7 @@ static int max3100_probe(struct spi_device *spi) max3100s[i]->port.ops =3D &max3100_ops; max3100s[i]->port.flags =3D UPF_SKIP_TEST | UPF_BOOT_AUTOCONF; max3100s[i]->port.line =3D i; + max3100s[i]->port.iotype =3D UPIO_BUS; max3100s[i]->port.type =3D PORT_MAX3100; max3100s[i]->port.dev =3D &spi->dev; =20 --=20 2.47.3 From nobody Wed Jun 17 01:42:26 2026 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 06FF6450915; Tue, 28 Apr 2026 17:54:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398877; cv=none; b=u9QFwhV41A2weV1i/tKF6nA8HH9z1s3W7T1yvqNQjus9GiCVgxdkGrzZVrwV85h9QpEpuuf2aJ7wP+zPYr5DyhB23BOmkq7Ovwm+0igRsG86cQ9PZR6+YJf0iP4rM7j74OSNa/8lOE1uaCb/4ZXUOk6hLc4Jxstw2AqhjeaPxds= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777398877; c=relaxed/simple; bh=JiOdqUzOqSvFzaiuy1yqf6MtmcBEiohcgPOVOP4/lB4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=enKPsyTrhZRZtFvJk9HR0NpqLyn5dl3PJNfbRwXhnupteQkF2fBD1ir1KjXDo8lE6WuwZbJb5xYZgPSGNzxMlV8TtwYS6+yq6hnyzf4HQ9NSklUvVB45Z6mu/vzSiVqZIEMU0a7NOxe/w8kvaOfE8bHz/9W/GswptqndJCGf7cQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=GudmAl+e; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="GudmAl+e" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=default; h=Cc:To:Message-Id:Content-Transfer-Encoding:MIME-Version: Subject:Date:From:subject:date:message-id:reply-to; bh=YZYiDWbW457QwQKFpo4Etol5I2BYhCkR5UyGIELMXRI=; b=GudmAl+ec3J4J/x5EQMpQcOdUm 3TthZD/tgKOaWuc7aE5HmIJOZhMVsbgrHWl65vxuFqNnUQzcg+4Rvy4OSjRqESPGiXue/On05EO87 3otcE6TiKAkFsW5zlMxdL668iS/sHh+Vp2cOcBYqbw+2shnWyF+LvuqcEvaHIjbcghG8=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168] helo=pettiford.lan) by mail.hugovil.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wHmdm-000000004cz-3BC1; Tue, 28 Apr 2026 13:54:34 -0400 From: Hugo Villeneuve Date: Tue, 28 Apr 2026 13:54:01 -0400 Subject: [PATCH v2 15/15] serial: uniformize serial port I/O infos display Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260428-tty-upio-v2-15-01c1857cf761@dimonoff.com> References: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> In-Reply-To: <20260428-tty-upio-v2-0-01c1857cf761@dimonoff.com> To: Greg Kroah-Hartman , Jiri Slaby Cc: hugo@hugovil.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Hugo Villeneuve X-Mailer: b4 0.14.2 X-Spam_score: -1.0 X-Spam_bar: - From: Hugo Villeneuve Uniformize serial port I/O infos display from three different functions that display mostly the same information, but with some variations, by adding a common function. Signed-off-by: Hugo Villeneuve --- Maybe the width information could be dropped entirely? --- drivers/tty/serial/earlycon.c | 13 +++------- drivers/tty/serial/serial_core.c | 52 +++++++++++++++++++++++++++---------= ---- include/linux/serial_core.h | 1 + 3 files changed, 40 insertions(+), 26 deletions(-) diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c index e799feaa14bf1ac7c1a5677cd84490e7c486449b..ce740cdc7cebffca0b4f6be98b8= bca66540af72d 100644 --- a/drivers/tty/serial/earlycon.c +++ b/drivers/tty/serial/earlycon.c @@ -75,19 +75,12 @@ static void __init earlycon_print_info(struct earlycon_= device *device) { struct console *earlycon =3D device->con; struct uart_port *port =3D &device->port; - char address[64] =3D ""; + char ioinfos[64]; =20 - if (uart_iotype_mmio(port->iotype)) - scnprintf(address, sizeof(address), " at MMIO%s %pa", - (port->iotype =3D=3D UPIO_MEM) ? "" : - (port->iotype =3D=3D UPIO_MEM16) ? "16" : - (port->iotype =3D=3D UPIO_MEM32) ? "32" : "32be", - &port->mapbase); - else if (uart_iotype_legacy_io(port->iotype)) - scnprintf(address, sizeof(address), " at I/O port 0x%lx", port->iobase); + uart_get_ioinfos(port, ioinfos, sizeof(ioinfos)); =20 pr_info("%s%d%s (options '%s')\n", earlycon->name, earlycon->index, - address, device->options); + ioinfos, device->options); } =20 static int __init parse_options(struct earlycon_device *device, char *opti= ons) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_c= ore.c index 0e015477848504e37afb34c8088957083f1662c7..b9a9225d99b616a7f691a8f990f= d77ab02609012 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2002,6 +2002,7 @@ static void uart_line_info(struct seq_file *m, struct= uart_state *state) struct tty_port *port =3D &state->port; enum uart_pm_state pm_state; struct uart_port *uport; + char ioinfos[64]; char stat_buf[32]; unsigned int status; =20 @@ -2013,10 +2014,8 @@ static void uart_line_info(struct seq_file *m, struc= t uart_state *state) =20 seq_printf(m, "%u: uart:%s", uport->line, uart_type(uport)); =20 - if (uart_iotype_mmio(uport->iotype)) - seq_printf(m, " mmio:%pa", &uport->mapbase); - else if (uart_iotype_legacy_io(uport->iotype)) - seq_printf(m, " port:%08lX", uport->iobase); + uart_get_ioinfos(uport, ioinfos, sizeof(ioinfos)); + seq_printf(m, "%s", ioinfos); =20 seq_printf(m, " irq:%u", uport->irq); =20 @@ -2480,26 +2479,47 @@ int uart_resume_port(struct uart_driver *drv, struc= t uart_port *uport) } EXPORT_SYMBOL(uart_resume_port); =20 +static const char *uart_get_mmio_width(struct uart_port *port) +{ + switch (port->iotype) { + case UPIO_MEM16: + return "16"; + case UPIO_MEM32: + case UPIO_MEM32BE: + return "32be"; + case UPIO_AU: + case UPIO_MEM: + default: + return ""; + } +} + +void uart_get_ioinfos(struct uart_port *port, char *buf, size_t size) +{ + buf[0] =3D '\0'; + + if (uart_iotype_mmio(port->iotype)) { + scnprintf(buf, size, " MMIO%s:%pa", uart_get_mmio_width(port), &port->ma= pbase); + } else if (uart_iotype_legacy_io(port->iotype)) { + if (port->iotype =3D=3D UPIO_PORT) + scnprintf(buf, size, " I/O:0x%lx", port->iobase); + else if (port->iotype =3D=3D UPIO_HUB6) + scnprintf(buf, size, " I/O:0x%lx, offset 0x%x", port->iobase, port->hub= 6); + } +} +EXPORT_SYMBOL(uart_get_ioinfos); + static inline void uart_report_port(struct uart_driver *drv, struct uart_port *port) { - char address[64] =3D ""; + char ioinfos[64]; =20 - if (uart_iotype_mmio(port->iotype)) - scnprintf(address, sizeof(address), " at MMIO %pa", &port->mapbase); - else if (uart_iotype_legacy_io(port->iotype)) { - if (port->iotype =3D=3D UPIO_PORT) - scnprintf(address, sizeof(address), " at I/O 0x%lx", port->iobase); - else if (port->iotype =3D=3D UPIO_HUB6) - scnprintf(address, sizeof(address), " at I/O 0x%lx offset 0x%x", - port->iobase, port->hub6); - } + uart_get_ioinfos(port, ioinfos, sizeof(ioinfos)); =20 pr_info("%s%s%s%s (irq =3D %u, base_baud =3D %u) is a %s\n", port->dev ? dev_name(port->dev) : "", port->dev ? ": " : "", - port->name, - address, port->irq, port->uartclk / 16, uart_type(port)); + port->name, ioinfos, port->irq, port->uartclk / 16, uart_type(port)); =20 /* The magic multiplier feature is a bit obscure, so report it too. */ if (port->flags & UPF_MAGIC_MULTIPLIER) diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 626dd939c53c9f920d71aadd360ec0ea0bacce0d..1289e812b40f3d7b7a02ff1a87e= af649e71e0d2f 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -1308,6 +1308,7 @@ static inline int uart_handle_break(struct uart_port = *port) =20 int uart_get_rs485_mode(struct uart_port *port); =20 +void uart_get_ioinfos(struct uart_port *port, char *buf, size_t size); bool uart_iotype_mmio(enum uart_iotype iotype); bool uart_iotype_legacy_io(enum uart_iotype iotype); =20 --=20 2.47.3