Skip to content

Commit

Permalink
tty: serial: meson: enable console as module
Browse files Browse the repository at this point in the history
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().

Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Link: https://lore.kernel.org/r/20201211005744.12855-1-khilman@baylibre.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Kevin Hilman authored and Greg Kroah-Hartman committed Dec 11, 2020
1 parent d96f04d commit 87a0b9f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/tty/serial/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion drivers/tty/serial/meson_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 87a0b9f

Please sign in to comment.