lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250812054819.3748649-3-quic_zongjian@quicinc.com>
Date: Tue, 12 Aug 2025 13:48:19 +0800
From: Zong Jiang <quic_zongjian@...cinc.com>
To: <gregkh@...uxfoundation.org>, <linux-serial@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
CC: <quic_ztu@...cinc.com>, <quic_anupkulk@...cinc.com>,
        <quic_msavaliy@...cinc.com>, <quic_vdadhani@...cinc.com>,
        Zong Jiang
	<quic_zongjian@...cinc.com>
Subject: [PATCH 2/2] serial: qcom-geni: Make UART port count configurable via Kconfig

Replace the hardcoded GENI_UART_PORTS macro with a new Kconfig option
SERIAL_QCOM_GENI_UART_PORTS to allow platforms to configure the maximum
number of UART ports supported by the driver at build time.

This improves flexibility for platforms that require more than the
previously fixed number of UART ports, and avoids unnecessary allocation
for unused ports.

Signed-off-by: Zong Jiang <quic_zongjian@...cinc.com>
---
 drivers/tty/serial/Kconfig            | 8 ++++++++
 drivers/tty/serial/qcom_geni_serial.c | 5 ++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 44427415a80d..e661f5951f55 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -928,6 +928,14 @@ config SERIAL_QCOM_GENI_CONSOLE
 	  Serial console driver for Qualcomm Technologies Inc's GENI based
 	  QUP hardware.
 
+config SERIAL_QCOM_GENI_UART_PORTS
+	int "Maximum number of GENI UART ports"
+	depends on SERIAL_QCOM_GENI
+	default "8"
+	help
+	  Set this to the maximum number of serial ports you want the driver
+	  to support.
+
 config SERIAL_VT8500
 	bool "VIA VT8500 on-chip serial port support"
 	depends on ARCH_VT8500 || COMPILE_TEST
diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index 080c18ddbdde..9c7b1cea7cfe 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -77,7 +77,6 @@
 #define STALE_TIMEOUT			16
 #define DEFAULT_BITS_PER_CHAR		10
 #define GENI_UART_CONS_PORTS		1
-#define GENI_UART_PORTS			3
 #define DEF_FIFO_DEPTH_WORDS		16
 #define DEF_TX_WM			2
 #define DEF_FIFO_WIDTH_BITS		32
@@ -261,7 +260,7 @@ static const char *qcom_geni_serial_get_type(struct uart_port *uport)
 static struct qcom_geni_serial_port *get_port_from_line(int line, bool console, struct device *dev)
 {
 	struct qcom_geni_serial_port *port;
-	int nr_ports = console ? GENI_UART_CONS_PORTS : GENI_UART_PORTS;
+	int nr_ports = console ? GENI_UART_CONS_PORTS : CONFIG_SERIAL_QCOM_GENI_UART_PORTS;
 
 	if (console) {
 		if (line < 0 || line >= nr_ports)
@@ -1652,7 +1651,7 @@ static struct uart_driver qcom_geni_uart_driver = {
 	.owner = THIS_MODULE,
 	.driver_name = "qcom_geni_uart",
 	.dev_name = "ttyHS",
-	.nr =  GENI_UART_PORTS,
+	.nr = CONFIG_SERIAL_QCOM_GENI_UART_PORTS,
 };
 
 static int geni_serial_resources_on(struct uart_port *uport)
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ