From patchwork Sun Jul 21 02:51:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1134499 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="hjJf0lA4"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45rr911GvQz9sML for ; Sun, 21 Jul 2019 13:40:04 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 9DE9FC21F0C; Sun, 21 Jul 2019 03:40:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 7F662C21E45; Sun, 21 Jul 2019 02:55:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E98B9C21E45; Sun, 21 Jul 2019 02:55:09 +0000 (UTC) Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) by lists.denx.de (Postfix) with ESMTPS id D30FEC21DC1 for ; Sun, 21 Jul 2019 02:52:19 +0000 (UTC) Received: by mail-io1-f66.google.com with SMTP id f4so66555312ioh.6 for ; Sat, 20 Jul 2019 19:52:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VELYPw+jXG67ai01ERWiz9Dk5eUw30cPcFwBHVwiUW0=; b=hjJf0lA4wLxXohNhyN37ajZiEaW1jQ5KyF19fgFe8/yuKPpnXJCdqJjRzdrWlvIYmw lVZKOHYHI9Eina+h0hWygEg1cf+Z7JzUUyp2LJPg1kf05LQI+H1mv6kiw+MwJbSCroDK CDzpIGuLq0qgDGi860agzKAYG5ZjSKMNqfYNA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VELYPw+jXG67ai01ERWiz9Dk5eUw30cPcFwBHVwiUW0=; b=SraqRWTpxndXXa1n89k6LEZetIPSyvhEbc0L7Si47uT8pxILIYeszh3UnPYiZvnAdT nH2ywet03I5xofyVBekU/GHrE4Z8WJc5jEFiGJGVNFh+hkfMkPnvShJ3cyyLxcBARW6p L7ZAQW96Osxt9eeWpCOKgGVMpVw7c+hJ4gtQmjq81C9+/P/gYMlLuAcBLMeyIbwfcioG BVrKO3vhhpcfznVEiVWZZXaKC3EeT2v5HVuBQFYpnOKyRpC2U8lzkej07R9XxFvIYX0j fBefPJqdbF1zJE9XRD3Rwk1FnChNBLGm9LreNzezwI46XzzapdMjIZHsTVV/7YBykQ2K rSgw== X-Gm-Message-State: APjAAAXflx57SrD6UjaONzosc9r109y6EiOHK9ABvE9rv5Bzg2gUkV3O NVsRkiBdJx6AtN0DrFVF708Wsnc2ZrM= X-Google-Smtp-Source: APXvYqzEMtFrObQwsHvirKrI0llPM90bRNw5vXdCuCijPI/NE9Nu8Keai4xriKFAjUlobuN4c5RPfA== X-Received: by 2002:a5d:9711:: with SMTP id h17mr56623789iol.280.1563677538704; Sat, 20 Jul 2019 19:52:18 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id b14sm38862696iod.33.2019.07.20.19.52.18 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 20 Jul 2019 19:52:18 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Sat, 20 Jul 2019 20:51:19 -0600 Message-Id: <20190721025128.30351-10-sjg@chromium.org> X-Mailer: git-send-email 2.22.0.657.g960e92d24f-goog In-Reply-To: <20190721025128.30351-1-sjg@chromium.org> References: <20190721025128.30351-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini , Martin Etnestad Subject: [U-Boot] [PATCH v2 09/18] autoboot: Drop #ifdef CONFIG_AUTOBOOT_KEYED X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" At present we have two functions named __autoboot() which do different things. This is confusing. Fix it by using if() instead of #ifdef for selecting the functions, and renaming them to meaningful names. Signed-off-by: Simon Glass --- Changes in v2: None common/autoboot.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/common/autoboot.c b/common/autoboot.c index 45df665676..012dd5797e 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -35,8 +35,6 @@ static int stored_bootdelay; #define AUTOBOOT_STOP_STR_SHA256 "" #endif -#if defined(CONFIG_AUTOBOOT_KEYED) - /* * Use a "constant-length" time compare function for this * hash compare: @@ -203,7 +201,7 @@ static int passwd_abort_key(uint64_t etime) * Watch for 'delay' seconds for autoboot stop or autoboot delay string. * returns: 0 - no key string, allow autoboot 1 - got key string, abort */ -static int __abortboot(int bootdelay) +static int abortboot_key_sequence(int bootdelay) { int abort; uint64_t etime = endtick(bootdelay); @@ -226,13 +224,11 @@ static int __abortboot(int bootdelay) return abort; } -# else /* !defined(CONFIG_AUTOBOOT_KEYED) */ - #ifdef CONFIG_MENUKEY static int menukey; #endif -static int __abortboot(int bootdelay) +static int abortboot_single_key(int bootdelay) { int abort = 0; unsigned long ts; @@ -277,14 +273,17 @@ static int __abortboot(int bootdelay) return abort; } -# endif /* CONFIG_AUTOBOOT_KEYED */ static int abortboot(int bootdelay) { int abort = 0; - if (bootdelay >= 0) - abort = __abortboot(bootdelay); + if (bootdelay >= 0) { + if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED)) + abort = abortboot_key_sequence(bootdelay); + else + abort = abortboot_single_key(bootdelay); + } if (IS_ENABLED(CONFIG_SILENT_CONSOLE) && abort) gd->flags &= ~GD_FLG_SILENT;