archive mirror
 help / color / mirror / Atom feed
From: Douglas Anderson <>
To: Stephen Rothwell <>,
	Daniel Thompson <>,
	Jason Wessel <>
	Douglas Anderson <>,
	Greg Kroah-Hartman <>,
	Jiri Slaby <>,,,
Subject: [PATCH] kgdboc: Disable all the early code when kgdboc is a module
Date: Tue, 19 May 2020 08:44:02 -0700	[thread overview]
Message-ID: <20200519084345.1.I91670accc8a5ddabab227eb63bb4ad3e2e9d2b58@changeid> (raw)

When kgdboc is compiled as a module all of the "ekgdboc" and
"kgdb_earlycon" code isn't useful and, in fact, breaks compilation.
This is because early_param() isn't defined for modules and that's how
this code gets configured.

It turns out that this was broken by commit eae3e19ca930 ("kgdboc:
Remove useless #ifdef CONFIG_KGDB_SERIAL_CONSOLE in kgdboc") and then
made worse by commit 220995622da5 ("kgdboc: Add kgdboc_earlycon to
support early kgdb using boot consoles").  I guess the #ifdef wasn't
so useless, even if it wasn't obvious why it was useful.  When kgdboc
was compiled as a module only "CONFIG_KGDB_SERIAL_CONSOLE_MODULE" was
defined, not "CONFIG_KGDB_SERIAL_CONSOLE".  That meant that the old

Let's basically do the same thing that the old code (pre-removal of
the #ifdef) did but use "IS_BUILTIN(CONFIG_KGDB_SERIAL_CONSOLE)" to
make it more obvious what the point of the check is.  We'll fix
kgdboc_earlycon in a similar way.

Fixes: 220995622da5 ("kgdboc: Add kgdboc_earlycon to support early kgdb using boot consoles")
Fixes: eae3e19ca930 ("kgdboc: Remove useless #ifdef CONFIG_KGDB_SERIAL_CONSOLE in kgdboc")
Reported-by: Stephen Rothwell <>
Signed-off-by: Douglas Anderson <>

 drivers/tty/serial/kgdboc.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c
index 34b5e91dd245..fa6f7a3e73b9 100644
--- a/drivers/tty/serial/kgdboc.c
+++ b/drivers/tty/serial/kgdboc.c
@@ -43,9 +43,11 @@ static int			kgdb_tty_line;
 static struct platform_device *kgdboc_pdev;
 static struct kgdb_io		kgdboc_earlycon_io_ops;
 static struct console		*earlycon;
 static int                      (*earlycon_orig_exit)(struct console *con);
 static int kgdboc_reset_connect(struct input_handler *handler,
@@ -140,10 +142,19 @@ static void kgdboc_unregister_kbd(void)
 #define kgdboc_restore_input()
 #endif /* ! CONFIG_KDB_KEYBOARD */
-static void cleanup_kgdboc(void)
+static void cleanup_earlycon(void)
 	if (earlycon)
+static inline void cleanup_earlycon(void) { }
+static void cleanup_kgdboc(void)
+	cleanup_earlycon();
 	if (configured != 1)
@@ -388,6 +399,7 @@ static struct kgdb_io kgdboc_io_ops = {
 	.post_exception		= kgdboc_post_exp_handler,
 static int kgdboc_option_setup(char *opt)
 	if (!opt) {
@@ -544,6 +556,7 @@ static int __init kgdboc_earlycon_init(char *opt)
 early_param("kgdboc_earlycon", kgdboc_earlycon_init);

             reply	other threads:[~2020-05-19 15:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 15:44 Douglas Anderson [this message]
2020-05-19 19:14 ` Daniel Thompson
2020-05-20 10:34 ` Daniel Thompson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200519084345.1.I91670accc8a5ddabab227eb63bb4ad3e2e9d2b58@changeid \ \ \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH] kgdboc: Disable all the early code when kgdboc is a module' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).