Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759187Ab2EKGeK (ORCPT ); Fri, 11 May 2012 02:34:10 -0400 Received: from terminus.zytor.com ([198.137.202.10]:57118 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752730Ab2EKGeH (ORCPT ); Fri, 11 May 2012 02:34:07 -0400 Date: Thu, 10 May 2012 23:33:50 -0700 From: tip-bot for Namhyung Kim Message-ID: Cc: acme@redhat.com, linux-kernel@vger.kernel.org, paulus@samba.org, mingo@redhat.com, hpa@zytor.com, mingo@kernel.org, a.p.zijlstra@chello.nl, penberg@kernel.org, namhyung.kim@lge.com, namhyung@gmail.com, tglx@linutronix.de Reply-To: mingo@kernel.org, hpa@zytor.com, mingo@redhat.com, paulus@samba.org, linux-kernel@vger.kernel.org, acme@redhat.com, a.p.zijlstra@chello.nl, penberg@kernel.org, namhyung.kim@lge.com, tglx@linutronix.de, namhyung@gmail.com In-Reply-To: <1335761711-31403-2-git-send-email-namhyung.kim@lge.com> References: <1335761711-31403-2-git-send-email-namhyung.kim@lge.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf ui: Make setup_browser() generic Git-Commit-ID: ca09b2e1b307724666577859eb460ac6d4c67330 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.6 (terminus.zytor.com [127.0.0.1]); Thu, 10 May 2012 23:33:56 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2899 Lines: 110 Commit-ID: ca09b2e1b307724666577859eb460ac6d4c67330 Gitweb: http://git.kernel.org/tip/ca09b2e1b307724666577859eb460ac6d4c67330 Author: Namhyung Kim AuthorDate: Mon, 30 Apr 2012 13:55:05 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 2 May 2012 16:17:20 -0300 perf ui: Make setup_browser() generic The setup_browser contained newt-related codes in it. As gtk front-end added recently, it should be more generic to handle both cases properly. So move newt codes to the ui__init() for now. Signed-off-by: Namhyung Kim Acked-by: Pekka Enberg Cc: Ingo Molnar Cc: Namhyung Kim Cc: Paul Mackerras Cc: Pekka Enberg Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1335761711-31403-2-git-send-email-namhyung.kim@lge.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/ui/setup.c | 44 +++++++++++++++++++++++++------------------- 1 files changed, 25 insertions(+), 19 deletions(-) diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c index 85a69fa..becdcd0 100644 --- a/tools/perf/ui/setup.c +++ b/tools/perf/ui/setup.c @@ -93,14 +93,37 @@ static void newt_suspend(void *d __used) newtResume(); } +static void ui__exit(void); + +static void ui__signal(int sig) +{ + ui__exit(); + psignal(sig, "perf"); + exit(0); +} + static int ui__init(void) { - int err = SLkp_init(); + int err; - if (err < 0) + newtInit(); + err = SLkp_init(); + if (err < 0) { + pr_err("TUI initialization failed.\n"); goto out; + } SLkp_define_keysym((char *)"^(kB)", SL_KEY_UNTAB); + + newtSetSuspendCallback(newt_suspend, NULL); + ui_helpline__init(); + ui_browser__init(); + + signal(SIGSEGV, ui__signal); + signal(SIGFPE, ui__signal); + signal(SIGINT, ui__signal); + signal(SIGQUIT, ui__signal); + signal(SIGTERM, ui__signal); out: return err; } @@ -113,13 +136,6 @@ static void ui__exit(void) SLang_reset_tty(); } -static void ui__signal(int sig) -{ - ui__exit(); - psignal(sig, "perf"); - exit(0); -} - void setup_browser(bool fallback_to_pager) { if (!isatty(1) || !use_browser || dump_trace) { @@ -130,17 +146,7 @@ void setup_browser(bool fallback_to_pager) } use_browser = 1; - newtInit(); ui__init(); - newtSetSuspendCallback(newt_suspend, NULL); - ui_helpline__init(); - ui_browser__init(); - - signal(SIGSEGV, ui__signal); - signal(SIGFPE, ui__signal); - signal(SIGINT, ui__signal); - signal(SIGQUIT, ui__signal); - signal(SIGTERM, ui__signal); } void exit_browser(bool wait_for_ok) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/