From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 29442C38142 for ; Tue, 31 Jan 2023 15:33:12 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 05EA385B43; Tue, 31 Jan 2023 16:29:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="BrUIwuyt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3F50B85AF0; Tue, 31 Jan 2023 16:28:30 +0100 (CET) Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E45C785AEE for ; Tue, 31 Jan 2023 16:28:14 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12f.google.com with SMTP id u8so6604333ilq.13 for ; Tue, 31 Jan 2023 07:28:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TpCdDn5WCw28rB+S/Piu79J2uCGZ142Qa7smPyHrkQs=; b=BrUIwuytfq+BDoktERysaKEU198+VF+TvotbH905GC0C65UmeaUlHjzXm+fnvoQtd4 e1mPcoFn7vcj5PCnOhSmsFTvCmkoa/tHNp3tF6Ro7b0N3H9HTXih6C5A6GLj0ij0xnug LVTiDqter13diNMdmO6Dd58CYoxK54Z586kOU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TpCdDn5WCw28rB+S/Piu79J2uCGZ142Qa7smPyHrkQs=; b=i7KIMg2trzXBltkC8S9rXa78tGTIkvw06NWkJUevrb8+ziRdcFnhl+/UY0+Xrg0RsR 09UM3bqPb9cKo6TwZuJ3gQsos3ujj2TfLRIv2WR8vFV1mycCQpwwW+8fz/GatTdqM+o+ liiCevHoJXN0D+aShdjJDtEgE0O1Jxe+6tEV6VjGFdEN9DUNeZ2TOV3jWGeuQ1CLxLST 5ehuPZV/YyjLVxHJfDCnhZLx2QQzTrahJe5bBhJMrtAqytSEskx2Q2biF8NnPjy6w/9Y 7egXj5DuvYVg/CDKokixBYTyMzDHdgHdMV19NArZU6R4+mLwSWrDZQirwGThjVyguO60 1ZAA== X-Gm-Message-State: AO0yUKXG6EkMFF1Q6SSNR5Nr2loCENjzZLSaZhcWBpxbiQ0uXBhgblIJ M33n3ctq9DQXeGOqtqhLUWArMVy8eKEku1y9 X-Google-Smtp-Source: AK7set8cq91Yon+I4t2v2MG+uy5gjh4m31+oXgG/zBcNqJbZ5cKQVT/s2E4l8P0CJGjTkoNDcbAgug== X-Received: by 2002:a05:6e02:1aaa:b0:310:fbaa:192b with SMTP id l10-20020a056e021aaa00b00310fbaa192bmr4414994ilv.30.1675178881936; Tue, 31 Jan 2023 07:28:01 -0800 (PST) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id u4-20020a02cb84000000b0039db6cffcbasm5649328jap.71.2023.01.31.07.28.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Jan 2023 07:28:01 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Masahiro Yamada Subject: [PATCH 27/32] kconfig: Drop CONFIG_IF_ENABLED_INT() Date: Tue, 31 Jan 2023 08:26:57 -0700 Message-Id: <20230131152702.249197-28-sjg@chromium.org> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog In-Reply-To: <20230131152702.249197-1-sjg@chromium.org> References: <20230131152702.249197-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean We can use IF_ENABLED_INT() instead, so drop the other macro. Also clean up a few things left behind and fix the comment. Signed-off-by: Simon Glass --- include/linux/kconfig.h | 32 ++++++-------------------------- test/lib/kconfig.c | 15 --------------- test/lib/kconfig_spl.c | 10 ---------- test/py/tests/test_kconfig.py | 6 ++---- 4 files changed, 8 insertions(+), 55 deletions(-) diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h index 57d5afc7a1a..77d8e6b6129 100644 --- a/include/linux/kconfig.h +++ b/include/linux/kconfig.h @@ -47,19 +47,6 @@ ___config_opt_enabled(arg1_or_junk arg2, def_val) #define ___config_opt_enabled(__ignored, val, ...) val -#ifndef __ASSEMBLY__ -/* - * Detect usage of a the value when the conditional is not enabled. When used - * in assembly context, this likely produces a assembly error, or hopefully at - * least something recognisable. - */ -long invalid_use_of_IF_ENABLED_INT(void); -#endif - -/* Evaluates to int_option if option is defined, otherwise a build error */ -#define IF_ENABLED_INT(option, int_option) \ - config_opt_enabled(option, int_option, invalid_use_of_IF_ENABLED_INT()) - /* * Count number of arguments to a variadic macro. Currently only need * it for 1, 2 or 3 arguments. @@ -103,22 +90,15 @@ long invalid_use_of_IF_ENABLED_INT(void); #ifndef __ASSEMBLY__ /* - * Detect usage of a the value when the conditional is not enabled. When used - * in assembly context, this likely produces a assembly error, or hopefully at + * Detect usage of the value when the conditional is not enabled. When used + * in assembly context, this likely produces an assembly error, or hopefully at * least something recognisable. */ -long invalid_use_of_CONFIG_IF_ENABLED_INT(void); +long invalid_use_of_IF_ENABLED_INT(void); #endif -/* - * Evaluates to SPL_/TPL_int_option if SPL_/TPL_/option is not defined, - * otherwise build error - */ -#define CONFIG_IF_ENABLED_INT(option, int_option) \ - CONFIG_IS_ENABLED(option, (int_option), \ - (invalid_use_of_CONFIG_IF_ENABLED_INT())) - -#define CONFIG_IF_INT(option, int_option) \ - CONFIG_IF_ENABLED_INT(option, int_option) +/* Evaluates to int_option if option is defined, otherwise build error */ +#define IF_ENABLED_INT(option, int_option) \ + IS_ENABLED(option, (int_option), (invalid_use_of_IF_ENABLED_INT())) #endif /* __LINUX_KCONFIG_H */ diff --git a/test/lib/kconfig.c b/test/lib/kconfig.c index 029a2be8cd9..0c4345b6b3f 100644 --- a/test/lib/kconfig.c +++ b/test/lib/kconfig.c @@ -24,8 +24,6 @@ static int lib_test_is_enabled(struct unit_test_state *uts) ut_asserteq(0xc000, IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED, CONFIG_BLOBLIST_ADDR)); - ut_asserteq(0xc000, - CONFIG_IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED, CONFIG_BLOBLIST_ADDR)); /* * This fails if CONFIG_TEST_KCONFIG_ENABLE is not enabled, since the @@ -40,19 +38,6 @@ static int lib_test_is_enabled(struct unit_test_state *uts) printf("value %ld\n", val); } - /* - * This fails if CONFIG_TEST_KCONFIG_ENABLE is not enabled, since the - * value is used. Disable for SPL so that the errors in kconfig_spl.c - * are detected, since otherwise a build error when building U-Boot may - * cause SPL to not be built. - */ - if (!IS_ENABLED(CONFIG_SANDBOX_SPL) && - IS_ENABLED(CONFIG_TEST_KCONFIG)) { - val = CONFIG_IF_ENABLED_INT(CONFIG_TEST_KCONFIG_ENABLE, - CONFIG_TEST_KCONFIG_VALUE); - printf("value2 %ld\n", val); - } - return 0; } LIB_TEST(lib_test_is_enabled, 0); diff --git a/test/lib/kconfig_spl.c b/test/lib/kconfig_spl.c index 2894a03f1e8..69c107fd524 100644 --- a/test/lib/kconfig_spl.c +++ b/test/lib/kconfig_spl.c @@ -29,16 +29,6 @@ static int lib_test_spl_is_enabled(struct unit_test_state *uts) printf("value %ld\n", val); } - /* - * This fails if CONFIG_TEST_KCONFIG_ENABLE is not enabled, since the - * value is used. - */ - if (IS_ENABLED(CONFIG_TEST_KCONFIG)) { - val = CONFIG_IF_ENABLED_INT(CONFIG_TEST_KCONFIG_ENABLE, - CONFIG_TEST_KCONFIG_VALUE); - printf("value2 %ld\n", val); - } - return 0; } LIB_TEST(lib_test_spl_is_enabled, 0); diff --git a/test/py/tests/test_kconfig.py b/test/py/tests/test_kconfig.py index 0b9e6bc3bd1..c4287e1144c 100644 --- a/test/py/tests/test_kconfig.py +++ b/test/py/tests/test_kconfig.py @@ -20,7 +20,6 @@ def test_kconfig(u_boot_console): cons, ['./tools/buildman/buildman', '-m', '--board', 'sandbox', '-a', 'TEST_KCONFIG', '-o', TMPDIR], ignore_errors=True) assert 'invalid_use_of_IF_ENABLED_INT' in out - assert 'invalid_use_of_CONFIG_IF_ENABLED_INT' in out @pytest.mark.slow @pytest.mark.boardspec('sandbox_spl') @@ -32,8 +31,7 @@ def test_kconfig_spl(u_boot_console): out = util.run_and_log( cons, ['./tools/buildman/buildman', '-m', '--board', 'sandbox_spl', '-a', 'TEST_KCONFIG', '-o', TMPDIR], ignore_errors=True) - assert 'invalid_use_of_IF_ENABLED_INT' in out - # There is no CONFIG_SPL_TEST_KCONFIG, so the CONFIG_IF_ENABLED_INT() + # There is no CONFIG_SPL_TEST_KCONFIG, so the IF_ENABLED_INT() # line should not generate an error - assert 'invalid_use_of_CONFIG_IF_ENABLED_INT' not in out + assert 'invalid_use_of_IF_ENABLED_INT' not in out -- 2.39.1.456.gfc5497dd1b-goog