From patchwork Tue Feb 26 16:11:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 223311 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 641362C0090 for ; Wed, 27 Feb 2013 03:15:02 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E48124A0FD; Tue, 26 Feb 2013 17:14:26 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XnFRoDNnNACV; Tue, 26 Feb 2013 17:14:26 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CBF474A137; Tue, 26 Feb 2013 17:13:24 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 55A074A0C0 for ; Tue, 26 Feb 2013 17:13:08 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7n0rvDcCZjPv for ; Tue, 26 Feb 2013 17:13:07 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ye0-f201.google.com (mail-ye0-f201.google.com [209.85.213.201]) by theia.denx.de (Postfix) with ESMTPS id BD6394A0C2 for ; Tue, 26 Feb 2013 17:13:02 +0100 (CET) Received: by mail-ye0-f201.google.com with SMTP id m12so253095yen.2 for ; Tue, 26 Feb 2013 08:13:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=CRBDs+48nQuNxAQi4OknuAqbCALR/x7plwlq9SUs0ws=; b=Rk59vJJ6CfpUb4ASb+7DUlS2RjoxBfIKmHXSKKXgtle/yM+s/Kkzglft6hOlCa46XE bm/RjDz+RiPyxZ58WVbSBXbkZsWslTkGtpoO11ympXtVgIxZNx9Ept8am5FrniNS8RtP KFZxN5bQ0PpCtojTia0u9mGhjGi7dLBEugHSFNRIQquDbyUYKTiR5hkUQ5bGJ1208zz/ FQlEAyE31C4pe9K058yc2G+ZA2x1WqCqYAb1C6HNTTOXBTG0q4XblfU1KN949VSydt7Y a3WYS3TRiQzTqxKvNjC8vNUeKA7d/C/TnFDrpoQoiHYascYhmOUzddoNWJJ2JYtfE+ao Vpqg== X-Received: by 10.236.112.84 with SMTP id x60mr9809257yhg.9.1361895181810; Tue, 26 Feb 2013 08:13:01 -0800 (PST) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id i65si64678yhh.5.2013.02.26.08.13.01 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Tue, 26 Feb 2013 08:13:01 -0800 (PST) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 9CEE05A4173; Tue, 26 Feb 2013 08:13:01 -0800 (PST) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 7837C16051A; Tue, 26 Feb 2013 08:13:01 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Date: Tue, 26 Feb 2013 08:11:09 -0800 Message-Id: <1361895069-7343-17-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.8.1.3 In-Reply-To: <1361895069-7343-1-git-send-email-sjg@chromium.org> References: <1361895069-7343-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQlbYsqF/aYi8sT1RKHW2OkIYYJHnsXnwdQ7tRSrEPcbcE+yNfowIoxIOsO0NGifDpO8pcUz2Uo82hQi6T4FC2oGDEvc2bpAMq6chOHiD0nZ6bNspABxIxoHF4aWgDQtyYZxEMGlVss4Ui+fAFIClv385AS60Q1zhUhYtTE/Ng9ST5+xTny3DjHu58npao0kdwQqfunV Cc: David Hendrix , Graeme Russ , Joe Hershberger , Tom Rini , Vadim Bendebury Subject: [U-Boot] [PATCH v3 16/16] main: Add debug_bootkeys to avoid #ifdefs X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Define a simple debug condition at the top of the file, to avoid using lots of #ifdefs later on. Signed-off-by: Simon Glass Reviewed-by: Joe Hershberger --- Changes in v3: None Changes in v2: None common/main.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/common/main.c b/common/main.c index 8ea9475..830800b 100644 --- a/common/main.c +++ b/common/main.c @@ -54,6 +54,11 @@ void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progre #define debug_parser(fmt, args...) \ debug_cond(DEBUG_PARSER, fmt, ##args) +#ifndef DEBUG_BOOTKEYS +#define DEBUG_BOOTKEYS 0 +#endif +#define debug_bootkeys(fmt, args...) \ + debug_cond(DEBUG_BOOTKEYS, fmt, ##args) char console_buffer[CONFIG_SYS_CBSIZE + 1]; /* console I/O buffer */ @@ -115,11 +120,9 @@ static int abortboot_keyed(int bootdelay) presskey_max = presskey_max > delaykey[i].len ? presskey_max : delaykey[i].len; -# if DEBUG_BOOTKEYS - printf("%s key:<%s>\n", + debug_bootkeys("%s key:<%s>\n", delaykey[i].retry ? "delay" : "stop", delaykey[i].str ? delaykey[i].str : "NULL"); -# endif } /* In order to keep up with incoming data, check timeout only @@ -144,10 +147,8 @@ static int abortboot_keyed(int bootdelay) memcmp (presskey + presskey_len - delaykey[i].len, delaykey[i].str, delaykey[i].len) == 0) { -# if DEBUG_BOOTKEYS - printf("got %skey\n", - delaykey[i].retry ? "delay" : "stop"); -# endif + debug_bootkeys("got %skey\n", + delaykey[i].retry ? "delay" : "stop"); /* don't retry auto boot? */ if (autoconf_boot_retry_time() && @@ -158,10 +159,8 @@ static int abortboot_keyed(int bootdelay) } } while (!abort && get_ticks() <= etime); -# if DEBUG_BOOTKEYS if (!abort) - puts("key timeout\n"); -# endif + debug_bootkeys("key timeout\n"); if (autoconf_silent_console() && abort) gd->flags &= ~GD_FLG_SILENT;