public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] tty: serial: 8250: Rework HP300 serial Kconfig logic
@ 2025-09-08  9:45 Geert Uytterhoeven
  2025-09-08  9:45 ` [PATCH 1/2] tty: serial: 8250: Move HP300/400 serial Kconfig options Geert Uytterhoeven
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2025-09-08  9:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Philip Blundell, Kars de Jong
  Cc: linux-m68k, linux-serial, linux-kernel, Geert Uytterhoeven

	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/20250822104208.751191-1-jirislaby@kernel.org

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(-)

-- 
2.43.0

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

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

* [PATCH 1/2] tty: serial: 8250: Move HP300/400 serial Kconfig options
  2025-09-08  9:45 [PATCH 0/2] tty: serial: 8250: Rework HP300 serial Kconfig logic Geert Uytterhoeven
@ 2025-09-08  9:45 ` Geert Uytterhoeven
  2025-09-08  9:45 ` [PATCH 2/2] tty: serial: 8250: Rework HP300 serial Kconfig logic Geert Uytterhoeven
  2025-09-08 10:07 ` [PATCH 0/2] " Geert Uytterhoeven
  2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2025-09-08  9:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Philip Blundell, Kars de Jong
  Cc: linux-m68k, linux-serial, linux-kernel, Geert Uytterhoeven

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.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 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(-)

diff --git a/arch/m68k/Kconfig.devices b/arch/m68k/Kconfig.devices
index e6e3efac184074c2..999ee6aaa8d29c2f 100644
--- a/arch/m68k/Kconfig.devices
+++ b/arch/m68k/Kconfig.devices
@@ -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
diff --git a/drivers/tty/serial/8250/8250_hp300.c b/drivers/tty/serial/8250/8250_hp300.c
index 3012ea03d22ca1d5..583a86d87b559ec4 100644
--- a/drivers/tty/serial/8250/8250_hp300.c
+++ b/drivers/tty/serial/8250/8250_hp300.c
@@ -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
 }
diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig
index f64ef0819cd4e507..2696c236917afddd 100644
--- a/drivers/tty/serial/8250/Kconfig
+++ b/drivers/tty/serial/8250/Kconfig
@@ -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
-- 
2.43.0


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

* [PATCH 2/2] tty: serial: 8250: Rework HP300 serial Kconfig logic
  2025-09-08  9:45 [PATCH 0/2] tty: serial: 8250: Rework HP300 serial Kconfig logic Geert Uytterhoeven
  2025-09-08  9:45 ` [PATCH 1/2] tty: serial: 8250: Move HP300/400 serial Kconfig options Geert Uytterhoeven
@ 2025-09-08  9:45 ` Geert Uytterhoeven
  2025-09-08 10:07 ` [PATCH 0/2] " Geert Uytterhoeven
  2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2025-09-08  9:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Philip Blundell, Kars de Jong
  Cc: linux-m68k, linux-serial, linux-kernel, 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/.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/tty/serial/8250/8250_hp300.c | 4 ----
 drivers/tty/serial/8250/Kconfig      | 4 ++--
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_hp300.c b/drivers/tty/serial/8250/8250_hp300.c
index 583a86d87b559ec4..30e7d09eed8ae5bf 100644
--- a/drivers/tty/serial/8250/8250_hp300.c
+++ b/drivers/tty/serial/8250/8250_hp300.c
@@ -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 */
diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig
index 2696c236917afddd..9b5df423606bfb80 100644
--- a/drivers/tty/serial/8250/Kconfig
+++ b/drivers/tty/serial/8250/Kconfig
@@ -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.
-- 
2.43.0


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

* Re: [PATCH 0/2] tty: serial: 8250: Rework HP300 serial Kconfig logic
  2025-09-08  9:45 [PATCH 0/2] tty: serial: 8250: Rework HP300 serial Kconfig logic Geert Uytterhoeven
  2025-09-08  9:45 ` [PATCH 1/2] tty: serial: 8250: Move HP300/400 serial Kconfig options Geert Uytterhoeven
  2025-09-08  9:45 ` [PATCH 2/2] tty: serial: 8250: Rework HP300 serial Kconfig logic Geert Uytterhoeven
@ 2025-09-08 10:07 ` Geert Uytterhoeven
  2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2025-09-08 10:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Philip Blundell, Kars de Jong
  Cc: linux-m68k, linux-serial, linux-kernel

On Mon, 8 Sept 2025 at 11:45, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> 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:

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

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

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

end of thread, other threads:[~2025-09-08 10:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-08  9:45 [PATCH 0/2] tty: serial: 8250: Rework HP300 serial Kconfig logic Geert Uytterhoeven
2025-09-08  9:45 ` [PATCH 1/2] tty: serial: 8250: Move HP300/400 serial Kconfig options Geert Uytterhoeven
2025-09-08  9:45 ` [PATCH 2/2] tty: serial: 8250: Rework HP300 serial Kconfig logic Geert Uytterhoeven
2025-09-08 10:07 ` [PATCH 0/2] " Geert Uytterhoeven

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