All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>,
	Masahiro Yamada <yamada.masahiro@socionext.com>
Subject: [PATCH 27/32] kconfig: Drop CONFIG_IF_ENABLED_INT()
Date: Tue, 31 Jan 2023 08:26:57 -0700	[thread overview]
Message-ID: <20230131152702.249197-28-sjg@chromium.org> (raw)
In-Reply-To: <20230131152702.249197-1-sjg@chromium.org>

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 <sjg@chromium.org>
---

 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


  parent reply	other threads:[~2023-01-31 15:33 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-31 15:26 [PATCH 00/32] RFC: Migrate to split config Simon Glass
2023-01-31 15:26 ` [PATCH 01/32] fixup: Bugfix for moveconfig Simon Glass
2023-01-31 15:26 ` [PATCH 02/32] event: Add Kconfig options for SPL Simon Glass
2023-01-31 15:26 ` [PATCH 03/32] bootstd: " Simon Glass
2023-01-31 15:26 ` [PATCH 04/32] cmd: Add an SPL Kconfig for CMDLINE and HUSH Simon Glass
2023-01-31 15:26 ` [PATCH 05/32] boot: Add a Kconfig for SPL_QCOM_PMIC_GPIO Simon Glass
2023-01-31 15:26 ` [PATCH 06/32] cros_ec: Add SPL Kconfigs for cros_ec features Simon Glass
2023-01-31 15:26 ` [PATCH 07/32] boot: Add a Kconfig for SPL_UT_COMPRESSION Simon Glass
2023-01-31 15:26 ` [PATCH 08/32] env: Avoid checking ENV_IS_IN when env disabled Simon Glass
2023-01-31 15:26 ` [PATCH 09/32] boot: Add a Kconfig for SPL_AVB_VERIFY Simon Glass
2023-01-31 15:26 ` [PATCH 10/32] env: Allow VPL environment to be nowhere Simon Glass
2023-01-31 15:26 ` [PATCH 11/32] lib: Add VPL options for SHA1 and SHA256 Simon Glass
2023-01-31 15:26 ` [PATCH 12/32] sandbox: Tidy up RTC options Simon Glass
2023-01-31 15:26 ` [PATCH 13/32] sandbox: Use the generic VPL option to enable VPL Simon Glass
2023-01-31 15:26 ` [PATCH 14/32] sandbox: Tidy up I2C options Simon Glass
2023-01-31 15:26 ` [PATCH 15/32] fixdep: Add support for VPL Simon Glass
2023-01-31 15:26 ` [PATCH 16/32] fixdep: Refactor to make testing easier Simon Glass
2023-01-31 15:26 ` [PATCH 17/32] fixdep: Add some tests for parse_config_line() Simon Glass
2023-01-31 15:26 ` [PATCH 18/32] test: Add SPL versions of the TEST_KCONFIG options Simon Glass
2023-01-31 15:26 ` [PATCH 19/32] kconfig: Add configuration files for noproper and nospl Simon Glass
2023-01-31 15:26 ` [PATCH 20/32] kconfig: Refactor code into separate writer functions Simon Glass
2023-01-31 15:26 ` [PATCH 21/32] kconfig: Support writing separate SPL files Simon Glass
2023-01-31 15:26 ` [PATCH 22/32] Makefile: Include the config for the phase being built Simon Glass
2023-01-31 15:26 ` [PATCH 23/32] kconfig: Update CONFIG_IS_ENABLED() for split files Simon Glass
2023-01-31 15:26 ` [PATCH 24/32] Makefile: Use empty SPL_ and SPL_TPL_ vars Simon Glass
2023-01-31 15:26 ` [PATCH 25/32] Drop use of CONFIG_IS_ENABLED() Simon Glass
2023-01-31 15:26 ` [PATCH 26/32] kconfig: Adjust the meaning " Simon Glass
2023-01-31 15:26 ` Simon Glass [this message]
2023-01-31 15:26 ` [PATCH 28/32] kconfig: Drop CONFIG_IS_ENABLED() Simon Glass
2023-01-31 15:26 ` [PATCH 29/32] kconfig: drop config_opt_enabled() Simon Glass
2023-01-31 15:27 ` [PATCH 30/32] kconfig: Drop CONFIG_VAL() Simon Glass
2023-01-31 15:27 ` [PATCH 31/32] kconfig: Move closer to the Linux version Simon Glass
2023-01-31 15:27 ` [PATCH 32/32] Makefile: Drop SPL_ and SPL_TPL_ macros Simon Glass
2023-01-31 21:57 ` [PATCH 00/32] RFC: Migrate to split config Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230131152702.249197-28-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.