Skip to contentSkip to conversation

tty: serial: meson: enable console as module

PATCH In review Kevin Hilman 2 participants 2 messages Dec 11, 2020

Subsystems (2)
lore
Share & tools
lore

Kevin Hilman

author maintainer
#0 lore raw

PATCH 1/1 tty: serial: meson: enable console as module

Enable serial driver to be built as a module. To do so, init the console support on driver/module load instead of using console_initcall().

---
Yes, I'm well aware that having the serial console as a module makes devices hard to debug, so I'm not changing any default behavior. The goal is just to enable building as a module for environments where serial debug is not available or needed.

 drivers/tty/serial/Kconfig      | 2 +-
 drivers/tty/serial/meson_uart.c | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/tty/serial/Kconfig +1 -1
index 1044fc387691..c3fa78e63357 100644
@@ -206,7 +206,7 @@ config SERIAL_MESON
 
 config SERIAL_MESON_CONSOLE
 	bool "Support for console on meson"
-	depends on SERIAL_MESON=y
+	depends on SERIAL_MESON
 	select SERIAL_CORE_CONSOLE
 	select SERIAL_EARLYCON
 	help
drivers/tty/serial/meson_uart.c +7 -1
index d2c08b760f83..69eeef9edfa5 100644
@@ -604,7 +604,6 @@ static int __init meson_serial_console_init(void)
 	register_console(&meson_serial_console);
 	return 0;
 }
-console_initcall(meson_serial_console_init);
 
 static void meson_serial_early_console_write(struct console *co,
 					     const char *s,
@@ -634,6 +633,9 @@ OF_EARLYCON_DECLARE(meson, "amlogic,meson-ao-uart",
 
 #define MESON_SERIAL_CONSOLE	(&meson_serial_console)
 #else
+static int __init meson_serial_console_init(void) {
+	return 0;
+}
 #define MESON_SERIAL_CONSOLE	NULL
 #endif
 
@@ -824,6 +826,10 @@ static int __init meson_uart_init(void)
 {
 	int ret;
 
+	ret = meson_serial_console_init();
+	if (ret)
+		return ret;
+	
 	ret = uart_register_driver(&meson_uart_driver);
 	if (ret)
 		return ret;
Signature · 7 lines
2.29.2


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
#1 lore raw
Quoted 10 lines · Kevin Hilman

Enable serial driver to be built as a module. To do so, init the console support on driver/module load instead of using console_initcall().

---
Yes, I'm well aware that having the serial console as a module makes devices hard to debug, so I'm not changing any default behavior. The goal is just to enable building as a module for environments where serial debug is not available or needed.

It's a good goal, I'm all for it, thanks for the patch!

greg k-h

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic