[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1401353326-14148-5-git-send-email-daniel.thompson@linaro.org>
Date: Thu, 29 May 2014 09:48:46 +0100
From: Daniel Thompson <daniel.thompson@...aro.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Daniel Thompson <daniel.thompson@...aro.org>,
linux-serial@...r.kernel.org, patches@...aro.org,
linaro-kernel@...ts.linaro.org, linux-kernel@...r.kernel.org,
John Stultz <john.stultz@...aro.org>,
Anton Vorontsov <anton.vorontsov@...aro.org>,
Colin Cross <ccross@...roid.com>, kernel-team@...roid.com,
Jason Wessel <jason.wessel@...driver.com>,
kgdb-bugreport@...ts.sourceforge.net, Jiri Slaby <jslaby@...e.cz>,
Dirk Behme <dirk.behme@...bosch.com>
Subject: [PATCH tty-next v2 4/4] serial: kgdb_nmi: Improve console integration with KDB I/O
kgdb_nmi_tty_enabled is used for two unrelated purposes, namely to
suppress normal TTY input handling and to suppress console output
(although it has no effect at all on TTY output). A much better way to
handle muting the console is to not have to mute it in the first place!
That's what this patch does.
Signed-off-by: Daniel Thompson <daniel.thompson@...aro.org>
---
drivers/tty/serial/kgdb_nmi.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/kgdb_nmi.c b/drivers/tty/serial/kgdb_nmi.c
index 20d21d0..cfadf29 100644
--- a/drivers/tty/serial/kgdb_nmi.c
+++ b/drivers/tty/serial/kgdb_nmi.c
@@ -44,13 +44,22 @@ MODULE_PARM_DESC(magic, "magic sequence to enter NMI debugger (default $3#33)");
static bool kgdb_nmi_tty_enabled;
+static int kgdb_nmi_console_setup(struct console *co, char *options)
+{
+ /* The NMI console uses the dbg_io_ops to issue console messages. To
+ * avoid duplicate messages during kdb sessions we must inform kdb's
+ * I/O utilities that messages sent to the console will automatically
+ * be displayed on the dbg_io.
+ */
+ dbg_io_ops->is_console = true;
+
+ return 0;
+}
+
static void kgdb_nmi_console_write(struct console *co, const char *s, uint c)
{
int i;
- if (!kgdb_nmi_tty_enabled || atomic_read(&kgdb_active) >= 0)
- return;
-
for (i = 0; i < c; i++)
dbg_io_ops->write_char(s[i]);
}
@@ -65,6 +74,7 @@ static struct tty_driver *kgdb_nmi_console_device(struct console *co, int *idx)
static struct console kgdb_nmi_console = {
.name = "ttyNMI",
+ .setup = kgdb_nmi_console_setup,
.write = kgdb_nmi_console_write,
.device = kgdb_nmi_console_device,
.flags = CON_PRINTBUFFER | CON_ANYTIME | CON_ENABLED,
--
1.9.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists