From patchwork Thu Jun 23 15:42:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 70766 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp497088qgy; Thu, 23 Jun 2016 08:43:54 -0700 (PDT) X-Received: by 10.194.104.196 with SMTP id gg4mr34180925wjb.112.1466696634896; Thu, 23 Jun 2016 08:43:54 -0700 (PDT) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id n204si7227262wmg.19.2016.06.23.08.43.54; Thu, 23 Jun 2016 08:43:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 07AF3A759C; Thu, 23 Jun 2016 17:43:40 +0200 (CEST) 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 aicDzX7wEm15; Thu, 23 Jun 2016 17:43:39 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E6A77A75C6; Thu, 23 Jun 2016 17:43:29 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0C5F8A753B for ; Thu, 23 Jun 2016 17:43:23 +0200 (CEST) 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 aIbwDWU7QMVe for ; Thu, 23 Jun 2016 17:43:22 +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 conuserg-10.nifty.com (conuserg-10.nifty.com [210.131.2.77]) by theia.denx.de (Postfix) with ESMTPS id 5A9E9A7593 for ; Thu, 23 Jun 2016 17:43:19 +0200 (CEST) Received: from grover.sesame (FL1-119-242-215-193.osk.mesh.ad.jp [119.242.215.193]) (authenticated) by conuserg-10.nifty.com with ESMTP id u5NFggq3027414; Fri, 24 Jun 2016 00:42:57 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com u5NFggq3027414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1466696578; bh=aajyM2qYmBkrfAj4uaPBGcw46bLvGWGVoR3De38oj1Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gl4M2GBii4WFX/TorDZnoOQ80qRHwocL7sUgRk5WQB9a3iQnYVPdr1bynMyyhQ/tc VoaS7ptF8YMdFjvo8tBUxT89q0tRVec+0jZ9p0+xRwQwRNsd1Y90EhRtjtKpKbJuwm jDY4zCRML2JO4rhTpgrDHIQVdNGI7TCGIikiSNqaOax9Ej0jLKoQnK3G7W9rzpbTLo aeOmV5nbbFYKc6PtVRiJrmAMQmI4cRKeAgp/bAl37TAX3XSeTbzKZWQ8ISi5GvcSto 2YF6hepMdlFsixV96erIdsOwQlBcGsLksvLIX/h5tgebIufYaHc1OHNcbQMN9ki4lh Ayy2LX8Em6TVw== X-Nifty-SrcIP: [119.242.215.193] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Fri, 24 Jun 2016 00:42:41 +0900 Message-Id: <1466696561-22935-7-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466696561-22935-1-git-send-email-yamada.masahiro@socionext.com> References: <1466696561-22935-1-git-send-email-yamada.masahiro@socionext.com> Subject: [U-Boot] [PATCH v2 6/6] autoboot: move bootdelay >= 0 check to abortboot() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Move the bootdelay >= 0 check to the caller, which simplifies the callees. Signed-off-by: Masahiro Yamada Reviewed-by: Stefan Roese Reviewed-by: Simon Glass Reviewed-by: Heiko Schocher --- Changes in v2: None common/autoboot.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) -- 1.9.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/common/autoboot.c b/common/autoboot.c index fb13139..c52bad8 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -187,9 +187,6 @@ static int __abortboot(int bootdelay) int abort; uint64_t etime = endtick(bootdelay); - if (bootdelay < 0) - return 0; - # ifdef CONFIG_AUTOBOOT_PROMPT /* * CONFIG_AUTOBOOT_PROMPT includes the %d for all boards. @@ -219,20 +216,16 @@ static int __abortboot(int bootdelay) #ifdef CONFIG_MENUPROMPT printf(CONFIG_MENUPROMPT); #else - if (bootdelay >= 0) - printf("Hit any key to stop autoboot: %2d ", bootdelay); + printf("Hit any key to stop autoboot: %2d ", bootdelay); #endif /* * Check if key already pressed - * Don't check if bootdelay < 0 */ - if (bootdelay >= 0) { - if (tstc()) { /* we got a key press */ - (void) getc(); /* consume input */ - puts("\b\b\b 0"); - abort = 1; /* don't auto boot */ - } + if (tstc()) { /* we got a key press */ + (void) getc(); /* consume input */ + puts("\b\b\b 0"); + abort = 1; /* don't auto boot */ } while ((bootdelay > 0) && (!abort)) { @@ -264,9 +257,10 @@ static int __abortboot(int bootdelay) static int abortboot(int bootdelay) { - int abort; + int abort = 0; - abort = __abortboot(bootdelay); + if (bootdelay >= 0) + abort = __abortboot(bootdelay); #ifdef CONFIG_SILENT_CONSOLE if (abort)