From patchwork Sun Jul 21 02:51:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1134507 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="FPyICjxX"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45rs2X3jvYz9s4Y for ; Sun, 21 Jul 2019 14:19:32 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 33072C22092; Sun, 21 Jul 2019 04:19:30 +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 1E77AC21DF8; Sun, 21 Jul 2019 02:55:26 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B2F13C21E7D; Sun, 21 Jul 2019 02:55:23 +0000 (UTC) Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by lists.denx.de (Postfix) with ESMTPS id 36CA6C21DD4 for ; Sun, 21 Jul 2019 02:52:42 +0000 (UTC) Received: by mail-io1-f65.google.com with SMTP id k8so66602635iot.1 for ; Sat, 20 Jul 2019 19:52:42 -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=liu0t51cY54nVEi/bdJ6h5NOKIPa/M3TK5Pn2zGBr30=; b=FPyICjxXrcJoPY16ss/3Vu24kL+OA1d/ZUBN8ZpenZMfhtMqW4CM3ewCYhoqlMLoke l/jGi/2FwEOzl14iqZ2xEWp/c4/LPRpRF4QP9Ymf3wR7u8D+Ivh7EUeDz0Y7JfTB6wIF pB4hoEoCS1hdRotEC/mA6sHuGs3NdQH4MFbfo= 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=liu0t51cY54nVEi/bdJ6h5NOKIPa/M3TK5Pn2zGBr30=; b=oOxHkrdf/deb2Z3gwREcD4RsJFm75VXDoDKFSG6byE3PvdRi4ijTRjiwEZ27lE44dP Dg28JTTXGFsuij4lKlSdNNRJGWhB2+IbII5P7JkcQbnTEz5OtkTpcCSbpfoNzlE2EAhX pB0PoxpzPl49AU1M+bM9k7lqHXLLhxiXljcQwRJr19lnNqWqrSaFtePjdvSA1L91Z4Qn +zIvKcuyS8G44vpom4SugQ8CJ6LPkIw51CYjkWLAhulfy+tdd//HjSSEK4s2RQ+5aDVc pzoYaKG3bpU72lqacExHKnzsEMl5SzBebCU31JzlQIT4V5jm4YclbP6aNuEDa+jjcnWV SDkQ== X-Gm-Message-State: APjAAAXcqRbxRlYpQFnMS186A2SajskOhOr0emhjR+1o9JcI2ZykFvsI Ok1ez0q0JEeJ0ETvZU95TxfkbNMg8G0= X-Google-Smtp-Source: APXvYqyq9EsNvUyUZ0SctQHqxrGYvcEnSchtDG6vhxGc2l/g+uTH2groW6jo9ApgWZYwgyjollueug== X-Received: by 2002:a5d:994b:: with SMTP id v11mr11274992ios.165.1563677561124; Sat, 20 Jul 2019 19:52:41 -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.40 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 20 Jul 2019 19:52:40 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Sat, 20 Jul 2019 20:51:28 -0600 Message-Id: <20190721025128.30351-19-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 18/18] autoboot: Adjust the implementation in autoboot_command() 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" Avoid use of #ifdef and keep the common condion in a variable. This makes the code easier to read. Signed-off-by: Simon Glass --- Changes in v2: - Rebase to master common/autoboot.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/common/autoboot.c b/common/autoboot.c index 75132f8697..42fbd7614a 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -349,15 +349,18 @@ void autoboot_command(const char *s) debug("### main_loop: bootcmd=\"%s\"\n", s ? s : ""); if (stored_bootdelay != -1 && s && !abortboot(stored_bootdelay)) { -#if defined(CONFIG_AUTOBOOT_KEYED) && !defined(CONFIG_AUTOBOOT_KEYED_CTRLC) - int prev = disable_ctrlc(1); /* disable Control C checking */ -#endif + bool lock; + int prev; + + lock = IS_ENABLED(CONFIG_AUTOBOOT_KEYED) && + !IS_ENABLED(CONFIG_AUTOBOOT_KEYED_CTRLC); + if (lock) + prev = disable_ctrlc(1); /* disable Ctrl-C checking */ run_command_list(s, -1, 0); -#if defined(CONFIG_AUTOBOOT_KEYED) && !defined(CONFIG_AUTOBOOT_KEYED_CTRLC) - disable_ctrlc(prev); /* restore Control C checking */ -#endif + if (lock) + disable_ctrlc(prev); /* restore Ctrl-C checking */ } if (IS_ENABLED(CONFIG_USE_AUTOBOOT_MENUKEY) &&