Skip to contentSkip to conversation

CONFIG_IS_ENABLED vs IS_ENABLED

PATCH Superseded Troy Kisky 3 participants 45 messages Feb 24, 2023 – Mar 10, 2023

Subsystems (6)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Troy Kisky

author
#0 lore raw

v2 cover CONFIG_IS_ENABLED vs IS_ENABLED

This patch set gets ready to check the usage of
CONFIG_IS_ENABLED/IS_ENABLED.

After the set has been applied, you can delete
test/usage_of_is_enabled_todo.txt
and run test/usage_of_is_enabled_commit.sh

The script test/usage_of_is_enabled_check.sh
checks for new questionable uses of
CONFIG_IS_ENABLED/IS_ENABLED and is added
to .azure-pipelines.yml, and
.gitlab-ci.yml

Changes in v2:
- new patch
- delay include of linux/kconfig.h to do from Makefile
- include linux/kconfig.h from tools/Makefile
- as suggested by Simon
- keep #error, but change condition to use IS_ENABLED_NOCHECK
- keep #error, but change condition to use IS_ENABLED_NOCHECK
- changed condition of when to include field bdf
- added protection to another instance of bdf in uart.c
- Thanks to Simon for getting this corrected
- use normal if, not preprocessor
- new in series
- use an accessor function gd_set_pci_ram_top
- Always define function instead of using same protection

Troy Kisky (26):
kconfig: add IS_ENABLED_NOCHECK to bypass usage_of_is_enabled_check
cmd: nvedit: check for ENV_SUPPORT
lib: crc32: prepare for CONFIG_IS_ENABLED changes
lib: md5: prepare for CONFIG_IS_ENABLED changes
lib: sha1: prepare for CONFIG_IS_ENABLED changes
lib: sha256: prepare for CONFIG_IS_ENABLED changes
lib: sha512: prepare for CONFIG_IS_ENABLED changes
tools: prevent CONFIG_IS_ENABLED errors by including linux/kconfig.h
tools: Makefile: prepare for CONFIG_IS_ENABLED changes by adding
CONFIG_TOOLS_xxx
x86: cpu: qemu: qemu: remove SPL use with CONFIG_IS_ENABLED
config_distro_bootcmd: remove booting environment variables from SPL
environment
ofnode: fdt_support definitions needed if OF_CONTROL is enabled
ringneck-px30: use IS_ENABLED_NOCHECK to avoid CI test failure for
ENV_IS_NOWHERE
puma-rk3399: use IS_ENABLED_NOCHECK to avoid CI test failure for
ENV_IS_NOWHERE
fdt_support: always define fdt_fixup_mtdparts
m53menlo: define ft_board_setup only if CONFIG_IS_ENABLED(OF_LIBFDT)
freescale: common: pfuze: define pfuze_mode_init only if
defined(CONFIG_DM_PMIC)
ns16550: match when to define bdf with uart code
solidrun: mx6cuboxi: use CONFIG_IS_ENABLED(SATA) instead of
CONFIG_CMD_SATA
wandboard: use CONFIG_IS_ENABLED(SATA) instead of ifdef CONFIG_SATA
arm: mach-imx: use CONFIG_$(SPL_)SATA instead of CONFIG_SATA
x86: cpu: i386: cpu: only set pci_ram_top if CONFIG_IS_ENABLED(PCI)
gateworks: venice: Always define setup_fec and setup_eqos
power: pmic: add dm style definitions if not
CONFIG_IS_ENABLED(POWER_LEGACY)
arm: cpu: armv7: ls102xa: fdt: remove eth_device support
CI: add test/usage_of_is_enabled_check.sh

 .azure-pipelines.yml                          |  11 +
 .gitlab-ci.yml                                |   5 +
 arch/arm/cpu/armv7/ls102xa/fdt.c              |  12 -
 arch/arm/mach-imx/Makefile                    |   2 +-
 arch/x86/cpu/apollolake/uart.c                |   4 +
 arch/x86/cpu/i386/cpu.c                       |   2 +-
 arch/x86/cpu/qemu/qemu.c                      |   2 +-
 board/freescale/common/pfuze.c                |   2 +-
 board/gateworks/venice/venice.c               |   2 +-
 board/menlo/m53menlo/m53menlo.c               |   2 +
 board/solidrun/mx6cuboxi/mx6cuboxi.c          |   5 +-
 .../puma_rk3399/puma-rk3399.c                 |   2 +-
 .../ringneck_px30/ringneck-px30.c             |   2 +-
 board/wandboard/wandboard.c                   |   5 +-
 cmd/nvedit.c                                  |   5 +-
 include/asm-generic/global_data.h             |   6 +
 include/config_distro_bootcmd.h               |  23 ++
 include/fdt_support.h                         |  26 ++-
 include/linux/kconfig.h                       |   5 +
 include/ns16550.h                             |   2 +-
 include/power/pmic.h                          |   2 +-
 lib/crc32.c                                   |  11 +-
 lib/md5.c                                     |   7 +-
 lib/sha1.c                                    |   7 +-
 lib/sha256.c                                  |   7 +-
 lib/sha512.c                                  |  11 +-
 test/usage_of_is_enabled_check.sh             |  19 ++
 test/usage_of_is_enabled_commit.sh            |  12 +
 test/usage_of_is_enabled_correct.sh           |  50 +++++
 test/usage_of_is_enabled_exempt.txt           |   9 +
 test/usage_of_is_enabled_list.sh              |  86 +++++++
 test/usage_of_is_enabled_splcfg.txt           |  21 ++
 test/usage_of_is_enabled_todo.txt             | 210 ++++++++++++++++++
 tools/Makefile                                |   3 +
 34 files changed, 527 insertions(+), 53 deletions(-)
 create mode 100755 test/usage_of_is_enabled_check.sh
 create mode 100755 test/usage_of_is_enabled_commit.sh
 create mode 100755 test/usage_of_is_enabled_correct.sh
 create mode 100644 test/usage_of_is_enabled_exempt.txt
 create mode 100755 test/usage_of_is_enabled_list.sh
 create mode 100644 test/usage_of_is_enabled_splcfg.txt
 create mode 100644 test/usage_of_is_enabled_todo.txt
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v2 1/26 kconfig: add IS_ENABLED_NOCHECK to bypass usage_of_is_enabled_check

This is for use when a config with an SPL version needs to always check the non-spl verion of the config. It avoids error messages from CI test script usage_of_is_enabled_check.sh

---

Changes in v2:
- new patch

 include/linux/kconfig.h | 5 +++++
 1 file changed, 5 insertions(+)
include/linux/kconfig.h +5 -0
index 2bc704e1104..19b71723ab3 100644
@@ -27,6 +27,11 @@
  * 0 otherwise.
  */
 #define IS_ENABLED(option)	config_enabled(option, 0)
+/*
+ * Using IS_ENABLED_NOCHECK instead of IS_ENABLED prevents
+ * complaints from test/usage_of_is_enabled_check.sh
+ */
+#define IS_ENABLED_NOCHECK(option) config_enabled(option, 0)
 
 /*
  * U-Boot add-on: Helper macros to reference to different macros (prefixed by
Signature · 1 line
2.34.1
Reviewed-by on v2 1/26
#2 lore raw

Re: [PATCH v2 01/26] kconfig: add IS_ENABLED_NOCHECK to bypass usage_of_is_enabled_check

Quoted 5 lines · Troy Kisky

This is for use when a config with an SPL version needs to always check the non-spl verion of the config. It avoids error messages from CI test script usage_of_is_enabled_check.sh

Quoted 9 lines

---

Changes in v2:
- new patch

 include/linux/kconfig.h | 5 +++++
 1 file changed, 5 insertions(+)
author
#3 lore raw

PATCH v2 2/26 cmd: nvedit: check for ENV_SUPPORT

In reply to Troy Kisky

Avoid error messages when SPL,TPL,VPL build don't have the environment options of the main build. This is needed when defined(CONFIG_ENV_IS_IN_xxx) is changed to CONFIG_IS_ENABLED(ENV_IS_IN_xxx).

---

(no changes since v1)

 cmd/nvedit.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
cmd/nvedit.c +4 -1
index 7cbc3fd573a..ef0fe55431c 100644
@@ -43,6 +43,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
 #if	defined(CONFIG_ENV_IS_IN_EEPROM)	|| \
 	defined(CONFIG_ENV_IS_IN_FLASH)		|| \
 	defined(CONFIG_ENV_IS_IN_MMC)		|| \
@@ -60,10 +61,12 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif
 
 #if	!defined(ENV_IS_IN_DEVICE)		&& \
-	!defined(CONFIG_ENV_IS_NOWHERE)
+	!defined(CONFIG_ENV_IS_NOWHERE)		&& \
+	!defined(CONFIG_VPL_BUILD)
 # error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\
 NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE
 #endif
+#endif
 
 /*
  * Maximum expected input data size for import command
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH v2 02/26] cmd: nvedit: check for ENV_SUPPORT

Quoted 27 lines · Troy Kisky

Avoid error messages when SPL,TPL,VPL build don't have the environment options of the main build. This is needed when defined(CONFIG_ENV_IS_IN_xxx) is changed to CONFIG_IS_ENABLED(ENV_IS_IN_xxx).

---

(no changes since v1)

 cmd/nvedit.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
cmd/nvedit.c +1 -0
index 7cbc3fd573a..ef0fe55431c 100644
@@ -43,6 +43,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
 #if	defined(CONFIG_ENV_IS_IN_EEPROM)	|| \
 	defined(CONFIG_ENV_IS_IN_FLASH)		|| \
 	defined(CONFIG_ENV_IS_IN_MMC)		|| \

cmd/nvedit.c DECLARE_GLOBAL_DATA_PTR; · line 69

Quoted 10 lines
cmd/nvedit.c +3 -1
@@ -60,10 +61,12 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif
 
 #if	!defined(ENV_IS_IN_DEVICE)		&& \
-	!defined(CONFIG_ENV_IS_NOWHERE)
+	!defined(CONFIG_ENV_IS_NOWHERE)		&& \
+	!defined(CONFIG_VPL_BUILD)
 # error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\
 NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE
 #endif
+#endif

This is one of the #error messes that we no longer need with Kconfig, where we can ensure things happen. Maybe we can use def_bool y if .. instead of default y if ..., in the ENV_IS_NOWHERE choice ?

Signature · 1 line
Tom
author
#5 lore raw

Re: [PATCH v2 02/26] cmd: nvedit: check for ENV_SUPPORT

Quoted 43 lines · Tom Rini
Quoted 27 lines · Troy Kisky

Avoid error messages when SPL,TPL,VPL build don't have the environment options of the main build. This is needed when defined(CONFIG_ENV_IS_IN_xxx) is changed to CONFIG_IS_ENABLED(ENV_IS_IN_xxx).

---

(no changes since v1)

 cmd/nvedit.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
cmd/nvedit.c +1 -0
index 7cbc3fd573a..ef0fe55431c 100644
@@ -43,6 +43,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
 #if  defined(CONFIG_ENV_IS_IN_EEPROM)        || \
      defined(CONFIG_ENV_IS_IN_FLASH)         || \
      defined(CONFIG_ENV_IS_IN_MMC)           || \

cmd/nvedit.c DECLARE_GLOBAL_DATA_PTR; · line 69

Quoted 10 lines
cmd/nvedit.c +3 -1
@@ -60,10 +61,12 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif
 
 #if  !defined(ENV_IS_IN_DEVICE)              && \
-     !defined(CONFIG_ENV_IS_NOWHERE)
+     !defined(CONFIG_ENV_IS_NOWHERE)         && \
+     !defined(CONFIG_VPL_BUILD)
 # error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\
 NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE
 #endif
+#endif

This is one of the #error messes that we no longer need with Kconfig, where we can ensure things happen. Maybe we can use def_bool y if .. instead of default y if ..., in the ENV_IS_NOWHERE choice ?

Quoted 3 lines

--
Tom

Hi Tom

There is some weirdness here
git grep -A1 CONFIG_ENV_IS_NOWHERE *

am62ax_evm_r5_defconfig:CONFIG_ENV_IS_NOWHERE=y am62ax_evm_r5_defconfig-CONFIG_ENV_IS_IN_MMC=y
--
aristainetos2c_defconfig:CONFIG_ENV_IS_NOWHERE=y aristainetos2c_defconfig-CONFIG_ENV_IS_IN_SPI_FLASH=y
--
aristainetos2ccslb_defconfig:CONFIG_ENV_IS_NOWHERE=y aristainetos2ccslb_defconfig-CONFIG_ENV_IS_IN_SPI_FLASH=y
--
imx6q_bosch_acc_defconfig:CONFIG_ENV_IS_NOWHERE=y imx6q_bosch_acc_defconfig-CONFIG_ENV_IS_IN_MMC=y
--
imx8mn_beacon_2g_defconfig:CONFIG_ENV_IS_NOWHERE=y imx8mn_beacon_2g_defconfig-CONFIG_ENV_IS_IN_MMC=y
--
imx8mn_beacon_defconfig:CONFIG_ENV_IS_NOWHERE=y imx8mn_beacon_defconfig-CONFIG_ENV_IS_IN_MMC=y
--
imx8mn_beacon_fspi_defconfig:CONFIG_ENV_IS_NOWHERE=y imx8mn_beacon_fspi_defconfig-CONFIG_ENV_IS_IN_MMC=y
--
imx8mp_dhcom_pdk2_defconfig:CONFIG_ENV_IS_NOWHERE=y imx8mp_dhcom_pdk2_defconfig-CONFIG_ENV_IS_IN_SPI_FLASH=y
--
imx93_11x11_evk_defconfig:CONFIG_ENV_IS_NOWHERE=y imx93_11x11_evk_defconfig-CONFIG_ENV_IS_IN_MMC=y
--
imxrt1020-evk_defconfig:CONFIG_ENV_IS_NOWHERE=y imxrt1020-evk_defconfig-CONFIG_ENV_IS_IN_MMC=y
--
imxrt1050-evk_defconfig:CONFIG_ENV_IS_NOWHERE=y imxrt1050-evk_defconfig-CONFIG_ENV_IS_IN_MMC=y
--
imxrt1170-evk_defconfig:CONFIG_ENV_IS_NOWHERE=y imxrt1170-evk_defconfig-CONFIG_ENV_IS_IN_MMC=y
--
j721e_evm_a72_defconfig:CONFIG_ENV_IS_NOWHERE=y j721e_evm_a72_defconfig-CONFIG_ENV_IS_IN_FAT=y
--
j721e_hs_evm_a72_defconfig:CONFIG_ENV_IS_NOWHERE=y j721e_hs_evm_a72_defconfig-CONFIG_ENV_IS_IN_FAT=y
--
puma-rk3399_defconfig:CONFIG_ENV_IS_NOWHERE=y puma-rk3399_defconfig-CONFIG_ENV_IS_IN_MMC=y
--
ringneck-px30_defconfig:CONFIG_ENV_IS_NOWHERE=y ringneck-px30_defconfig-CONFIG_ENV_IS_IN_MMC=y
--
sandbox64_defconfig:CONFIG_ENV_IS_NOWHERE=y sandbox64_defconfig-CONFIG_ENV_IS_IN_EXT4=y
--
sandbox_defconfig:CONFIG_ENV_IS_NOWHERE=y sandbox_defconfig-CONFIG_ENV_IS_IN_EXT4=y
--
sandbox_flattree_defconfig:CONFIG_ENV_IS_NOWHERE=y sandbox_flattree_defconfig-CONFIG_ENV_IS_IN_EXT4=y
--
sandbox_noinst_defconfig:CONFIG_ENV_IS_NOWHERE=y sandbox_noinst_defconfig-CONFIG_ENV_IS_IN_EXT4=y
--
sandbox_spl_defconfig:CONFIG_ENV_IS_NOWHERE=y sandbox_spl_defconfig-CONFIG_ENV_IS_IN_EXT4=y
--
sandbox_vpl_defconfig:CONFIG_ENV_IS_NOWHERE=y sandbox_vpl_defconfig-CONFIG_ENV_IS_IN_EXT4=y
--
socrates_defconfig:CONFIG_ENV_IS_NOWHERE=y socrates_defconfig-CONFIG_ENV_IS_IN_FLASH=y
--
stm32mp13_defconfig:CONFIG_ENV_IS_NOWHERE=y stm32mp13_defconfig-CONFIG_ENV_IS_IN_MMC=y
-- stm32mp15-icore-stm32mp1-ctouch2_defconfig:CONFIG_ENV_IS_NOWHERE=y stm32mp15-icore-stm32mp1-ctouch2_defconfig-CONFIG_ENV_IS_IN_MMC=y -- stm32mp15-icore-stm32mp1-edimm2.2_defconfig:CONFIG_ENV_IS_NOWHERE=y stm32mp15-icore-stm32mp1-edimm2.2_defconfig-CONFIG_ENV_IS_IN_MMC=y -- stm32mp15-microgea-stm32mp1-microdev2-of7_defconfig:CONFIG_ENV_IS_NOWHERE=y stm32mp15-microgea-stm32mp1-microdev2-of7_defconfig-CONFIG_ENV_IS_IN_MMC=y -- stm32mp15-microgea-stm32mp1-microdev2_defconfig:CONFIG_ENV_IS_NOWHERE=y stm32mp15-microgea-stm32mp1-microdev2_defconfig-CONFIG_ENV_IS_IN_MMC=y --
stm32mp15_basic_defconfig:CONFIG_ENV_IS_NOWHERE=y stm32mp15_basic_defconfig-CONFIG_ENV_IS_IN_MMC=y
--
stm32mp15_defconfig:CONFIG_ENV_IS_NOWHERE=y stm32mp15_defconfig-CONFIG_ENV_IS_IN_MMC=y
--
stm32mp15_trusted_defconfig:CONFIG_ENV_IS_NOWHERE=y stm32mp15_trusted_defconfig-CONFIG_ENV_IS_IN_MMC=y
--
xilinx_versal_virt_defconfig:CONFIG_ENV_IS_NOWHERE=y xilinx_versal_virt_defconfig-CONFIG_ENV_IS_IN_FAT=y
--
xilinx_zynq_virt_defconfig:CONFIG_ENV_IS_NOWHERE=y xilinx_zynq_virt_defconfig-CONFIG_ENV_IS_IN_FAT=y
--
xilinx_zynqmp_virt_defconfig:CONFIG_ENV_IS_NOWHERE=y xilinx_zynqmp_virt_defconfig-CONFIG_ENV_IS_IN_FAT=y

_________

Should I force CONFIG_ENV_IS_NOWHERE=n in these cases?

BR
Troy

#6 lore raw

Re: [PATCH v2 02/26] cmd: nvedit: check for ENV_SUPPORT

Quoted 53 lines · Troy Kisky
Quoted 43 lines · Tom Rini
Quoted 27 lines · Troy Kisky

Avoid error messages when SPL,TPL,VPL build don't have the environment options of the main build. This is needed when defined(CONFIG_ENV_IS_IN_xxx) is changed to CONFIG_IS_ENABLED(ENV_IS_IN_xxx).

---

(no changes since v1)

 cmd/nvedit.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
cmd/nvedit.c +1 -0
index 7cbc3fd573a..ef0fe55431c 100644
@@ -43,6 +43,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
 #if  defined(CONFIG_ENV_IS_IN_EEPROM)        || \
      defined(CONFIG_ENV_IS_IN_FLASH)         || \
      defined(CONFIG_ENV_IS_IN_MMC)           || \

cmd/nvedit.c DECLARE_GLOBAL_DATA_PTR; · line 69

Quoted 10 lines
cmd/nvedit.c +3 -1
@@ -60,10 +61,12 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif
 
 #if  !defined(ENV_IS_IN_DEVICE)              && \
-     !defined(CONFIG_ENV_IS_NOWHERE)
+     !defined(CONFIG_ENV_IS_NOWHERE)         && \
+     !defined(CONFIG_VPL_BUILD)
 # error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\
 NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE
 #endif
+#endif

This is one of the #error messes that we no longer need with Kconfig, where we can ensure things happen. Maybe we can use def_bool y if .. instead of default y if ..., in the ENV_IS_NOWHERE choice ?

Quoted 3 lines

--
Tom

Hi Tom

There is some weirdness here
git grep -A1 CONFIG_ENV_IS_NOWHERE *

[snip]

Quoted 1 line

Should I force CONFIG_ENV_IS_NOWHERE=n in these cases?

No, we support more than one env location being enabled at a time, with nowhere being the location of last resort (at run time).

Signature · 1 line
Tom
author
#7 lore raw

Re: [PATCH v2 02/26] cmd: nvedit: check for ENV_SUPPORT

Quoted 53 lines · Tom Rini
Quoted 32 lines · Troy Kisky
Quoted 30 lines · Tom Rini
Quoted 29 lines · Troy Kisky

Avoid error messages when SPL,TPL,VPL build don't have the environment options of the main build. This is needed when defined(CONFIG_ENV_IS_IN_xxx) is changed to CONFIG_IS_ENABLED(ENV_IS_IN_xxx).

---

(no changes since v1)

 cmd/nvedit.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
cmd/nvedit.c +1 -0
index 7cbc3fd573a..ef0fe55431c 100644
@@ -43,6 +43,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
 #if  defined(CONFIG_ENV_IS_IN_EEPROM)        || \
      defined(CONFIG_ENV_IS_IN_FLASH)         || \
      defined(CONFIG_ENV_IS_IN_MMC)           || \
@@ -60,10 +61,12 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif
 
Quoted 6 lines
Quoted 6 lines

cmd/nvedit.c DECLARE_GLOBAL_DATA_PTR;

Quoted 6 lines
cmd/nvedit.c +2 -1
 #if  !defined(ENV_IS_IN_DEVICE)              && \
-     !defined(CONFIG_ENV_IS_NOWHERE)
+     !defined(CONFIG_ENV_IS_NOWHERE)         && \
+     !defined(CONFIG_VPL_BUILD)
 # error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\
 NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or

CONFIG_ENV_IS_NOWHERE

Quoted 13 lines
Quoted 10 lines

cmd/nvedit.c DECLARE_GLOBAL_DATA_PTR; · line 69

Quoted 2 lines
cmd/nvedit.c +1 -0
 #endif
+#endif

This is one of the #error messes that we no longer need with Kconfig, where we can ensure things happen. Maybe we can use def_bool y if .. instead of default y if ..., in the ENV_IS_NOWHERE choice ?

--
Tom

Hi Tom

Quoted 10 lines
Quoted 2 lines

There is some weirdness here
git grep -A1 CONFIG_ENV_IS_NOWHERE *

[snip]

Quoted 1 line

Should I force CONFIG_ENV_IS_NOWHERE=n in these cases?

No, we support more than one env location being enabled at a time, with nowhere being the location of last resort (at run time).

Okay, this help text is misleading then.

config ENV_IS_NOWHERE
bool "Environment is not stored"

default y if !ENV_IS_IN_EEPROM && !ENV_IS_IN_EXT4 && \
    !ENV_IS_IN_FAT && !ENV_IS_IN_FLASH && \
    !ENV_IS_IN_MMC && !ENV_IS_IN_NAND && \
    !ENV_IS_IN_NVRAM && !ENV_IS_IN_ONENAND && \
    !ENV_IS_IN_REMOTE && !ENV_IS_IN_SPI_FLASH && \
    !ENV_IS_IN_UBI

help
Define this if you don't want to or can't have an environment stored on a storage medium. In this case the environment will still exist while U-Boot is running, but once U-Boot exits it will not be stored. U-Boot will therefore always start up with a default environment.
______________

Perhaps this is better ?

config ENV_IS_NOT_IN_DEVICE

def_bool y if !ENV_IS_IN_EEPROM && !ENV_IS_IN_EXT4 && \
    !ENV_IS_IN_FAT && !ENV_IS_IN_FLASH && \
    !ENV_IS_IN_MMC && !ENV_IS_IN_NAND && \
    !ENV_IS_IN_NVRAM && !ENV_IS_IN_ONENAND && \
    !ENV_IS_IN_REMOTE && !ENV_IS_IN_SPI_FLASH && \
    !ENV_IS_IN_UBI

select ENV_IS_NOWHERE

config ENV_IS_NOWHERE
bool "Environment is not stored"
help
Define this if you don't care whether or not an environment is stored on a storage medium. In this case the environment will still exist while U-Boot is running, but once U-Boot exits it may not be stored. If no other ENV_IS_IN_ is defined, U-Boot will always start up with a default environment.

BR
Troy

#8 lore raw

Re: [PATCH v2 02/26] cmd: nvedit: check for ENV_SUPPORT

Quoted 75 lines · Troy Kisky
Quoted 53 lines · Tom Rini
Quoted 32 lines · Troy Kisky
Quoted 30 lines · Tom Rini
Quoted 29 lines · Troy Kisky

Avoid error messages when SPL,TPL,VPL build don't have the environment options of the main build. This is needed when defined(CONFIG_ENV_IS_IN_xxx) is changed to CONFIG_IS_ENABLED(ENV_IS_IN_xxx).

---

(no changes since v1)

 cmd/nvedit.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
cmd/nvedit.c +1 -0
index 7cbc3fd573a..ef0fe55431c 100644
@@ -43,6 +43,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
 #if  defined(CONFIG_ENV_IS_IN_EEPROM)        || \
      defined(CONFIG_ENV_IS_IN_FLASH)         || \
      defined(CONFIG_ENV_IS_IN_MMC)           || \
@@ -60,10 +61,12 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif
 
Quoted 6 lines
Quoted 6 lines

cmd/nvedit.c DECLARE_GLOBAL_DATA_PTR;

Quoted 6 lines
cmd/nvedit.c +2 -1
 #if  !defined(ENV_IS_IN_DEVICE)              && \
-     !defined(CONFIG_ENV_IS_NOWHERE)
+     !defined(CONFIG_ENV_IS_NOWHERE)         && \
+     !defined(CONFIG_VPL_BUILD)
 # error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\
 NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or

CONFIG_ENV_IS_NOWHERE

Quoted 13 lines
Quoted 10 lines

cmd/nvedit.c DECLARE_GLOBAL_DATA_PTR; · line 69

Quoted 2 lines
cmd/nvedit.c +1 -0
 #endif
+#endif

This is one of the #error messes that we no longer need with Kconfig, where we can ensure things happen. Maybe we can use def_bool y if .. instead of default y if ..., in the ENV_IS_NOWHERE choice ?

--
Tom

Hi Tom

Quoted 10 lines
Quoted 2 lines

There is some weirdness here
git grep -A1 CONFIG_ENV_IS_NOWHERE *

[snip]

Quoted 1 line

Should I force CONFIG_ENV_IS_NOWHERE=n in these cases?

No, we support more than one env location being enabled at a time, with nowhere being the location of last resort (at run time).

Okay, this help text is misleading then.

config ENV_IS_NOWHERE
bool "Environment is not stored"

default y if !ENV_IS_IN_EEPROM && !ENV_IS_IN_EXT4 && \
    !ENV_IS_IN_FAT && !ENV_IS_IN_FLASH && \
    !ENV_IS_IN_MMC && !ENV_IS_IN_NAND && \
    !ENV_IS_IN_NVRAM && !ENV_IS_IN_ONENAND && \
    !ENV_IS_IN_REMOTE && !ENV_IS_IN_SPI_FLASH && \
    !ENV_IS_IN_UBI
Quoted 6 lines

help
Define this if you don't want to or can't have an environment stored on a storage medium. In this case the environment will still exist while U-Boot is running, but once U-Boot exits it will not be stored. U-Boot will therefore always start up with a default environment.

Yes, rewording this was missed when updating the support.

Quoted 13 lines

______________

Perhaps this is better ?

config ENV_IS_NOT_IN_DEVICE

def_bool y if !ENV_IS_IN_EEPROM && !ENV_IS_IN_EXT4 && \
    !ENV_IS_IN_FAT && !ENV_IS_IN_FLASH && \
    !ENV_IS_IN_MMC && !ENV_IS_IN_NAND && \
    !ENV_IS_IN_NVRAM && !ENV_IS_IN_ONENAND && \
    !ENV_IS_IN_REMOTE && !ENV_IS_IN_SPI_FLASH && \
    !ENV_IS_IN_UBI

select ENV_IS_NOWHERE

Quoted 9 lines

config ENV_IS_NOWHERE
bool "Environment is not stored"
help
Define this if you don't care whether or not an environment is stored on a storage medium. In this case the environment will still exist while U-Boot is running, but once U-Boot exits it may not be stored. If no other ENV_IS_IN_ is defined, U-Boot will always start up with a default environment.

Seems reasonable, thanks.

Signature · 1 line
Tom
author
#9 lore raw

PATCH v2 3/26 lib: crc32: prepare for CONFIG_IS_ENABLED changes

In reply to Troy Kisky

We need to include <linux/kconfig.h> in order to include files that use CONFIG_IS_ENABLED. TO prepare for that be more direct with using defined(USE_HOSTCC).

---

Changes in v2:
- delay include of linux/kconfig.h to do from Makefile
- as suggested by Simon

 lib/crc32.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
lib/crc32.c +7 -4
index aa94d70ef3e..12c104c62a4 100644
@@ -14,11 +14,14 @@
 #else
 #include <common.h>
 #include <efi_loader.h>
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#define PET_WDG
+#endif
 #endif
 #include <compiler.h>
 #include <u-boot/crc.h>
 
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 #include <watchdog.h>
 #endif
 #include "u-boot/zlib.h"
@@ -84,7 +87,7 @@ static void __efi_runtime make_crc_table(void)
   }
   crc_table_empty = 0;
 }
-#elif !defined(CONFIG_ARM64_CRC32)
+#elif !defined(CONFIG_ARM64_CRC32) || defined(USE_HOSTCC)
 /* ========================================================================
  * Table of CRC-32's of all single-byte values (made by make_crc_table)
  */
@@ -184,7 +187,7 @@ const uint32_t * ZEXPORT get_crc_table()
  */
 uint32_t __efi_runtime crc32_no_comp(uint32_t crc, const Bytef *buf, uInt len)
 {
-#ifdef CONFIG_ARM64_CRC32
+#if defined(CONFIG_ARM64_CRC32) && !defined(USE_HOSTCC)
     crc = cpu_to_le32(crc);
     while (len--)
         crc = __builtin_aarch64_crc32b(crc, *buf++);
@@ -243,7 +246,7 @@ uint32_t __efi_runtime crc32(uint32_t crc, const Bytef *p, uInt len)
 uint32_t crc32_wd(uint32_t crc, const unsigned char *buf, uInt len,
 		  uInt chunk_sz)
 {
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 	const unsigned char *end, *curr;
 	int chunk;
 
Signature · 1 line
2.34.1
#10 lore raw

Re: [PATCH v2 03/26] lib: crc32: prepare for CONFIG_IS_ENABLED changes

Quoted 20 lines · Troy Kisky

We need to include <linux/kconfig.h> in order to include files that use CONFIG_IS_ENABLED. TO prepare for that be more direct with using defined(USE_HOSTCC).

---

Changes in v2:
- delay include of linux/kconfig.h to do from Makefile
- as suggested by Simon

 lib/crc32.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
lib/crc32.c +0 -0
index aa94d70ef3e..12c104c62a4 100644

lib/crc32.c line 19

Quoted 6 lines
lib/crc32.c +3 -0
@@ -14,11 +14,14 @@
 #else
 #include <common.h>
 #include <efi_loader.h>
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#define PET_WDG
+#endif

Lets introduce a Kconfig symbol like HAS_WATCHDOG_RUNNING and then update all of the places we have this convention (there's a few this series doesn't touch).

Signature · 1 line
Tom
author
#11 lore raw

PATCH v2 4/26 lib: md5: prepare for CONFIG_IS_ENABLED changes

In reply to Troy Kisky

We need to include <linux/kconfig.h> in order to include files that use CONFIG_IS_ENABLED. TO prepare for that don't pet the watchdog when USE_HOSTCC is defined.

---

Changes in v2:
- delay include of linux/kconfig.h to do from Makefile
- as suggested by Simon

 lib/md5.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
lib/md5.c +5 -2
index 1636ab93661..20d5e87814b 100644
@@ -29,7 +29,10 @@
 
 #ifndef USE_HOSTCC
 #include <common.h>
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
 #include <watchdog.h>
+#define PET_WDG
+#endif
 #endif /* USE_HOSTCC */
 #include <u-boot/md5.h>
 
@@ -288,14 +291,14 @@ md5_wd(const unsigned char *input, unsigned int len, unsigned char output[16],
 	unsigned int chunk_sz)
 {
 	struct MD5Context context;
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 	const unsigned char *end, *curr;
 	int chunk;
 #endif
 
 	MD5Init(&context);
 
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 	curr = input;
 	end = input + len;
 	while (curr < end) {
Signature · 1 line
2.34.1
author
#12 lore raw

PATCH v2 5/26 lib: sha1: prepare for CONFIG_IS_ENABLED changes

In reply to Troy Kisky

We need to include <linux/kconfig.h> in order to include files that use CONFIG_IS_ENABLED. TO prepare for that don't pet the watchdog when USE_HOSTCC is defined.

---

Changes in v2:
- delay include of linux/kconfig.h to do from Makefile
- as suggested by Simon

 lib/sha1.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
lib/sha1.c +5 -2
index 8d074078934..cd5d7aead8d 100644
@@ -19,6 +19,9 @@
 #ifndef USE_HOSTCC
 #include <common.h>
 #include <linux/string.h>
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#define PET_WDG
+#endif
 #else
 #include <string.h>
 #endif /* USE_HOSTCC */
@@ -328,14 +331,14 @@ void sha1_csum_wd(const unsigned char *input, unsigned int ilen,
 		  unsigned char *output, unsigned int chunk_sz)
 {
 	sha1_context ctx;
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 	const unsigned char *end, *curr;
 	int chunk;
 #endif
 
 	sha1_starts (&ctx);
 
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 	curr = input;
 	end = input + ilen;
 	while (curr < end) {
Signature · 1 line
2.34.1
author
#13 lore raw

PATCH v2 6/26 lib: sha256: prepare for CONFIG_IS_ENABLED changes

In reply to Troy Kisky

We need to include <linux/kconfig.h> in order to include files that use CONFIG_IS_ENABLED. TO prepare for that don't pet the watchdog when USE_HOSTCC is defined.

---

Changes in v2:
- delay include of linux/kconfig.h to do from Makefile
- as suggested by Simon

 lib/sha256.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
lib/sha256.c +5 -2
index 4d26aea1c8c..8e1c3992674 100644
@@ -8,6 +8,9 @@
 #ifndef USE_HOSTCC
 #include <common.h>
 #include <linux/string.h>
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#define PET_WDG
+#endif
 #else
 #include <string.h>
 #endif /* USE_HOSTCC */
@@ -276,7 +279,7 @@ void sha256_csum_wd(const unsigned char *input, unsigned int ilen,
 		unsigned char *output, unsigned int chunk_sz)
 {
 	sha256_context ctx;
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 	const unsigned char *end;
 	unsigned char *curr;
 	int chunk;
@@ -284,7 +287,7 @@ void sha256_csum_wd(const unsigned char *input, unsigned int ilen,
 
 	sha256_starts(&ctx);
 
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 	curr = (unsigned char *)input;
 	end = input + ilen;
 	while (curr < end) {
Signature · 1 line
2.34.1
author
#14 lore raw

PATCH v2 7/26 lib: sha512: prepare for CONFIG_IS_ENABLED changes

In reply to Troy Kisky

We need to include <linux/kconfig.h> in order to include files that use CONFIG_IS_ENABLED. TO prepare for that don't pet the watchdog when USE_HOSTCC is defined.

---

Changes in v2:
- delay include of linux/kconfig.h to do from Makefile
- as suggested by Simon

 lib/sha512.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
lib/sha512.c +7 -4
index fbe8d5f5bfe..a504281bf93 100644
@@ -13,6 +13,9 @@
 #ifndef USE_HOSTCC
 #include <common.h>
 #include <linux/string.h>
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#define PET_WDG
+#endif
 #else
 #include <string.h>
 #endif /* USE_HOSTCC */
@@ -292,7 +295,7 @@ void sha384_csum_wd(const unsigned char *input, unsigned int ilen,
 		unsigned char *output, unsigned int chunk_sz)
 {
 	sha512_context ctx;
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 	const unsigned char *end;
 	unsigned char *curr;
 	int chunk;
@@ -300,7 +303,7 @@ void sha384_csum_wd(const unsigned char *input, unsigned int ilen,
 
 	sha384_starts(&ctx);
 
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 	curr = (unsigned char *)input;
 	end = input + ilen;
 	while (curr < end) {
@@ -355,7 +358,7 @@ void sha512_csum_wd(const unsigned char *input, unsigned int ilen,
 		unsigned char *output, unsigned int chunk_sz)
 {
 	sha512_context ctx;
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 	const unsigned char *end;
 	unsigned char *curr;
 	int chunk;
@@ -363,7 +366,7 @@ void sha512_csum_wd(const unsigned char *input, unsigned int ilen,
 
 	sha512_starts(&ctx);
 
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 	curr = (unsigned char *)input;
 	end = input + ilen;
 	while (curr < end) {
Signature · 1 line
2.34.1
author
#15 lore raw

PATCH v2 8/26 tools: prevent CONFIG_IS_ENABLED errors by including linux/kconfig.h

In reply to Troy Kisky

We need to include <linux/kconfig.h> in order to include files that use CONFIG_IS_ENABLED.

---

Changes in v2:
- include linux/kconfig.h from tools/Makefile
- as suggested by Simon

 tools/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/Makefile +1 -0
index e13effbb66a..5d6284e6451 100644
@@ -298,6 +298,7 @@ endif # !LOGO_BMP
 # Define _GNU_SOURCE to obtain the getline prototype from stdio.h
 #
 HOST_EXTRACFLAGS += -include $(srctree)/include/compiler.h \
+		-include $(srctree)/include/linux/kconfig.h \
 		$(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \
 		-I$(srctree)/scripts/dtc/libfdt \
 		-I$(srctree)/tools \
Signature · 1 line
2.34.1
author
#17 lore raw

PATCH v2 9/26 tools: Makefile: prepare for CONFIG_IS_ENABLED changes by adding CONFIG_TOOLS_xxx

In reply to Troy Kisky

CONFIG_IS_ENABLED(FIT_SIGNATURE) will check for CONFIG_TOOLS_FIT_SIGNATURE. So define it now in preparation.

---

(no changes since v1)

 tools/Makefile | 2 ++
 1 file changed, 2 insertions(+)
tools/Makefile +2 -0
index 5d6284e6451..86f1b6b5049 100644
@@ -162,8 +162,10 @@ ifdef CONFIG_TOOLS_LIBCRYPTO
 # This affects include/image.h, but including the board config file
 # is tricky, so manually define this options here.
 HOST_EXTRACFLAGS	+= -DCONFIG_FIT_SIGNATURE
+HOST_EXTRACFLAGS	+= -DCONFIG_TOOLS_FIT_SIGNATURE=1
 HOST_EXTRACFLAGS	+= -DCONFIG_FIT_SIGNATURE_MAX_SIZE=0xffffffff
 HOST_EXTRACFLAGS	+= -DCONFIG_FIT_CIPHER
+HOST_EXTRACFLAGS	+= -DCONFIG_TOOLS_FIT_CIPHER=1
 endif
 
 # MXSImage needs LibSSL
Signature · 1 line
2.34.1
#18 lore raw

Re: [PATCH v2 09/26] tools: Makefile: prepare for CONFIG_IS_ENABLED changes by adding CONFIG_TOOLS_xxx

Quoted 17 lines · Troy Kisky

CONFIG_IS_ENABLED(FIT_SIGNATURE) will check for CONFIG_TOOLS_FIT_SIGNATURE. So define it now in preparation.

---

(no changes since v1)

 tools/Makefile | 2 ++
 1 file changed, 2 insertions(+)
tools/Makefile +0 -0
index 5d6284e6451..86f1b6b5049 100644

tools/Makefile ifdef CONFIG_TOOLS_LIBCRYPTO · line 169

Quoted 8 lines
tools/Makefile +2 -0
@@ -162,8 +162,10 @@ ifdef CONFIG_TOOLS_LIBCRYPTO
 # This affects include/image.h, but including the board config file
 # is tricky, so manually define this options here.
 HOST_EXTRACFLAGS	+= -DCONFIG_FIT_SIGNATURE
+HOST_EXTRACFLAGS	+= -DCONFIG_TOOLS_FIT_SIGNATURE=1
 HOST_EXTRACFLAGS	+= -DCONFIG_FIT_SIGNATURE_MAX_SIZE=0xffffffff
 HOST_EXTRACFLAGS	+= -DCONFIG_FIT_CIPHER
+HOST_EXTRACFLAGS	+= -DCONFIG_TOOLS_FIT_CIPHER=1
 endif

Is the "=1" required here, as in we check the value of the define, not just that it is defined?

Signature · 1 line
Tom
author
#19 lore raw

Re: [PATCH v2 09/26] tools: Makefile: prepare for CONFIG_IS_ENABLED changes by adding CONFIG_TOOLS_xxx

Quoted 30 lines · Tom Rini
Quoted 17 lines · Troy Kisky

CONFIG_IS_ENABLED(FIT_SIGNATURE) will check for CONFIG_TOOLS_FIT_SIGNATURE. So define it now in preparation.

---

(no changes since v1)

 tools/Makefile | 2 ++
 1 file changed, 2 insertions(+)
tools/Makefile +0 -0
index 5d6284e6451..86f1b6b5049 100644

tools/Makefile ifdef CONFIG_TOOLS_LIBCRYPTO · line 169

Quoted 8 lines
tools/Makefile +2 -0
@@ -162,8 +162,10 @@ ifdef CONFIG_TOOLS_LIBCRYPTO
 # This affects include/image.h, but including the board config file
 # is tricky, so manually define this options here.
 HOST_EXTRACFLAGS     += -DCONFIG_FIT_SIGNATURE
+HOST_EXTRACFLAGS     += -DCONFIG_TOOLS_FIT_SIGNATURE=1
 HOST_EXTRACFLAGS     += -DCONFIG_FIT_SIGNATURE_MAX_SIZE=0xffffffff
 HOST_EXTRACFLAGS     += -DCONFIG_FIT_CIPHER
+HOST_EXTRACFLAGS     += -DCONFIG_TOOLS_FIT_CIPHER=1
 endif

Is the "=1" required here, as in we check the value of the define, not just that it is defined?

Quoted 3 lines

--
Tom

When it is converted to CONFIG_IS_ENABLED it will require the =1 The CONFIG_IS_ENABLED logic counts the number of parameters and "empty string" doesn't count.
I think it also compares to 1 somewhere in there.

BR
Troy

#20 lore raw

Re: [PATCH v2 09/26] tools: Makefile: prepare for CONFIG_IS_ENABLED changes by adding CONFIG_TOOLS_xxx

Quoted 32 lines · Troy Kisky
Quoted 30 lines · Tom Rini
Quoted 17 lines · Troy Kisky

CONFIG_IS_ENABLED(FIT_SIGNATURE) will check for CONFIG_TOOLS_FIT_SIGNATURE. So define it now in preparation.

---

(no changes since v1)

 tools/Makefile | 2 ++
 1 file changed, 2 insertions(+)
tools/Makefile +0 -0
index 5d6284e6451..86f1b6b5049 100644

tools/Makefile ifdef CONFIG_TOOLS_LIBCRYPTO · line 169

Quoted 8 lines
tools/Makefile +2 -0
@@ -162,8 +162,10 @@ ifdef CONFIG_TOOLS_LIBCRYPTO
 # This affects include/image.h, but including the board config file
 # is tricky, so manually define this options here.
 HOST_EXTRACFLAGS     += -DCONFIG_FIT_SIGNATURE
+HOST_EXTRACFLAGS     += -DCONFIG_TOOLS_FIT_SIGNATURE=1
 HOST_EXTRACFLAGS     += -DCONFIG_FIT_SIGNATURE_MAX_SIZE=0xffffffff
 HOST_EXTRACFLAGS     += -DCONFIG_FIT_CIPHER
+HOST_EXTRACFLAGS     += -DCONFIG_TOOLS_FIT_CIPHER=1
 endif

Is the "=1" required here, as in we check the value of the define, not just that it is defined?

Quoted 8 lines
Quoted 3 lines

--
Tom

When it is converted to CONFIG_IS_ENABLED it will require the =1 The CONFIG_IS_ENABLED logic counts the number of parameters and "empty string" doesn't count.
I think it also compares to 1 somewhere in there.

Ah, OK, thanks.

Signature · 1 line
Tom
author
#21 lore raw

PATCH v2 10/26 x86: cpu: qemu: qemu: remove SPL use with CONFIG_IS_ENABLED

In reply to Troy Kisky

CONFIG_IS_ENABLED(SPL_X86_32BIT_INIT)
would check for CONFIG_SPL_SPL_X86_32BIT_INIT for SPL builds

---

(no changes since v1)

 arch/x86/cpu/qemu/qemu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/cpu/qemu/qemu.c +1 -1
index e54082df7f9..274978c023b 100644
@@ -97,7 +97,7 @@ static void qemu_chipset_init(void)
 	}
 }
 
-#if !CONFIG_IS_ENABLED(SPL_X86_32BIT_INIT)
+#if CONFIG_IS_ENABLED(X86_32BIT_INIT)
 int arch_cpu_init(void)
 {
 	post_code(POST_CPU_INIT);
Signature · 1 line
2.34.1
author
#22 lore raw

PATCH v2 11/26 config_distro_bootcmd: remove booting environment variables from SPL environment

In reply to Troy Kisky

SPL environments don't need commands that they can never use. Avoid errors with CONFIG_IS_ENABLED conversions by skipping them now.

---

(no changes since v1)

 include/config_distro_bootcmd.h | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
include/config_distro_bootcmd.h +23 -0
index 9d2a225e7eb..2a136b96a6d 100644
@@ -35,11 +35,15 @@
 	#devtypel "_boot=" \
 	BOOTENV_SHARED_BLKDEV_BODY(devtypel)
 
+#define BOOTENV_DEV_BLKDEV_NONE(devtypeu, devtypel, instance)
+
 #define BOOTENV_DEV_BLKDEV(devtypeu, devtypel, instance) \
 	"bootcmd_" #devtypel #instance "=" \
 		"devnum=" #instance "; " \
 		"run " #devtypel "_boot\0"
 
+#define BOOTENV_DEV_NAME_BLKDEV_NONE(devtypeu, devtypel, instance)
+
 #define BOOTENV_DEV_NAME_BLKDEV(devtypeu, devtypel, instance) \
 	#devtypel #instance " "
 
@@ -59,6 +63,10 @@
 #define BOOTENV_SHARED_MMC	BOOTENV_SHARED_BLKDEV(mmc)
 #define BOOTENV_DEV_MMC		BOOTENV_DEV_BLKDEV
 #define BOOTENV_DEV_NAME_MMC	BOOTENV_DEV_NAME_BLKDEV
+#elif defined(CONFIG_SPL_BUILD)
+#define BOOTENV_SHARED_MMC
+#define BOOTENV_DEV_MMC		BOOTENV_DEV_BLKDEV_NONE
+#define BOOTENV_DEV_NAME_MMC	BOOTENV_DEV_NAME_BLKDEV_NONE
 #else
 #define BOOTENV_SHARED_MMC
 #define BOOTENV_DEV_MMC \
@@ -190,6 +198,10 @@
 #define BOOTENV_SHARED_SATA	BOOTENV_SHARED_BLKDEV(sata)
 #define BOOTENV_DEV_SATA	BOOTENV_DEV_BLKDEV
 #define BOOTENV_DEV_NAME_SATA	BOOTENV_DEV_NAME_BLKDEV
+#elif defined(CONFIG_SPL_BUILD)
+#define BOOTENV_SHARED_SATA
+#define BOOTENV_DEV_SATA	BOOTENV_DEV_BLKDEV_NONE
+#define BOOTENV_DEV_NAME_SATA	BOOTENV_DEV_NAME_BLKDEV_NONE
 #else
 #define BOOTENV_SHARED_SATA
 #define BOOTENV_DEV_SATA \
@@ -293,6 +305,11 @@
 		BOOTENV_SHARED_BLKDEV_BODY(usb)
 #define BOOTENV_DEV_USB		BOOTENV_DEV_BLKDEV
 #define BOOTENV_DEV_NAME_USB	BOOTENV_DEV_NAME_BLKDEV
+#elif defined(CONFIG_SPL_BUILD)
+#define BOOTENV_RUN_NET_USB_START
+#define BOOTENV_SHARED_USB
+#define BOOTENV_DEV_USB		BOOTENV_DEV_BLKDEV_NONE
+#define BOOTENV_DEV_NAME_USB	BOOTENV_DEV_NAME_BLKDEV_NONE
 #else
 #define BOOTENV_RUN_NET_USB_START
 #define BOOTENV_SHARED_USB
@@ -395,6 +412,9 @@
 		"\0"
 #define BOOTENV_DEV_NAME_DHCP(devtypeu, devtypel, instance) \
 	"dhcp "
+#elif defined(CONFIG_SPL_BUILD)
+#define BOOTENV_DEV_DHCP	BOOTENV_DEV_BLKDEV_NONE
+#define BOOTENV_DEV_NAME_DHCP	BOOTENV_DEV_NAME_BLKDEV_NONE
 #else
 #define BOOTENV_DEV_DHCP \
 	BOOT_TARGET_DEVICES_references_DHCP_without_CONFIG_CMD_DHCP
@@ -413,6 +433,9 @@
 		"fi\0"
 #define BOOTENV_DEV_NAME_PXE(devtypeu, devtypel, instance) \
 	"pxe "
+#elif defined(CONFIG_SPL_BUILD)
+#define BOOTENV_DEV_PXE		BOOTENV_DEV_BLKDEV_NONE
+#define BOOTENV_DEV_NAME_PXE	BOOTENV_DEV_NAME_BLKDEV_NONE
 #else
 #define BOOTENV_DEV_PXE \
 	BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE
Signature · 1 line
2.34.1
author
#23 lore raw

PATCH v2 12/26 ofnode: fdt_support definitions needed if OF_CONTROL is enabled

In reply to Troy Kisky

With the use of CONFIG_IS_ENABLED in code, instead of at the preprocessor level, these defines are still needed if OF_CONTROL is enabled.

---

(no changes since v1)

 include/fdt_support.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/fdt_support.h +2 -1
index 5638bd4f165..eeb83e6251d 100644
@@ -7,7 +7,8 @@
 #ifndef __FDT_SUPPORT_H
 #define __FDT_SUPPORT_H
 
-#if defined(CONFIG_OF_LIBFDT) && !defined(USE_HOSTCC)
+#if (defined(CONFIG_OF_LIBFDT) || defined(CONFIG_OF_CONTROL)) && \
+	!defined(USE_HOSTCC)
 
 #include <asm/u-boot.h>
 #include <linux/libfdt.h>
Signature · 1 line
2.34.1
author
#24 lore raw

PATCH v2 13/26 ringneck-px30: use IS_ENABLED_NOCHECK to avoid CI test failure for ENV_IS_NOWHERE

In reply to Troy Kisky

When usage_of_is_enabled_check.sh is added, this will show a false positive for IS_ENABLED(CONFIG_ENV_IS_NOWHERE).
Use IS_ENABLED_NOCHECK to avoid check and error on SPL builds.

---

Changes in v2:
- keep #error, but change condition to use IS_ENABLED_NOCHECK

 board/theobroma-systems/ringneck_px30/ringneck-px30.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/theobroma-systems/ringneck_px30/ringneck-px30.c +1 -1
index 47d1a40ef7c..5b2e0c7d40f 100644
@@ -118,7 +118,7 @@ int mmc_get_env_dev(void)
 	return CONFIG_SYS_MMC_ENV_DEV;
 }
 
-#if !IS_ENABLED(CONFIG_ENV_IS_NOWHERE)
+#if !IS_ENABLED_NOCHECK(CONFIG_ENV_IS_NOWHERE)
 #error Please enable CONFIG_ENV_IS_NOWHERE
 #endif
 
Signature · 1 line
2.34.1
Reviewed-by on v2 13/26
#25 lore raw

Re: [PATCH v2 13/26] ringneck-px30: use IS_ENABLED_NOCHECK to avoid CI test failure for ENV_IS_NOWHERE

Quoted 5 lines · Troy Kisky

When usage_of_is_enabled_check.sh is added, this will show a false positive for IS_ENABLED(CONFIG_ENV_IS_NOWHERE).
Use IS_ENABLED_NOCHECK to avoid check and error on SPL builds.

Quoted 8 lines

---

Changes in v2:
- keep #error, but change condition to use IS_ENABLED_NOCHECK

 board/theobroma-systems/ringneck_px30/ringneck-px30.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
author
#26 lore raw

PATCH v2 14/26 puma-rk3399: use IS_ENABLED_NOCHECK to avoid CI test failure for ENV_IS_NOWHERE

In reply to Troy Kisky

When usage_of_is_enabled_check.sh is added, this will show a false positive for IS_ENABLED(CONFIG_ENV_IS_NOWHERE).
Use IS_ENABLED_NOCHECK to avoid check and error on SPL builds.

---

Changes in v2:
- keep #error, but change condition to use IS_ENABLED_NOCHECK

 board/theobroma-systems/puma_rk3399/puma-rk3399.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/theobroma-systems/puma_rk3399/puma-rk3399.c +1 -1
index 97f398bd754..d1e3a544974 100644
@@ -136,7 +136,7 @@ int mmc_get_env_dev(void)
 	return CONFIG_SYS_MMC_ENV_DEV;
 }
 
-#if !IS_ENABLED(CONFIG_ENV_IS_NOWHERE)
+#if !IS_ENABLED_NOCHECK(CONFIG_ENV_IS_NOWHERE)
 #error Please enable CONFIG_ENV_IS_NOWHERE
 #endif
 
Signature · 1 line
2.34.1
Reviewed-by on v2 14/26
#27 lore raw

Re: [PATCH v2 14/26] puma-rk3399: use IS_ENABLED_NOCHECK to avoid CI test failure for ENV_IS_NOWHERE

Quoted 5 lines · Troy Kisky

When usage_of_is_enabled_check.sh is added, this will show a false positive for IS_ENABLED(CONFIG_ENV_IS_NOWHERE).
Use IS_ENABLED_NOCHECK to avoid check and error on SPL builds.

Quoted 8 lines

---

Changes in v2:
- keep #error, but change condition to use IS_ENABLED_NOCHECK

 board/theobroma-systems/puma_rk3399/puma-rk3399.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#28 lore raw

Re: [PATCH v2 14/26] puma-rk3399: use IS_ENABLED_NOCHECK to avoid CI test failure for ENV_IS_NOWHERE

In reply to Troy Kisky
Quoted 4 lines · Troy Kisky

When usage_of_is_enabled_check.sh is added, this will show a false positive for IS_ENABLED(CONFIG_ENV_IS_NOWHERE).
Use IS_ENABLED_NOCHECK to avoid check and error on SPL builds.

Quoted 8 lines

---

Changes in v2:
- keep #error, but change condition to use IS_ENABLED_NOCHECK

 board/theobroma-systems/puma_rk3399/puma-rk3399.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

As I said against v1, the platform needs to select ENV_IS_NOWHERE.

Signature · 1 line
Tom
author
#29 lore raw

PATCH v2 15/26 fdt_support: always define fdt_fixup_mtdparts

In reply to Troy Kisky

SPL code wants fdt_fixup_mtdparts defined as a NOP when the function isn't linked in.

Prepare for ifdef CONFIG_OF_LIBFDT being converted to
if CONFIG_IS_ENABLED(OF_LIBFDT)

---

(no changes since v1)

 include/fdt_support.h | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
include/fdt_support.h +13 -10
index eeb83e6251d..94497d755a3 100644
@@ -245,16 +245,6 @@ int fdt_increase_size(void *fdt, int add_len);
 int fdt_delete_disabled_nodes(void *blob);
 
 struct node_info;
-#if defined(CONFIG_FDT_FIXUP_PARTITIONS)
-void fdt_fixup_mtdparts(void *fdt, const struct node_info *node_info,
-			int node_info_size);
-#else
-static inline void fdt_fixup_mtdparts(void *fdt,
-				      const struct node_info *node_info,
-				      int node_info_size)
-{
-}
-#endif
 
 void fdt_del_node_and_alias(void *blob, const char *alias);
 
@@ -412,6 +402,19 @@ int fdt_get_cells_len(const void *blob, char *nr_cells_name);
 
 #endif /* ifdef CONFIG_OF_LIBFDT */
 
+#if CONFIG_IS_ENABLED(OF_LIBFDT) && defined(CONFIG_FDT_FIXUP_PARTITIONS)
+struct node_info;
+void fdt_fixup_mtdparts(void *fdt, const struct node_info *node_info,
+			int node_info_size);
+#else
+struct node_info;
+static inline void fdt_fixup_mtdparts(void *fdt,
+				      const struct node_info *node_info,
+				      int node_info_size)
+{
+}
+#endif
+
 #ifdef USE_HOSTCC
 int fdtdec_get_int(const void *blob, int node, const char *prop_name,
 		int default_val);
Signature · 1 line
2.34.1
author
#30 lore raw

PATCH v2 16/26 m53menlo: define ft_board_setup only if CONFIG_IS_ENABLED(OF_LIBFDT)

In reply to Troy Kisky

The function ft_board_setup calls do_fixup_by_path_string which is only available on CONFIG_IS_ENABLED(OF_LIBFDT). This prepares for the conversion.

ft_board_setup is only called from image-fdt which is linked by obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += image-fdt.o

---

(no changes since v1)

 board/menlo/m53menlo/m53menlo.c | 2 ++
 1 file changed, 2 insertions(+)
board/menlo/m53menlo/m53menlo.c +2 -0
index 14324c7087d..ca3b81c57ff 100644
@@ -264,6 +264,7 @@ void board_preboot_os(void)
 	gpio_direction_output(IMX_GPIO_NR(6, 0), 0);
 }
 
+#if CONFIG_IS_ENABLED(OF_LIBFDT)
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
 	if (lvds_compat_string)
@@ -272,6 +273,7 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 
 	return 0;
 }
+#endif
 
 struct display_info_t const displays[] = {
 	{
Signature · 1 line
2.34.1
author
#31 lore raw

PATCH v2 17/26 freescale: common: pfuze: define pfuze_mode_init only if defined(CONFIG_DM_PMIC)

In reply to Troy Kisky

pfuze_mode_init calls pmic_reg_read which is only available from

obj-$(CONFIG_$(SPL_TPL_)DM_PMIC) += pmic-uclass.o

Prepare for conversion of defined(CONFIG_DM_PMIC) to CONFIG_IS_ENABLED(DM_PMIC).

---

(no changes since v1)

 board/freescale/common/pfuze.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/freescale/common/pfuze.c +1 -1
index 6dca22960bf..a9288820b2e 100644
@@ -91,7 +91,7 @@ struct pmic *pfuze_common_init(unsigned char i2cbus)
 
 	return p;
 }
-#else
+#elif defined(CONFIG_DM_PMIC)
 int pfuze_mode_init(struct udevice *dev, u32 mode)
 {
 	unsigned char offset, i, switch_num;
Signature · 1 line
2.34.1
author
#32 lore raw

PATCH v2 18/26 ns16550: match when to define bdf with uart code

In reply to Troy Kisky

When switching defined(CONFIG_PCI) to CONFIG_IS_ENABLED(PCI) bdf is no longer accessible. So add preprocessor protection to avoid access.

---

Changes in v2:
- changed condition of when to include field bdf
- added protection to another instance of bdf in uart.c
- Thanks to Simon for getting this corrected

 arch/x86/cpu/apollolake/uart.c | 4 ++++
 include/ns16550.h              | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
arch/x86/cpu/apollolake/uart.c +4 -0
index a9362436000..878aa48ed76 100644
@@ -79,10 +79,12 @@ void apl_uart_init(pci_dev_t bdf, ulong base)
 
 static int apl_ns16550_probe(struct udevice *dev)
 {
+#if IS_ENABLED_NOCHECK(CONFIG_PCI) && defined(CONFIG_SPL_BUILD)
 	struct apl_ns16550_plat *plat = dev_get_plat(dev);
 
 	if (!CONFIG_IS_ENABLED(PCI))
 		apl_uart_init(plat->ns16550.bdf, plat->ns16550.base);
+#endif
 
 	return ns16550_serial_probe(dev);
 }
@@ -110,7 +112,9 @@ static int apl_ns16550_of_to_plat(struct udevice *dev)
 	ns.reg_offset = 0;
 	ns.clock = dtplat->clock_frequency;
 	ns.fcr = UART_FCR_DEFVAL;
+#if IS_ENABLED_NOCHECK(CONFIG_PCI) && defined(CONFIG_SPL_BUILD)
 	ns.bdf = pci_ofplat_get_devfn(dtplat->reg[0]);
+#endif
 	memcpy(plat, &ns, sizeof(ns));
 #else
 	int ret;
include/ns16550.h +1 -1
index e7e68663d03..41b977b5b26 100644
@@ -74,7 +74,7 @@ struct ns16550_plat {
 	int clock;
 	u32 fcr;
 	int flags;
-#if defined(CONFIG_PCI) && defined(CONFIG_SPL)
+#if IS_ENABLED_NOCHECK(CONFIG_PCI) && defined(CONFIG_SPL_BUILD)
 	int bdf;
 #endif
 };
Signature · 1 line
2.34.1
author
#33 lore raw

PATCH v2 19/26 solidrun: mx6cuboxi: use CONFIG_IS_ENABLED(SATA) instead of CONFIG_CMD_SATA

In reply to Troy Kisky

setup_sata is linked with
obj-$(CONFIG_SATA) += sata.o

So use SATA instead of CMD_SATA.

---

Changes in v2:
- use normal if, not preprocessor

 board/solidrun/mx6cuboxi/mx6cuboxi.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
board/solidrun/mx6cuboxi/mx6cuboxi.c +2 -3
index 7c44379ec4a..6fa5cf4d27d 100644
@@ -275,9 +275,8 @@ int board_early_init_f(void)
 {
 	setup_iomux_uart();
 
-#ifdef CONFIG_CMD_SATA
-	setup_sata();
-#endif
+	if (CONFIG_IS_ENABLED(SATA))
+		setup_sata();
 	setup_fec();
 
 	return 0;
Signature · 1 line
2.34.1
Reviewed-by on v2 19/26
#34 lore raw

Re: [PATCH v2 19/26] solidrun: mx6cuboxi: use CONFIG_IS_ENABLED(SATA) instead of CONFIG_CMD_SATA

Quoted 6 lines · Troy Kisky

setup_sata is linked with
obj-$(CONFIG_SATA) += sata.o

So use SATA instead of CMD_SATA.

Quoted 8 lines

---

Changes in v2:
- use normal if, not preprocessor

 board/solidrun/mx6cuboxi/mx6cuboxi.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
author
#35 lore raw

PATCH v2 20/26 wandboard: use CONFIG_IS_ENABLED(SATA) instead of ifdef CONFIG_SATA

In reply to Troy Kisky

Prepare for linking setup_sata only when CONFIG_SATA/CONFIG_SPL_SATA is defined.

---

Changes in v2:
- new in series

 board/wandboard/wandboard.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
board/wandboard/wandboard.c +2 -3
index da995dd0f58..48914450a29 100644
@@ -352,9 +352,8 @@ static void setup_display(void)
 int board_early_init_f(void)
 {
 	setup_iomux_uart();
-#ifdef CONFIG_SATA
-	setup_sata();
-#endif
+	if (CONFIG_IS_ENABLED(SATA))
+		setup_sata();
 
 	return 0;
 }
Signature · 1 line
2.34.1
Reviewed-by on v2 20/26
#36 lore raw

Re: [PATCH v2 20/26] wandboard: use CONFIG_IS_ENABLED(SATA) instead of ifdef CONFIG_SATA

Quoted 4 lines · Troy Kisky

Prepare for linking setup_sata only when CONFIG_SATA/CONFIG_SPL_SATA is defined.

Quoted 8 lines

---

Changes in v2:
- new in series

 board/wandboard/wandboard.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
author
#37 lore raw

PATCH v2 21/26 arm: mach-imx: use CONFIG_$(SPL_)SATA instead of CONFIG_SATA

In reply to Troy Kisky

This avoid an error with enable_sata_clock when defined(CONFIG_SATA) is changed to CONFIG_IS_ENABLED(SATA).

---

(no changes since v1)

 arch/arm/mach-imx/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/Makefile +1 -1
index 4dfc60eedc4..50f26975eac 100644
@@ -54,7 +54,7 @@ obj-$(CONFIG_IMX_RDC) += rdc-sema.o
 ifneq ($(CONFIG_SPL_BUILD),y)
 obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o
 endif
-obj-$(CONFIG_SATA) += sata.o
+obj-$(CONFIG_$(SPL_)SATA) += sata.o
 obj-$(CONFIG_IMX_HAB)    += hab.o
 obj-$(CONFIG_SYSCOUNTER_TIMER) += syscounter.o
 endif
Signature · 1 line
2.34.1
author
#38 lore raw

PATCH v2 22/26 x86: cpu: i386: cpu: only set pci_ram_top if CONFIG_IS_ENABLED(PCI)

In reply to Troy Kisky

This avoids an error when ifdef CONFIG_PCI is changed to if CONFIG_IS_ENABLED(PCI)

---

Changes in v2:
- use an accessor function gd_set_pci_ram_top

 arch/x86/cpu/i386/cpu.c           | 2 +-
 include/asm-generic/global_data.h | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
arch/x86/cpu/i386/cpu.c +1 -1
index c7f6c5a013e..068670dfc41 100644
@@ -415,7 +415,7 @@ int cpu_phys_address_size(void)
 /* Don't allow PCI region 3 to use memory in the 2-4GB memory hole */
 static void setup_pci_ram_top(void)
 {
-	gd->pci_ram_top = 0x80000000U;
+	gd_set_pci_ram_top(0x80000000U);
 }
 
 static void setup_mtrr(void)
include/asm-generic/global_data.h +6 -0
index 987fb66c17a..952e17b2c13 100644
@@ -560,6 +560,12 @@ static_assert(sizeof(struct global_data) == GD_SIZE);
 #define gd_event_state()	NULL
 #endif
 
+#if CONFIG_IS_ENABLED(PCI)
+#define gd_set_pci_ram_top(val)	gd->pci_ram_top = val
+#else
+#define gd_set_pci_ram_top(val)
+#endif
+
 /**
  * enum gd_flags - global data flags
  *
Signature · 1 line
2.34.1
Reviewed-by on v2 22/26
#39 lore raw

Re: [PATCH v2 22/26] x86: cpu: i386: cpu: only set pci_ram_top if CONFIG_IS_ENABLED(PCI)

Quoted 5 lines · Troy Kisky

This avoids an error when ifdef CONFIG_PCI is changed to if CONFIG_IS_ENABLED(PCI)

Quoted 9 lines

---

Changes in v2:
- use an accessor function gd_set_pci_ram_top

 arch/x86/cpu/i386/cpu.c           | 2 +-
 include/asm-generic/global_data.h | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
author
#40 lore raw

PATCH v2 23/26 gateworks: venice: Always define setup_fec and setup_eqos

In reply to Troy Kisky

The compiler will optimize away base on IS_ENABLED(CONFIG_FEC_MXC). It avoids an error in converting to CONFIG_IS_ENABLED(NET).

---

Changes in v2:
- Always define function instead of using same protection

 board/gateworks/venice/venice.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/gateworks/venice/venice.c +1 -1
index c4d86c26a9b..7a819e76a1c 100644
@@ -41,7 +41,6 @@ int board_fit_config_name_match(const char *name)
 	return -1;
 }
 
-#if (IS_ENABLED(CONFIG_NET))
 static int setup_fec(void)
 {
 	struct iomuxc_gpr_base_regs *gpr =
@@ -71,6 +70,7 @@ static int setup_eqos(void)
 	return set_clk_eqos(ENET_125MHZ);
 }
 
+#if IS_ENABLED(CONFIG_NET)
 int board_phy_config(struct phy_device *phydev)
 {
 	unsigned short val;
Signature · 1 line
2.34.1
Reviewed-by on v2 23/26
#41 lore raw

Re: [PATCH v2 23/26] gateworks: venice: Always define setup_fec and setup_eqos

Quoted 4 lines · Troy Kisky

The compiler will optimize away base on IS_ENABLED(CONFIG_FEC_MXC). It avoids an error in converting to CONFIG_IS_ENABLED(NET).

Quoted 8 lines

---

Changes in v2:
- Always define function instead of using same protection

 board/gateworks/venice/venice.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
author
#42 lore raw

PATCH v2 24/26 power: pmic: add dm style definitions if not CONFIG_IS_ENABLED(POWER_LEGACY)

In reply to Troy Kisky

This avoids an error in converting to CONFIG_IS_ENABLED(DM_PMIC). Many boards SPL code needs these definitions to compile, even if the functions are not linked.

---

(no changes since v1)

 include/power/pmic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/power/pmic.h +1 -1
index 70f2709bd0b..636221692d0 100644
@@ -86,7 +86,7 @@ struct pmic {
 #endif /* CONFIG_IS_ENABLED(POWER_LEGACY) */
 
 /* TODO: Change to CONFIG_IS_ENABLED(DM_PMIC) when SPL_DM_PMIC exists */
-#ifdef CONFIG_DM_PMIC
+#if defined(CONFIG_DM_PMIC) || !CONFIG_IS_ENABLED(POWER_LEGACY)
 /**
  * U-Boot PMIC Framework
  * =====================
Signature · 1 line
2.34.1
author
#43 lore raw

PATCH v2 25/26 arm: cpu: armv7: ls102xa: fdt: remove eth_device support

In reply to Troy Kisky

commit e524f3a449f5 ("net: Remove eth_legacy.c")

removed struct eth_device
This prevents errors in the conversion to CONFIG_IS_ENABLED(DM_ETH).

---

(no changes since v1)

 arch/arm/cpu/armv7/ls102xa/fdt.c | 12 ------------
 1 file changed, 12 deletions(-)
arch/arm/cpu/armv7/ls102xa/fdt.c +0 -12
index 599b7e18ef3..a5c5c780ae8 100644
@@ -25,11 +25,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 void ft_fixup_enet_phy_connect_type(void *fdt)
 {
-#ifdef CONFIG_DM_ETH
 	struct udevice *dev;
-#else
-	struct eth_device *dev;
-#endif
 	struct tsec_private *priv;
 	const char *enet_path, *phy_path;
 	char enet[16];
@@ -37,12 +33,8 @@ void ft_fixup_enet_phy_connect_type(void *fdt)
 	int phy_node;
 	int i = 0;
 	uint32_t ph;
-#ifdef CONFIG_DM_ETH
 	char *name[3] = { "ethernet@2d10000", "ethernet@2d50000",
 			  "ethernet@2d90000" };
-#else
-	char *name[3] = { "eTSEC1", "eTSEC2", "eTSEC3" };
-#endif
 
 	for (; i < ARRAY_SIZE(name); i++) {
 		dev = eth_get_dev_by_name(name[i]);
@@ -53,11 +45,7 @@ void ft_fixup_enet_phy_connect_type(void *fdt)
 			continue;
 		}
 
-#ifdef CONFIG_DM_ETH
 		priv = dev_get_priv(dev);
-#else
-		priv = dev->priv;
-#endif
 		if (priv->flags & TSEC_SGMII)
 			continue;
 
Signature · 1 line
2.34.1
author
#44 lore raw

PATCH v2 26/26 CI: add test/usage_of_is_enabled_check.sh

In reply to Troy Kisky

Add script usage_of_is_enabled_check to print any configs that use CONFIG_IS_ENABLED instead of IS_ENABLED and vice versa.

Add usage_of_is_enabled_commit.sh to generate commits to fix the above issues.

You can remove entries from test/usage_of_is_enabled_todo.txt or the entire file and then run test/usage_of_is_enabled_commit.sh
to convert to suggested usage of CONFIG_IS_ENABLED/IS_ENABLED

or run test/usage_of_is_enabled_check.sh to
see which configs are still todo.

---

(no changes since v1)

 .azure-pipelines.yml                |  11 ++
 .gitlab-ci.yml                      |   5 +
 test/usage_of_is_enabled_check.sh   |  19 +++
 test/usage_of_is_enabled_commit.sh  |  12 ++
 test/usage_of_is_enabled_correct.sh |  50 +++++++
 test/usage_of_is_enabled_exempt.txt |   9 ++
 test/usage_of_is_enabled_list.sh    |  86 ++++++++++++
 test/usage_of_is_enabled_splcfg.txt |  21 +++
 test/usage_of_is_enabled_todo.txt   | 210 ++++++++++++++++++++++++++++
 9 files changed, 423 insertions(+)
 create mode 100755 test/usage_of_is_enabled_check.sh
 create mode 100755 test/usage_of_is_enabled_commit.sh
 create mode 100755 test/usage_of_is_enabled_correct.sh
 create mode 100644 test/usage_of_is_enabled_exempt.txt
 create mode 100755 test/usage_of_is_enabled_list.sh
 create mode 100644 test/usage_of_is_enabled_splcfg.txt
 create mode 100644 test/usage_of_is_enabled_todo.txt
.azure-pipelines.yml +11 -0
index 8327edf87aa..3f216d82a7e 100644
@@ -67,6 +67,17 @@ stages:
                   :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h
                   :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0
 
+  - job: check_usage_of_is_enabled
+    displayName: 'Check usage of CONFIG_IS_ENABLED vs IS_ENABLED'
+    pool:
+      vmImage: $(ubuntu_vm)
+    container:
+      image: $(ci_runner_image)
+      options: $(container_option)
+    steps:
+      # generate list of SPL configs
+      - script: test/usage_of_is_enabled_check.sh
+
   - job: cppcheck
     displayName: 'Static code analysis with cppcheck'
     pool:
.gitlab-ci.yml +5 -0
index c3ceca2974d..57330060b82 100644
@@ -137,6 +137,11 @@ check for new CONFIG symbols outside Kconfig:
         :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h
         :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0
 
+check usage of CONFIG_IS_ENABLED vs IS_ENABLED:
+  stage: testsuites
+  script:
+    - ./test/usage_of_is_enabled_check.sh
+
 # QA jobs for code analytics
 # static code analysis with cppcheck (we can add --enable=all later)
 cppcheck:
test/usage_of_is_enabled_check.sh new file +19 -0
new file mode 100755
index 00000000000..6bd5d9c1ac7
@@ -0,0 +1,19 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Written by Troy Kisky <[email protected]>
+
+scriptdir=`dirname "$0"`;
+${scriptdir}/usage_of_is_enabled_list.sh | grep -vw FOO;
+if [ $? -eq 0 ] ; then
+	echo "The above may have incorrect usage of IS_ENABLED/"\
+"CONFIG_IS_ENABLED"
+	echo "Run test/usage_of_is_enabled_commit.sh and "\
+"squash with appropriate commit"
+	ret=1;
+else
+	ret=0;
+fi
+
+rm ${scriptdir}/splcfg.tmp ${scriptdir}/exclude.tmp
+exit ${ret}
test/usage_of_is_enabled_commit.sh new file +12 -0
new file mode 100755
index 00000000000..593dbd1428c
@@ -0,0 +1,12 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Written by Troy Kisky <[email protected]>
+
+scriptdir=`dirname "$0"`;
+${scriptdir}/usage_of_is_enabled_list.sh | \
+xargs -I {} sh -c "${scriptdir}/usage_of_is_enabled_correct.sh {}; \
+git commit -a -m\"CONFIG_{}: correct usage of CONFIG_IS_ENABLED/IS_ENABLED\";"
+
+
+rm ${scriptdir}/splcfg.tmp ${scriptdir}/exclude.tmp
test/usage_of_is_enabled_correct.sh new file +50 -0

50 lines not on this page · raw message

test/usage_of_is_enabled_exempt.txt new file +9 -0
new file mode 100644
index 00000000000..d9fefd6cb6c
@@ -0,0 +1,9 @@
+BLOBLIST
+BLOBLIST_FIXED
+DM_PMIC_PFUZE100
+FOO
+NAND_BOOT
+OF_CONTROL
+SYS_L2_PL310
+WATCHDOG
+X86_64
test/usage_of_is_enabled_list.sh new file +86 -0

86 lines not on this page · raw message

test/usage_of_is_enabled_splcfg.txt new file +21 -0
new file mode 100644
index 00000000000..29d6257c5c7
@@ -0,0 +1,21 @@
+BZIP2
+CONFIG_CLK
+CONSOLE_MUX
+DM_EVENT
+DM_HWSPINLOCK
+DM_RNG
+DM_STDIO
+EFI_DEVICE_PATH_TO_TEXT
+EFI_LOADER
+ERRNO_STR
+EVENT_DYNAMIC
+GENERATE_SMBIOS_TABLE
+IOMMU
+MMC_HW_PARTITIONING
+NAND_CS_INIT
+OFNODE_MULTI_TREE
+PINCTRL_ARMADA_38X
+PRE_CONSOLE_BUFFER
+RESET_MEDIATEK
+RESET_ROCKCHIP
+UT_DM
test/usage_of_is_enabled_todo.txt new file +210 -0

210 lines not on this page · raw message

Signature · 1 line
2.34.1