From patchwork Mon Feb 6 19:05:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1738416 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=JqXgh+JZ; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P9blQ4PhKz23r8 for ; Tue, 7 Feb 2023 06:23:30 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B4B7586152; Mon, 6 Feb 2023 20:14:01 +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="JqXgh+JZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4022E85C7C; Mon, 6 Feb 2023 20:10:52 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) (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 0A63B85CCE for ; Mon, 6 Feb 2023 20:10:23 +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-x12d.google.com with SMTP id j12so1621811ila.1 for ; Mon, 06 Feb 2023 11:10:22 -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=4tb/eQjYrBSnfJXZDCxwI0OXQQWIflWg6fKY1nYXOmQ=; b=JqXgh+JZZDEECsrz8MyQwXUNv39CaGTiKI01ekiSWXJqB+voitqt/P7KpNMaEPRRs3 TwBXgf4tci+Ul4oHi411Ytw1MKLvg08h1BFJM264GYc3fGf7qg8z0gZDTNzX3tIJXrST tFBJJF1/e53p0alqC6WYfqE+n7FamRtKbEzh4= 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=4tb/eQjYrBSnfJXZDCxwI0OXQQWIflWg6fKY1nYXOmQ=; b=ExpKyMF0T3TDcvr6tmMpizkIE4weLli7oWCSxrFBOz/7xGCTz9Wx3g+HlppgFg0ph+ c+Ow5wb8i61TmhTmSDoeVw0NJGoaqLcxGE46VSdBUeN9P91eqbBDgT/hVncFa0LeHfMU 62EbDj1FJqvfhKqlmTH4S6M+QA5j68KDe6dt1RZXySUVoJbwhd/tIMBsSfxP9coL9NLr 2SXlH0h0QirhfLpMoYabJQV3TsDfbLw2oHkdAWhsAux3X2Lat0yNyWqp5luTJnHUVIkc u8IO+e26uSVYNHtq77gytDQZCJWhw/3g4g19aG2fTXSQZQ+o/vikjgAAdSLk0q8Muhsw x96Q== X-Gm-Message-State: AO0yUKVz6Tf5g9EpZ3bO1ifNjVkvxfGM6OztQvqMAG95hekOdSKkNWJA Dp2/WqRsCV1FMGzPHivzcOym0bP6GN3qSSOT X-Google-Smtp-Source: AK7set/SsuwJU4ikpZqEIdmd7MycwxYKhO88wCOndTPuG/e5AaIGx0d4KuvJqVMwhKyIhGQag7ME6Q== X-Received: by 2002:a92:b306:0:b0:313:becf:9d40 with SMTP id p6-20020a92b306000000b00313becf9d40mr253133ilh.4.1675710591003; Mon, 06 Feb 2023 11:09:51 -0800 (PST) Received: from kea.bld.corp.google.com ([2620:15c:183:200:34e9:6977:1cac:fd32]) by smtp.gmail.com with ESMTPSA id t24-20020a028798000000b00375a885f908sm749878jai.36.2023.02.06.11.09.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Feb 2023 11:09:50 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Masahiro Yamada Subject: [PATCH v3 73/81] kconfig: Drop CONFIG_IF_ENABLED_INT() Date: Mon, 6 Feb 2023 12:05:41 -0700 Message-Id: <20230206190550.1692420-74-sjg@chromium.org> X-Mailer: git-send-email 2.39.1.519.gcb327c4b5f-goog In-Reply-To: <20230206190550.1692420-1-sjg@chromium.org> References: <20230206190550.1692420-1-sjg@chromium.org> MIME-Version: 1.0 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 --- (no changes since v1) 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