Skip to contentSkip to conversation

tty: serial: 8250: Rework HP300 serial Kconfig logic

PATCH In review Geert Uytterhoeven 1 participant 4 messages Sep 8, 2025

Subsystems (2)
lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

cover tty: serial: 8250: Rework HP300 serial Kconfig logic

Hi all,

The HP300 serial driver has a long-standing configuration issue: when SERIAL_8250 and HP300 are enabled, but none of HPDCA and HPAPCI is built-in:

drivers/tty/serial/8250/8250_hp300.c:24:2: warning: #warning CONFIG_SERIAL_8250 defined but neither CONFIG_HPDCA nor CONFIG_HPAPCI defined, are you sure? [-Wcpp]
24 | #warning CONFIG_SERIAL_8250 defined but neither CONFIG_HPDCA nor CONFIG_HPAPCI defined, are you sure?
| ^~~~~~~

This series fixes this by reworking the Kconfig logic to make invalid configurations impossible, after moving the HP300 serial suboptions to where they really belong. It is meant as a replacement for "[PATCH]
m68k: make HPDCA and HPAPCI bools" [1], and was compile-tested only.

Anyone who can test this one real hardware? Probably we should add the following to hp300_defconfig:

    +CONFIG_SERIAL_8250=y
    +# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
    +# CONFIG_SERIAL_8250_16550A_VARIANTS is not set
    +CONFIG_SERIAL_8250_CONSOLE=y
    +CONFIG_SERIAL_8250_HPDCA=y
    +CONFIG_SERIAL_8250_HPAPCI=y

Thanks for your comments!

[1] https://lore.kernel.org/all/[email protected]

Geert Uytterhoeven (2):
tty: serial: 8250: Move HP300/400 serial Kconfig options
tty: serial: 8250: Rework HP300 serial Kconfig logic

 arch/m68k/Kconfig.devices            | 14 -------------
 drivers/tty/serial/8250/8250_hp300.c | 30 ++++++++++++----------------
 drivers/tty/serial/8250/Kconfig      | 16 ++++++++++++++-
 3 files changed, 28 insertions(+), 32 deletions(-)
Signature · 12 lines
2.43.0

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
author maintainer
#1 lore raw

PATCH 1/2 tty: serial: 8250: Move HP300/400 serial Kconfig options

The HPDCA and HPAPCI Kconfig symbols for HP300 and HP400 serial ports are clearly suboptions of the HP300 serial driver. Hence move them from arch/m68k/Kconfig.devices to drivers/tty/serial/8250/Kconfig. Add "SERIAL_8250_"-prefixes to the symbols, and "8250 "-prefixes to their descriptions, to match the style of the new location.

---
 arch/m68k/Kconfig.devices            | 14 -------------
 drivers/tty/serial/8250/8250_hp300.c | 30 ++++++++++++++--------------
 drivers/tty/serial/8250/Kconfig      | 14 +++++++++++++
 3 files changed, 29 insertions(+), 29 deletions(-)
arch/m68k/Kconfig.devices +0 -14
index e6e3efac184074c2..999ee6aaa8d29c2f 100644
@@ -104,20 +104,6 @@ config AMIGA_BUILTIN_SERIAL
 
 	  To compile this driver as a module, choose M here.
 
-config HPDCA
-	tristate "HP DCA serial support"
-	depends on DIO && SERIAL_8250
-	help
-	  If you want to use the internal "DCA" serial ports on an HP300
-	  machine, say Y here.
-
-config HPAPCI
-	tristate "HP APCI serial support"
-	depends on HP300 && SERIAL_8250
-	help
-	  If you want to use the internal "APCI" serial ports on an HP400
-	  machine, say Y here.
-
 config SERIAL_CONSOLE
 	bool "Support for serial port console"
 	depends on AMIGA_BUILTIN_SERIAL=y
drivers/tty/serial/8250/8250_hp300.c +15 -15
index 3012ea03d22ca1d5..583a86d87b559ec4 100644
@@ -20,11 +20,11 @@
 
 #include "8250.h"
 
-#if !defined(CONFIG_HPDCA) && !defined(CONFIG_HPAPCI) && !defined(CONFIG_COMPILE_TEST)
-#warning CONFIG_SERIAL_8250 defined but neither CONFIG_HPDCA nor CONFIG_HPAPCI defined, are you sure?
+#if !defined(CONFIG_SERIAL_8250_HPDCA) && !defined(CONFIG_SERIAL_8250_HPAPCI) && !defined(CONFIG_COMPILE_TEST)
+#warning CONFIG_SERIAL_8250 defined but neither CONFIG_SERIAL_8250_HPDCA nor CONFIG_SERIAL_8250_HPAPCI defined, are you sure?
 #endif
 
-#ifdef CONFIG_HPAPCI
+#ifdef CONFIG_SERIAL_8250_HPAPCI
 struct hp300_port {
 	struct hp300_port *next;	/* next port */
 	int line;			/* line (tty) number */
@@ -33,7 +33,7 @@ struct hp300_port {
 static struct hp300_port *hp300_ports;
 #endif
 
-#ifdef CONFIG_HPDCA
+#ifdef CONFIG_SERIAL_8250_HPDCA
 
 static int hpdca_init_one(struct dio_dev *d,
 					const struct dio_device_id *ent);
@@ -110,7 +110,7 @@ int __init hp300_setup_serial_console(void)
 
 	/* Check for APCI console */
 	if (scode == 256) {
-#ifdef CONFIG_HPAPCI
+#ifdef CONFIG_SERIAL_8250_HPAPCI
 		pr_info("Serial console is HP APCI 1\n");
 
 		port.uartclk = HPAPCI_BAUD_BASE * 16;
@@ -119,11 +119,11 @@ int __init hp300_setup_serial_console(void)
 		port.regshift = 2;
 		add_preferred_console("ttyS", port.line, "9600n8");
 #else
-		pr_warn("Serial console is APCI but support is disabled (CONFIG_HPAPCI)!\n");
+		pr_warn("Serial console is APCI but support is disabled (CONFIG_SERIAL_8250_HPAPCI)!\n");
 		return 0;
 #endif
 	} else {
-#ifdef CONFIG_HPDCA
+#ifdef CONFIG_SERIAL_8250_HPDCA
 		unsigned long pa = dio_scodetophysaddr(scode);
 		if (!pa)
 			return 0;
@@ -142,7 +142,7 @@ int __init hp300_setup_serial_console(void)
 		if (DIO_ID(pa + DIO_VIRADDRBASE) & 0x80)
 			add_preferred_console("ttyS", port.line, "9600n8");
 #else
-		pr_warn("Serial console is DCA but support is disabled (CONFIG_HPDCA)!\n");
+		pr_warn("Serial console is DCA but support is disabled (CONFIG_SERIAL_8250_HPDCA)!\n");
 		return 0;
 #endif
 	}
@@ -153,7 +153,7 @@ int __init hp300_setup_serial_console(void)
 }
 #endif /* CONFIG_SERIAL_8250_CONSOLE */
 
-#ifdef CONFIG_HPDCA
+#ifdef CONFIG_SERIAL_8250_HPDCA
 static int hpdca_init_one(struct dio_dev *d,
 				const struct dio_device_id *ent)
 {
@@ -203,7 +203,7 @@ static int hpdca_init_one(struct dio_dev *d,
 static int __init hp300_8250_init(void)
 {
 	static int called;
-#ifdef CONFIG_HPAPCI
+#ifdef CONFIG_SERIAL_8250_HPAPCI
 	int line;
 	unsigned long base;
 	struct uart_8250_port uart;
@@ -217,10 +217,10 @@ static int __init hp300_8250_init(void)
 	if (!MACH_IS_HP300)
 		return -ENODEV;
 
-#ifdef CONFIG_HPDCA
+#ifdef CONFIG_SERIAL_8250_HPDCA
 	dio_register_driver(&hpdca_driver);
 #endif
-#ifdef CONFIG_HPAPCI
+#ifdef CONFIG_SERIAL_8250_HPAPCI
 	if (hp300_model < HP_400) {
 		if (!num_ports)
 			return -ENODEV;
@@ -284,7 +284,7 @@ static int __init hp300_8250_init(void)
 	return 0;
 }
 
-#ifdef CONFIG_HPDCA
+#ifdef CONFIG_SERIAL_8250_HPDCA
 static void hpdca_remove_one(struct dio_dev *d)
 {
 	int line;
@@ -300,7 +300,7 @@ static void hpdca_remove_one(struct dio_dev *d)
 
 static void __exit hp300_8250_exit(void)
 {
-#ifdef CONFIG_HPAPCI
+#ifdef CONFIG_SERIAL_8250_HPAPCI
 	struct hp300_port *port, *to_free;
 
 	for (port = hp300_ports; port; ) {
@@ -312,7 +312,7 @@ static void __exit hp300_8250_exit(void)
 
 	hp300_ports = NULL;
 #endif
-#ifdef CONFIG_HPDCA
+#ifdef CONFIG_SERIAL_8250_HPDCA
 	dio_unregister_driver(&hpdca_driver);
 #endif
 }
drivers/tty/serial/8250/Kconfig +14 -0
index f64ef0819cd4e507..2696c236917afddd 100644
@@ -162,6 +162,20 @@ config SERIAL_8250_HP300
 	depends on SERIAL_8250 && HP300
 	default SERIAL_8250
 
+config SERIAL_8250_HPDCA
+	tristate "8250 HP DCA serial support"
+	depends on SERIAL_8250 && DIO
+	help
+	  If you want to use the internal "DCA" serial ports on an HP300
+	  machine, say Y here.
+
+config SERIAL_8250_HPAPCI
+	tristate "8250 HP APCI serial support"
+	depends on SERIAL_8250 && HP300
+	help
+	  If you want to use the internal "APCI" serial ports on an HP400
+	  machine, say Y here.
+
 config SERIAL_8250_CS
 	tristate "8250/16550 PCMCIA device support"
 	depends on PCMCIA && SERIAL_8250 && HAS_IOPORT
Signature · 1 line
2.43.0
author maintainer
#2 lore raw

PATCH 2/2 tty: serial: 8250: Rework HP300 serial Kconfig logic

In reply to Geert Uytterhoeven

When SERIAL_8250 and HP300 are enabled, but none of SERIAL_8250_HPDCA and SERIAL_8250_HPAPCI is built-in:

    drivers/tty/serial/8250/8250_hp300.c:24:2: warning: #warning CONFIG_SERIAL_8250 defined but neither CONFIG_SERIAL_8250_HPDCA nor CONFIG_SERIAL_8250_HPAPCI defined, are you sure? [-Wcpp]
       24 | #warning CONFIG_SERIAL_8250 defined but neither CONFIG_SERIAL_8250_HPDCA nor CONFIG_SERIAL_8250_HPAPCI defined, are you sure?
	  |  ^~~~~~~

Fix this by reworking the Kconfig logic to make such combinations impossible:
- Stop enabling SERIAL_8250_HP300 by default when both SERIAL_8250 and HP300 are enabled,
- Instead, let SERIAL_8250_HPDCA and SERIAL_8250_HPAPCI select

    SERIAL_8250_HP300.

Note that since commit 0cff260a42c051ee ("[SERIAL] Allow 8250 PCI, PNP, GSC and HP300 support to be disabled"), the warning message is wrong, and should have been s/CONFIG_SERIAL_8250/CONFIG_SERIAL_8250_HP300/.

---
 drivers/tty/serial/8250/8250_hp300.c | 4 ----
 drivers/tty/serial/8250/Kconfig      | 4 ++--
 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/tty/serial/8250/8250_hp300.c +0 -4
index 583a86d87b559ec4..30e7d09eed8ae5bf 100644
@@ -20,10 +20,6 @@
 
 #include "8250.h"
 
-#if !defined(CONFIG_SERIAL_8250_HPDCA) && !defined(CONFIG_SERIAL_8250_HPAPCI) && !defined(CONFIG_COMPILE_TEST)
-#warning CONFIG_SERIAL_8250 defined but neither CONFIG_SERIAL_8250_HPDCA nor CONFIG_SERIAL_8250_HPAPCI defined, are you sure?
-#endif
-
 #ifdef CONFIG_SERIAL_8250_HPAPCI
 struct hp300_port {
 	struct hp300_port *next;	/* next port */
drivers/tty/serial/8250/Kconfig +2 -2
index 2696c236917afddd..9b5df423606bfb80 100644
@@ -159,12 +159,11 @@ config SERIAL_8250_EXAR
 
 config SERIAL_8250_HP300
 	tristate
-	depends on SERIAL_8250 && HP300
-	default SERIAL_8250
 
 config SERIAL_8250_HPDCA
 	tristate "8250 HP DCA serial support"
 	depends on SERIAL_8250 && DIO
+	select SERIAL_8250_HP300
 	help
 	  If you want to use the internal "DCA" serial ports on an HP300
 	  machine, say Y here.
@@ -172,6 +171,7 @@ config SERIAL_8250_HPDCA
 config SERIAL_8250_HPAPCI
 	tristate "8250 HP APCI serial support"
 	depends on SERIAL_8250 && HP300
+	select SERIAL_8250_HP300
 	help
 	  If you want to use the internal "APCI" serial ports on an HP400
 	  machine, say Y here.
Signature · 1 line
2.43.0
author maintainer
#3 lore raw
In reply to Geert Uytterhoeven
Quoted 8 lines · Geert Uytterhoeven

The HP300 serial driver has a long-standing configuration issue: when SERIAL_8250 and HP300 are enabled, but none of HPDCA and HPAPCI is built-in:

drivers/tty/serial/8250/8250_hp300.c:24:2: warning: #warning CONFIG_SERIAL_8250 defined but neither CONFIG_HPDCA nor CONFIG_HPAPCI defined, are you sure? [-Wcpp]
24 | #warning CONFIG_SERIAL_8250 defined but neither CONFIG_HPDCA nor CONFIG_HPAPCI defined, are you sure?
| ^~~~~~~

Quoted 7 lines

This series fixes this by reworking the Kconfig logic to make invalid configurations impossible, after moving the HP300 serial suboptions to where they really belong. It is meant as a replacement for "[PATCH]
m68k: make HPDCA and HPAPCI bools" [1], and was compile-tested only.

Anyone who can test this one real hardware? Probably we should add the following to hp300_defconfig:

Scrap it, this doesn't work for the modular case, due to the #ifdefs in the driver, which should be converted to #if IS_REACHABLE()...

Sorry for the noise...

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds