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 26/32] kconfig: Adjust the meaning of CONFIG_IS_ENABLED()
Date: Tue, 31 Jan 2023 08:26:56 -0700 [thread overview]
Message-ID: <20230131152702.249197-27-sjg@chromium.org> (raw)
In-Reply-To: <20230131152702.249197-1-sjg@chromium.org>
Adjust this to require the CONFIG option be provided, so that instead of:
CONFIG_IS_ENABLED(FOO)
you must write:
CONFIG_IS_ENABLED(CONFIG_FOO)
This is in preparation for dropping this and just using it is as the new
implementation of IS_ENABLED(). For now, update IS_ENABLED() to use
CONFIG_IS_ENABLED(), so we can rely on the three-argument version.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
arch/x86/lib/fsp/fsp_dram.c | 2 +-
board/st/stm32mp1/stm32mp1.c | 2 +-
drivers/fastboot/fb_command.c | 16 ++++++++--------
include/linux/kconfig.h | 34 ++++++++++++----------------------
test/dm/ofnode.c | 2 +-
test/lib/kconfig.c | 6 +++---
test/lib/kconfig_spl.c | 4 ++--
7 files changed, 28 insertions(+), 38 deletions(-)
diff --git a/arch/x86/lib/fsp/fsp_dram.c b/arch/x86/lib/fsp/fsp_dram.c
index db4e3ff5fa2..13e89d41727 100644
--- a/arch/x86/lib/fsp/fsp_dram.c
+++ b/arch/x86/lib/fsp/fsp_dram.c
@@ -152,7 +152,7 @@ unsigned int install_e820_map(unsigned int max_entries,
if (IS_ENABLED(CONFIG_HAVE_ACPI_RESUME)) {
ulong stack_size;
- stack_size = CONFIG_IS_ENABLED(HAVE_ACPI_RESUME,
+ stack_size = IS_ENABLED(CONFIG_HAVE_ACPI_RESUME,
(CONFIG_STACK_SIZE_RESUME), (0));
/*
* Everything between U-Boot's stack and ram top needs to be
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 0ffcca419f2..6dd44396185 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -903,7 +903,7 @@ const char *env_ext4_get_dev_part(void)
int mmc_get_env_dev(void)
{
- const int mmc_env_dev = CONFIG_IS_ENABLED(ENV_IS_IN_MMC, (CONFIG_SYS_MMC_ENV_DEV), (-1));
+ const int mmc_env_dev = IS_ENABLED(CONFIG_ENV_IS_IN_MMC, (CONFIG_SYS_MMC_ENV_DEV), (-1));
if (mmc_env_dev >= 0)
return mmc_env_dev;
diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
index 71cfaec6e9d..3a5e29861a2 100644
--- a/drivers/fastboot/fb_command.c
+++ b/drivers/fastboot/fb_command.c
@@ -56,11 +56,11 @@ static const struct {
},
[FASTBOOT_COMMAND_FLASH] = {
.command = "flash",
- .dispatch = CONFIG_IS_ENABLED(FASTBOOT_FLASH, (flash), (NULL))
+ .dispatch = IS_ENABLED(CONFIG_FASTBOOT_FLASH, (flash), (NULL))
},
[FASTBOOT_COMMAND_ERASE] = {
.command = "erase",
- .dispatch = CONFIG_IS_ENABLED(FASTBOOT_FLASH, (erase), (NULL))
+ .dispatch = IS_ENABLED(CONFIG_FASTBOOT_FLASH, (erase), (NULL))
},
[FASTBOOT_COMMAND_BOOT] = {
.command = "boot",
@@ -92,27 +92,27 @@ static const struct {
},
[FASTBOOT_COMMAND_OEM_FORMAT] = {
.command = "oem format",
- .dispatch = CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT, (oem_format), (NULL))
+ .dispatch = IS_ENABLED(CONFIG_FASTBOOT_CMD_OEM_FORMAT, (oem_format), (NULL))
},
[FASTBOOT_COMMAND_OEM_PARTCONF] = {
.command = "oem partconf",
- .dispatch = CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_PARTCONF, (oem_partconf), (NULL))
+ .dispatch = IS_ENABLED(CONFIG_FASTBOOT_CMD_OEM_PARTCONF, (oem_partconf), (NULL))
},
[FASTBOOT_COMMAND_OEM_BOOTBUS] = {
.command = "oem bootbus",
- .dispatch = CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_BOOTBUS, (oem_bootbus), (NULL))
+ .dispatch = IS_ENABLED(CONFIG_FASTBOOT_CMD_OEM_BOOTBUS, (oem_bootbus), (NULL))
},
[FASTBOOT_COMMAND_OEM_RUN] = {
.command = "oem run",
- .dispatch = CONFIG_IS_ENABLED(FASTBOOT_OEM_RUN, (run_ucmd), (NULL))
+ .dispatch = IS_ENABLED(CONFIG_FASTBOOT_OEM_RUN, (run_ucmd), (NULL))
},
[FASTBOOT_COMMAND_UCMD] = {
.command = "UCmd",
- .dispatch = CONFIG_IS_ENABLED(FASTBOOT_UUU_SUPPORT, (run_ucmd), (NULL))
+ .dispatch = IS_ENABLED(CONFIG_FASTBOOT_UUU_SUPPORT, (run_ucmd), (NULL))
},
[FASTBOOT_COMMAND_ACMD] = {
.command = "ACmd",
- .dispatch = CONFIG_IS_ENABLED(FASTBOOT_UUU_SUPPORT, (run_acmd), (NULL))
+ .dispatch = IS_ENABLED(CONFIG_FASTBOOT_UUU_SUPPORT, (run_acmd), (NULL))
},
};
diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h
index f00686eb3e1..57d5afc7a1a 100644
--- a/include/linux/kconfig.h
+++ b/include/linux/kconfig.h
@@ -32,12 +32,6 @@
#define __config_enabled(arg1_or_junk, def_val) ___config_enabled(arg1_or_junk 1, def_val)
#define ___config_enabled(__ignored, val, ...) val
-/*
- * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y',
- * 0 otherwise.
- */
-#define IS_ENABLED(option) config_enabled(option, 0)
-
#define __config_val(cfg) CONFIG_ ## cfg
#define CONFIG_VAL(option) __config_val(option)
@@ -83,34 +77,30 @@ long invalid_use_of_IF_ENABLED_INT(void);
#define __CONFIG_IS_ENABLED_1(option) __CONFIG_IS_ENABLED_3(option, (1), (0))
#define __CONFIG_IS_ENABLED_2(option, case1) __CONFIG_IS_ENABLED_3(option, case1, ())
#define __CONFIG_IS_ENABLED_3(option, case1, case0) \
- __concat(__unwrap, config_enabled(CONFIG_VAL(option), 0)) (case1, case0)
+ __concat(__unwrap, config_enabled(option, 0)) (case1, case0)
/*
- * CONFIG_IS_ENABLED(FOO) returns 1 if CONFIG_FOO is enabled for the phase being
- * built, else 0. Note that CONFIG_FOO corresponds to CONFIG_SPL_FOO (in
- * Kconfig) for the SPL phase, CONFIG_TPL_FOO for the TPL phase, etc.
- *
- * The _nospl version of a CONFIG is emitted by kconfig when an option has no
- * SPL equivalent. So in that case there is a CONFIG_xxx for example, but not a
- * CONFIG_SPL_xxx
- *
- * This is needed as a transition measure while CONFIG_IS_ENABLED() is used on
- * options without SPL equivalent, since in that case it should always return
- * zero. Once we add SPL equivalents, this clause can be dropped.
+ * CONFIG_IS_ENABLED(CONFIG_FOO) returns 1 if CONFIG_FOO is enabled for the
+ * phase being built, else 0.
*
* The optional second and third arguments must be parenthesized; that
* allows one to include a trailing comma, e.g. for use in
*
- * CONFIG_IS_ENABLED(ACME, ({.compatible = "acme,frobnozzle"},))
+ * CONFIG_IS_ENABLED(CONFIG_ACME, ({.compatible = "acme,frobnozzle"},))
*
- * which adds an entry to the array being defined if CONFIG_ACME (or
- * CONFIG_SPL_ACME/CONFIG_TPL_ACME, depending on build context) is
+ * which adds an entry to the array being defined if CONFIG_ACME is
* set, and nothing otherwise.
*/
#define CONFIG_IS_ENABLED(option, ...) \
__concat(__CONFIG_IS_ENABLED_, __count_args(option, ##__VA_ARGS__)) (option, ##__VA_ARGS__)
+/*
+ * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y',
+ * 0 otherwise.
+ */
+#define IS_ENABLED(option, ...) CONFIG_IS_ENABLED(option, ##__VA_ARGS__)
+
#ifndef __ASSEMBLY__
/*
* Detect usage of a the value when the conditional is not enabled. When used
@@ -125,7 +115,7 @@ long invalid_use_of_CONFIG_IF_ENABLED_INT(void);
* otherwise build error
*/
#define CONFIG_IF_ENABLED_INT(option, int_option) \
- CONFIG_IS_ENABLED(option, (CONFIG_VAL(int_option)), \
+ CONFIG_IS_ENABLED(option, (int_option), \
(invalid_use_of_CONFIG_IF_ENABLED_INT()))
#define CONFIG_IF_INT(option, int_option) \
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index 8077affabb7..8aec458c3c5 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -1148,7 +1148,7 @@ DM_TEST(dm_test_ofnode_get_name, UT_TESTF_SCAN_FDT);
/* try to access more FDTs than is supported */
static int dm_test_ofnode_too_many(struct unit_test_state *uts)
{
- const int max_trees = CONFIG_IS_ENABLED(OFNODE_MULTI_TREE,
+ const int max_trees = IS_ENABLED(CONFIG_OFNODE_MULTI_TREE,
(CONFIG_OFNODE_MULTI_TREE_MAX), (1));
const int fdt_size = 256;
const int num_trees = max_trees + 1;
diff --git a/test/lib/kconfig.c b/test/lib/kconfig.c
index 8fb6422c905..029a2be8cd9 100644
--- a/test/lib/kconfig.c
+++ b/test/lib/kconfig.c
@@ -25,7 +25,7 @@ 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(BLOBLIST_FIXED, BLOBLIST_ADDR));
+ CONFIG_IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED, CONFIG_BLOBLIST_ADDR));
/*
* This fails if CONFIG_TEST_KCONFIG_ENABLE is not enabled, since the
@@ -48,8 +48,8 @@ static int lib_test_is_enabled(struct unit_test_state *uts)
*/
if (!IS_ENABLED(CONFIG_SANDBOX_SPL) &&
IS_ENABLED(CONFIG_TEST_KCONFIG)) {
- val = CONFIG_IF_ENABLED_INT(TEST_KCONFIG_ENABLE,
- TEST_KCONFIG_VALUE);
+ val = CONFIG_IF_ENABLED_INT(CONFIG_TEST_KCONFIG_ENABLE,
+ CONFIG_TEST_KCONFIG_VALUE);
printf("value2 %ld\n", val);
}
diff --git a/test/lib/kconfig_spl.c b/test/lib/kconfig_spl.c
index 5c66183dc3d..2894a03f1e8 100644
--- a/test/lib/kconfig_spl.c
+++ b/test/lib/kconfig_spl.c
@@ -34,8 +34,8 @@ static int lib_test_spl_is_enabled(struct unit_test_state *uts)
* value is used.
*/
if (IS_ENABLED(CONFIG_TEST_KCONFIG)) {
- val = CONFIG_IF_ENABLED_INT(TEST_KCONFIG_ENABLE,
- TEST_KCONFIG_VALUE);
+ val = CONFIG_IF_ENABLED_INT(CONFIG_TEST_KCONFIG_ENABLE,
+ CONFIG_TEST_KCONFIG_VALUE);
printf("value2 %ld\n", val);
}
--
2.39.1.456.gfc5497dd1b-goog
next prev 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 ` Simon Glass [this message]
2023-01-31 15:26 ` [PATCH 27/32] kconfig: Drop CONFIG_IF_ENABLED_INT() Simon Glass
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-27-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.