From patchwork Wed May 14 14:55:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 30169 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f69.google.com (mail-qg0-f69.google.com [209.85.192.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D7B362055D for ; Wed, 14 May 2014 14:56:04 +0000 (UTC) Received: by mail-qg0-f69.google.com with SMTP id f51sf4093576qge.0 for ; Wed, 14 May 2014 07:56:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=gTh0Q0sAJcfodQEL0w9sfe9AIV9gMPoQcx4COnvrVJg=; b=feh3C+/gQ2MLuhxLMgjUHA+tNgGxebneo6vz5NInpKN/lTVk87Ewvfph9aRq95URW0 OzwMuOVWo2SCfbf37J2jl2CeCT7ejRy6KmmGGTdCBk8+vOfz1M+KSmbq8jL8JP7MK7Tw 3l9nmgMTi3hZ8afBsb/NI4wrrDo1OCQjJoYFva8iDFRJBfuvxjBxK8sSxhCZFZRy+jd8 kVMS5DmnrLaeP/6lf2pYk7g6CpgNgFyiinFLZybg5adf1FO8Egz9+r8b/0qCRwI9M4ZV Urfm/3ys6DqfIJU2QNSVAUw17FYF964g4caYJMsNcijgpcJvI4FHSNNCnijuTJd/jUQF aOOw== X-Gm-Message-State: ALoCoQmkX2AYLyaj1LuRtQIG979KzBHVHBuc5fb3FG3Da16S8Ph03veIaEXP9zon7F7S//DM7tWj X-Received: by 10.236.197.39 with SMTP id s27mr1633522yhn.36.1400079364695; Wed, 14 May 2014 07:56:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.28.4 with SMTP id 4ls2382391qgy.39.gmail; Wed, 14 May 2014 07:56:04 -0700 (PDT) X-Received: by 10.58.95.102 with SMTP id dj6mr199489veb.68.1400079364638; Wed, 14 May 2014 07:56:04 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id jb7si370591vec.35.2014.05.14.07.56.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 May 2014 07:56:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id lf12so2609275vcb.29 for ; Wed, 14 May 2014 07:56:04 -0700 (PDT) X-Received: by 10.58.198.36 with SMTP id iz4mr624125vec.53.1400079364572; Wed, 14 May 2014 07:56:04 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp246944vcb; Wed, 14 May 2014 07:56:04 -0700 (PDT) X-Received: by 10.180.160.166 with SMTP id xl6mr3924949wib.42.1400079363708; Wed, 14 May 2014 07:56:03 -0700 (PDT) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx.google.com with ESMTPS id vr6si774584wjc.146.2014.05.14.07.56.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 May 2014 07:56:03 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 74.125.82.182 as permitted sender) client-ip=74.125.82.182; Received: by mail-we0-f182.google.com with SMTP id t60so2071568wes.13 for ; Wed, 14 May 2014 07:56:03 -0700 (PDT) X-Received: by 10.180.36.212 with SMTP id s20mr26550542wij.18.1400079363115; Wed, 14 May 2014 07:56:03 -0700 (PDT) Received: from sundance.lan (cpc4-aztw19-0-0-cust157.18-1.cable.virginm.net. [82.33.25.158]) by mx.google.com with ESMTPSA id ho2sm4412630wib.15.2014.05.14.07.56.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 May 2014 07:56:02 -0700 (PDT) From: Daniel Thompson To: Greg Kroah-Hartman , linux-serial@vger.kernel.org Cc: patches@linaro.org, linaro-kernel@lists.linaro.org, Daniel Thompson , linux-kernel@vger.kernel.org, John Stultz , Anton Vorontsov , Colin Cross , kernel-team@android.com, Jason Wessel , kgdb-bugreport@lists.sourceforge.net, Jiri Slaby Subject: [PATCH 4/4] serial: kgdb_nmi: Improve console integration with KDB I/O Date: Wed, 14 May 2014 15:55:35 +0100 Message-Id: <1400079335-32125-5-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1400079335-32125-1-git-send-email-daniel.thompson@linaro.org> References: <1400079335-32125-1-git-send-email-daniel.thompson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.thompson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- 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,