From patchwork Wed May 15 16:24:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 244137 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 C4F1D2C00A8 for ; Thu, 16 May 2013 02:25:51 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7C5C34A08F; Wed, 15 May 2013 18:25:34 +0200 (CEST) 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 VQUgvros+yiq; Wed, 15 May 2013 18:25:34 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C98DB4A094; Wed, 15 May 2013 18:24:55 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 921354A051 for ; Wed, 15 May 2013 18:24:52 +0200 (CEST) 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 XO8Rn0QF3SlT for ; Wed, 15 May 2013 18:24:47 +0200 (CEST) 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-yh0-f74.google.com (mail-yh0-f74.google.com [209.85.213.74]) by theia.denx.de (Postfix) with ESMTPS id 2CAA14A04B for ; Wed, 15 May 2013 18:24:29 +0200 (CEST) Received: by mail-yh0-f74.google.com with SMTP id t59so115381yho.5 for ; Wed, 15 May 2013 09:24:27 -0700 (PDT) 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=SfwWIwWPqsowtEguMgfQSiPtExImo0RXyel0vc8j3Ro=; b=NV+zaA9uMrDfMP2UCUVBJ2ORG3grYIo1pVtfaUvDfMIq3TaiN7zvzRzr0aarbHc0+w Ie41Pd9rGDSNdunqDFpjNwscBa4fth35uz5Ryx7AwvQ+D7jw8dyQ+QfJKgQPdtJ91Ymi uo32oJ+MS6bGUsKAA2lQutCYyhaWdkoGqXBddR0Yw8wiFCeT3KQYMrZeAM0lqP/9AxvF B7N94ulQAix+kJZkeigfJDwgArZKg66hnDa+yVs00pJvNv+FsH16pXGUrjWOUVb6KKvw fh8XqunZGXh5ZEDi94gQqr9FHLW3uQgl1ULEPiqCGr8CtaQZ4ySSV3gonBNeepty9nKb ogjQ== X-Received: by 10.236.68.164 with SMTP id l24mr7229362yhd.19.1368635067931; Wed, 15 May 2013 09:24:27 -0700 (PDT) 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 k25si195396yhh.4.2013.05.15.09.24.27 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Wed, 15 May 2013 09:24:27 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.83.1]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id BF1425A420E; Wed, 15 May 2013 09:24:27 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 9E80816069C; Wed, 15 May 2013 09:24:27 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 15 May 2013 09:24:01 -0700 Message-Id: <1368635041-27638-9-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1368635041-27638-1-git-send-email-sjg@chromium.org> References: <1368635041-27638-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQkAGnE5rzt3utniKuSw50MXZMsyWG9Ff/3rxcUdRSyXIveQCVUBDmpl211QE7F3ZIGze7T9X7mpqb8Fd69sawUDFAxUU0Qq2Xz3pIFf31Li8dcZBLX9XQlNYGk5iUnpnhTt4cSKU3DRrP9YjOPMZgDVIiuRTp1xU5BJDMo2qRSH3Q/WVvtEPpQ7Tpaz439cuWTikfLF Cc: Tom Rini , Joe Hershberger , u-boot-review@google.com Subject: [U-Boot] [PATCH v4 9/9] 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 v4: None Changes in v3: None common/main.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/common/main.c b/common/main.c index fcce0f3..f6b9dc2 100644 --- a/common/main.c +++ b/common/main.c @@ -53,6 +53,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 */ @@ -138,11 +143,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", - delaykey[i].retry ? "delay" : "stop", - delaykey[i].str ? delaykey[i].str : "NULL"); -# endif + debug_bootkeys("%s key:<%s>\n", + delaykey[i].retry ? "delay" : "stop", + delaykey[i].str ? delaykey[i].str : "NULL"); } /* In order to keep up with incoming data, check timeout only @@ -167,10 +170,9 @@ 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"); # ifdef CONFIG_BOOT_RETRY_TIME /* don't retry auto boot */ @@ -182,10 +184,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"); #ifdef CONFIG_SILENT_CONSOLE if (abort)