From patchwork Sun Feb 24 17:26:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 222788 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 CBE812C0297 for ; Mon, 25 Feb 2013 04:32:29 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 425324A16C; Sun, 24 Feb 2013 18:32:28 +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 wxhgAxp4VTdE; Sun, 24 Feb 2013 18:32:27 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A7AB74A097; Sun, 24 Feb 2013 18:32:26 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0D3CB4A163 for ; Sun, 24 Feb 2013 18:30:16 +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 r4FqcXXa6VgV for ; Sun, 24 Feb 2013 18:30: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-f202.google.com (mail-ye0-f202.google.com [209.85.213.202]) by theia.denx.de (Postfix) with ESMTPS id 30A994A152 for ; Sun, 24 Feb 2013 18:30:03 +0100 (CET) Received: by mail-ye0-f202.google.com with SMTP id q5so34285yen.1 for ; Sun, 24 Feb 2013 09:30: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=wdzMbZ/X1efrmG9XktRe22C/NqJzrVr31sUhUX6aa0Y=; b=BOZjVT9n/5TKUf3bZrfyPI+53ckQ7ja6pXLF/KYCR5BcJnuMld5N6J9sUjILwZo0m0 qSmzthXZ3wXa/h6zPvS/XzpsgzsXNQo2QHkNujYBq4KUbvtj1Xy10pOJM6hficv3pVO1 kC21SbycE2xrGNfBzpgW3IzS4qaBmnzKXMQq8F2CGmljJM/epvDTWEkEWhn8JqrO/CV8 Ka3tWwcP4wQbUes5IryxgvVN7B8N0PItx5myoE7uSqdgE2zCy0Y3iX0+LZ4dhtQzL8cv JqVi6nqpOUfYQMO7uP0VBuGvIO7TYslypiZx4vdtPuLg9Lsgu9LjaTLoL7dLeXwS85PJ LjRQ== X-Received: by 10.236.118.137 with SMTP id l9mr5229132yhh.5.1361727001153; Sun, 24 Feb 2013 09:30:01 -0800 (PST) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id i65si746178yhh.5.2013.02.24.09.30.01 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Sun, 24 Feb 2013 09:30:01 -0800 (PST) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 0414E31C224; Sun, 24 Feb 2013 09:30:01 -0800 (PST) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id DA49F16097F; Sun, 24 Feb 2013 09:30:00 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Date: Sun, 24 Feb 2013 09:26:13 -0800 Message-Id: <1361726773-18639-16-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.8.1.3 In-Reply-To: <1361726773-18639-1-git-send-email-sjg@chromium.org> References: <1361726773-18639-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQlYpUwV7rcGqik9W4Rjmm1LgNTtJ8KeGyFd7aNjfcSBccHtEYwhhGfvUhGa7Wx6psv90VL91GvTjhYRYsJEsMpK7FY+6p16SyD5/IkPaK74O8sTna1Yz1hEelpBsW9DqsJ/PVbE5vulLP3uMu21ZMVclp08YxqX1xN4y6gsxqCEi2JSS9XPyj8CgGjsIFc6YpktjcJe Cc: David Hendrix , Graeme Russ , Joe Hershberger , Tom Rini , Vadim Bendebury Subject: [U-Boot] [RFC PATCH v2 15/15] 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 v2: None common/main.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/common/main.c b/common/main.c index 75a184c..22ed6ef 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;