All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 00/13] kconfig: Add some new macros
@ 2022-01-16 20:19 Simon Glass
  2022-01-16 20:19 ` [PATCH v4 01/13] imx: Don't define __ASSEMBLY__ in C files Simon Glass
                   ` (12 more replies)
  0 siblings, 13 replies; 20+ messages in thread
From: Simon Glass @ 2022-01-16 20:19 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Rasmus Villemoes, Simon Glass, Adam Ford,
	Adrian Alonso, Alexandru Gagniuc, Anatolij Gustschin,
	Angelo Dureghello, Arkadiusz Karas, Daniel Schwierzeck,
	Fabio Estevam, Frieder Schrempf, Giulio Benetti, Heiko Schocher,
	Heinrich Schuchardt, Ian Ray, Ilko Iliev, Jaehoon Chung,
	Marcel Ziswiler, Marek Vasut, Markus Niebel, Martyn Welch,
	Masahiro Yamada, NXP i.MX U-Boot Team, Oleh Kravchenko,
	Oliver Graute, Otavio Salvador, Patrick Delaunay, Patrick Wildt,
	Peng Fan, Richard Hu, Sean Anderson, Shawn Guo, Silvio Fricke,
	Soeren Moch, Stefano Babic, Steffen Jaeckel, Teresa Remmet,
	Tim Harvey, Troy Kisky, Walter Lozano, Ying-Chun Liu (PaulLiu)

This series adds a few more macros to kconfig, along with a bit of
refactoring of what is there.

It also adds some basic tests for the kconfig macros.

Finally, to make the tests work, it enhances buildman to support changing
CONFIG options on the fly when building.

Changes in v4:
- Update stale mention of zero in commit message
- Update stale comments in the header file
- Define the macros even in assembly context
- Expand the series with tests and buildman changes

Changes in v3:
- Add a way to detect use of a non-existent value
- Add new patch to update bloblist to use conditional value

Simon Glass (13):
  imx: Don't define __ASSEMBLY__ in C files
  mips: Avoid using config_enabled() directly
  mmc: fsl: Use brackets around if()
  kconfig: Update IS_ENABLED() internals
  kconfig: Add support for conditional values
  bloblist: Update to use conditional value
  patman: Update test_util to run doc tests
  buildman: Add a flag to control the traceback
  buildman: Make use of test_util
  buildman: Add helper functions for updating .config files
  buildman: Provide a hint on how to debug thread crashes
  buildman: Allow adjusting board config on the fly
  test: Add some tests for kconfig.h

 arch/arm/mach-imx/Makefile                    |   2 +-
 .../mach-imx/imx8m/imximage-8mm-lpddr4.cfg    |   1 -
 arch/arm/mach-imx/imx8m/imximage-8mn-ddr4.cfg |   1 -
 .../mach-imx/imx8m/imximage-8mn-lpddr4.cfg    |   1 -
 .../mach-imx/imx8m/imximage-8mp-lpddr4.cfg    |   1 -
 arch/arm/mach-imx/imx8m/imximage.cfg          |   1 -
 arch/arm/mach-imx/spl_qspi.cfg                |   1 -
 arch/arm/mach-imx/spl_sd.cfg                  |   1 -
 arch/mips/lib/cache.c                         |   2 +-
 .../advantech/imx8qm_rom7720_a1/imximage.cfg  |   1 -
 board/aristainetos/aristainetos2.cfg          |   1 -
 board/beacon/imx8mm/imximage-8mm-lpddr4.cfg   |   1 -
 board/beacon/imx8mn/imximage-8mn-lpddr4.cfg   |   1 -
 board/boundary/nitrogen6x/nitrogen6dl.cfg     |   1 -
 board/boundary/nitrogen6x/nitrogen6dl2g.cfg   |   1 -
 board/boundary/nitrogen6x/nitrogen6q.cfg      |   1 -
 board/boundary/nitrogen6x/nitrogen6q2g.cfg    |   1 -
 board/boundary/nitrogen6x/nitrogen6s.cfg      |   1 -
 board/boundary/nitrogen6x/nitrogen6s1g.cfg    |   1 -
 .../imximage-8mm-lpddr4.cfg                   |   1 -
 board/congatec/cgtqmx8/imximage.cfg           |   1 -
 board/ea/mx7ulp_com/imximage.cfg              |   1 -
 .../imx8mm_evk/imximage-8mm-lpddr4.cfg        |   1 -
 .../imx8mn_evk/imximage-8mn-ddr4.cfg          |   1 -
 .../imx8mp_evk/imximage-8mp-lpddr4.cfg        |   1 -
 board/freescale/imx8qm_mek/imximage.cfg       |   1 -
 .../freescale/imx8qm_mek/uboot-container.cfg  |   1 -
 board/freescale/imx8qxp_mek/imximage.cfg      |   1 -
 .../freescale/imx8qxp_mek/uboot-container.cfg |   1 -
 board/freescale/imxrt1020-evk/imximage.cfg    |   1 -
 board/freescale/imxrt1050-evk/imximage.cfg    |   1 -
 board/freescale/mx6slevk/imximage.cfg         |   1 -
 board/freescale/mx6sllevk/imximage.cfg        |   1 -
 board/freescale/mx6sxsabreauto/imximage.cfg   |   1 -
 board/freescale/mx6sxsabresd/imximage.cfg     |   1 -
 board/freescale/mx6ullevk/imximage.cfg        |   1 -
 board/freescale/mx7dsabresd/imximage.cfg      |   1 -
 board/freescale/mx7ulp_evk/imximage.cfg       |   1 -
 .../gateworks/venice/imximage-8mm-lpddr4.cfg  |   1 -
 board/ge/bx50v3/bx50v3.cfg                    |   1 -
 board/kontron/sl-mx8mm/imximage.cfg           |   1 -
 board/novtech/meerkat96/imximage.cfg          |   1 -
 .../out4/o4-imx6ull-nano/K4B4G1646D-BCMA.cfg  |   1 -
 .../o4-imx6ull-nano/MT41K256M16HA-125E.cfg    |   1 -
 .../phytec/phycore_imx8mm/imximage-8mm-sd.cfg |   1 -
 .../phytec/phycore_imx8mp/imximage-8mp-sd.cfg |   1 -
 .../ronetix/imx8mq-cm/imximage-8mq-lpddr4.cfg |   1 -
 board/siemens/capricorn/imximage.cfg          |   1 -
 board/siemens/capricorn/uboot-container.cfg   |   1 -
 board/softing/vining_2000/imximage.cfg        |   1 -
 board/somlabs/visionsom-6ull/imximage.cfg     |   1 -
 board/storopack/smegw01/imximage.cfg          |   1 -
 board/tbs/tbs2910/tbs2910.cfg                 |   1 -
 board/technexion/pico-imx6ul/imximage.cfg     |   1 -
 .../apalis-imx8/apalis-imx8-imximage.cfg      |   1 -
 .../apalis-imx8x/apalis-imx8x-imximage.cfg    |   1 -
 board/toradex/colibri-imx6ull/imximage.cfg    |   1 -
 .../colibri-imx8x/colibri-imx8x-imximage.cfg  |   1 -
 board/toradex/colibri_imx7/imximage.cfg       |   1 -
 board/toradex/verdin-imx8mm/imximage.cfg      |   1 -
 board/tq/tqma6/tqma6dl.cfg                    |   1 -
 board/tq/tqma6/tqma6q.cfg                     |   1 -
 board/tq/tqma6/tqma6s.cfg                     |   1 -
 board/warp/imximage.cfg                       |   1 -
 board/warp7/imximage.cfg                      |   1 -
 common/bloblist.c                             |  15 +-
 drivers/mmc/fsl_esdhc_imx.c                   |   2 +-
 include/bloblist.h                            |  10 -
 include/linux/kconfig.h                       |  52 +++-
 scripts/Makefile.autoconf                     |   2 +-
 test/Kconfig                                  |   1 +
 test/Makefile                                 |   2 +-
 test/lib/Kconfig                              |  23 ++
 test/lib/Makefile                             |   5 +
 test/lib/kconfig.c                            |  58 +++++
 test/lib/kconfig_spl.c                        |  44 ++++
 test/py/tests/test_kconfig.py                 |  34 +++
 tools/buildman/README                         |  49 ++++
 tools/buildman/builder.py                     |  14 +-
 tools/buildman/builderthread.py               |  32 ++-
 tools/buildman/cfgutil.py                     | 235 ++++++++++++++++++
 tools/buildman/cmdline.py                     |   4 +
 tools/buildman/control.py                     |   6 +-
 tools/buildman/func_test.py                   |   8 +-
 tools/buildman/main.py                        |  29 ++-
 tools/buildman/test.py                        | 123 +++++++++
 tools/dtoc/main.py                            |   2 +-
 tools/patman/main.py                          |  20 +-
 tools/patman/test_util.py                     |  17 +-
 89 files changed, 715 insertions(+), 139 deletions(-)
 create mode 100644 test/lib/Kconfig
 create mode 100644 test/lib/kconfig.c
 create mode 100644 test/lib/kconfig_spl.c
 create mode 100644 test/py/tests/test_kconfig.py
 create mode 100644 tools/buildman/cfgutil.py

-- 
2.34.1.703.g22d0c6ccf7-goog


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v4 01/13] imx: Don't define __ASSEMBLY__ in C files
  2022-01-16 20:19 [PATCH v4 00/13] kconfig: Add some new macros Simon Glass
@ 2022-01-16 20:19 ` Simon Glass
  2022-01-17 13:53   ` Tom Rini
  2022-01-16 20:19 ` [PATCH v4 02/13] mips: Avoid using config_enabled() directly Simon Glass
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 20+ messages in thread
From: Simon Glass @ 2022-01-16 20:19 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Rasmus Villemoes, Simon Glass, Adam Ford,
	Adrian Alonso, Anatolij Gustschin, Arkadiusz Karas,
	Fabio Estevam, Frieder Schrempf, Giulio Benetti, Heiko Schocher,
	Ian Ray, Ilko Iliev, Marcel Ziswiler, Marek Vasut, Markus Niebel,
	Martyn Welch, NXP i.MX U-Boot Team, Oleh Kravchenko,
	Oliver Graute, Otavio Salvador, Patrick Wildt, Peng Fan,
	Richard Hu, Shawn Guo, Silvio Fricke, Soeren Moch, Stefano Babic,
	Teresa Remmet, Tim Harvey, Troy Kisky, Ying-Chun Liu (PaulLiu)

This is supposed to be a build-system flag. Move it there so we can
define it before linux/kconfig.h is included.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 arch/arm/mach-imx/Makefile                                | 2 +-
 arch/arm/mach-imx/imx8m/imximage-8mm-lpddr4.cfg           | 1 -
 arch/arm/mach-imx/imx8m/imximage-8mn-ddr4.cfg             | 1 -
 arch/arm/mach-imx/imx8m/imximage-8mn-lpddr4.cfg           | 1 -
 arch/arm/mach-imx/imx8m/imximage-8mp-lpddr4.cfg           | 1 -
 arch/arm/mach-imx/imx8m/imximage.cfg                      | 1 -
 arch/arm/mach-imx/spl_qspi.cfg                            | 1 -
 arch/arm/mach-imx/spl_sd.cfg                              | 1 -
 board/advantech/imx8qm_rom7720_a1/imximage.cfg            | 1 -
 board/aristainetos/aristainetos2.cfg                      | 1 -
 board/beacon/imx8mm/imximage-8mm-lpddr4.cfg               | 1 -
 board/beacon/imx8mn/imximage-8mn-lpddr4.cfg               | 1 -
 board/boundary/nitrogen6x/nitrogen6dl.cfg                 | 1 -
 board/boundary/nitrogen6x/nitrogen6dl2g.cfg               | 1 -
 board/boundary/nitrogen6x/nitrogen6q.cfg                  | 1 -
 board/boundary/nitrogen6x/nitrogen6q2g.cfg                | 1 -
 board/boundary/nitrogen6x/nitrogen6s.cfg                  | 1 -
 board/boundary/nitrogen6x/nitrogen6s1g.cfg                | 1 -
 board/compulab/imx8mm-cl-iot-gate/imximage-8mm-lpddr4.cfg | 1 -
 board/congatec/cgtqmx8/imximage.cfg                       | 1 -
 board/ea/mx7ulp_com/imximage.cfg                          | 1 -
 board/freescale/imx8mm_evk/imximage-8mm-lpddr4.cfg        | 1 -
 board/freescale/imx8mn_evk/imximage-8mn-ddr4.cfg          | 1 -
 board/freescale/imx8mp_evk/imximage-8mp-lpddr4.cfg        | 1 -
 board/freescale/imx8qm_mek/imximage.cfg                   | 1 -
 board/freescale/imx8qm_mek/uboot-container.cfg            | 1 -
 board/freescale/imx8qxp_mek/imximage.cfg                  | 1 -
 board/freescale/imx8qxp_mek/uboot-container.cfg           | 1 -
 board/freescale/imxrt1020-evk/imximage.cfg                | 1 -
 board/freescale/imxrt1050-evk/imximage.cfg                | 1 -
 board/freescale/mx6slevk/imximage.cfg                     | 1 -
 board/freescale/mx6sllevk/imximage.cfg                    | 1 -
 board/freescale/mx6sxsabreauto/imximage.cfg               | 1 -
 board/freescale/mx6sxsabresd/imximage.cfg                 | 1 -
 board/freescale/mx6ullevk/imximage.cfg                    | 1 -
 board/freescale/mx7dsabresd/imximage.cfg                  | 1 -
 board/freescale/mx7ulp_evk/imximage.cfg                   | 1 -
 board/gateworks/venice/imximage-8mm-lpddr4.cfg            | 1 -
 board/ge/bx50v3/bx50v3.cfg                                | 1 -
 board/kontron/sl-mx8mm/imximage.cfg                       | 1 -
 board/novtech/meerkat96/imximage.cfg                      | 1 -
 board/out4/o4-imx6ull-nano/K4B4G1646D-BCMA.cfg            | 1 -
 board/out4/o4-imx6ull-nano/MT41K256M16HA-125E.cfg         | 1 -
 board/phytec/phycore_imx8mm/imximage-8mm-sd.cfg           | 1 -
 board/phytec/phycore_imx8mp/imximage-8mp-sd.cfg           | 1 -
 board/ronetix/imx8mq-cm/imximage-8mq-lpddr4.cfg           | 1 -
 board/siemens/capricorn/imximage.cfg                      | 1 -
 board/siemens/capricorn/uboot-container.cfg               | 1 -
 board/softing/vining_2000/imximage.cfg                    | 1 -
 board/somlabs/visionsom-6ull/imximage.cfg                 | 1 -
 board/storopack/smegw01/imximage.cfg                      | 1 -
 board/tbs/tbs2910/tbs2910.cfg                             | 1 -
 board/technexion/pico-imx6ul/imximage.cfg                 | 1 -
 board/toradex/apalis-imx8/apalis-imx8-imximage.cfg        | 1 -
 board/toradex/apalis-imx8x/apalis-imx8x-imximage.cfg      | 1 -
 board/toradex/colibri-imx6ull/imximage.cfg                | 1 -
 board/toradex/colibri-imx8x/colibri-imx8x-imximage.cfg    | 1 -
 board/toradex/colibri_imx7/imximage.cfg                   | 1 -
 board/toradex/verdin-imx8mm/imximage.cfg                  | 1 -
 board/tq/tqma6/tqma6dl.cfg                                | 1 -
 board/tq/tqma6/tqma6q.cfg                                 | 1 -
 board/tq/tqma6/tqma6s.cfg                                 | 1 -
 board/warp/imximage.cfg                                   | 1 -
 board/warp7/imximage.cfg                                  | 1 -
 64 files changed, 1 insertion(+), 64 deletions(-)

diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 07954bc2014..77e72702bba 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -91,7 +91,7 @@ $(PLUGIN).bin:
 endif
 
 quiet_cmd_cpp_cfg = CFGS    $@
-      cmd_cpp_cfg = $(CPP) $(cpp_flags) -x c -o $@ $<
+      cmd_cpp_cfg = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -x c -o $@ $<
 
 # mkimage source config file
 IMX_CONFIG = $(CONFIG_IMX_CONFIG:"%"=%)
diff --git a/arch/arm/mach-imx/imx8m/imximage-8mm-lpddr4.cfg b/arch/arm/mach-imx/imx8m/imximage-8mm-lpddr4.cfg
index 1a2e43e6718..e06d53ef417 100644
--- a/arch/arm/mach-imx/imx8m/imximage-8mm-lpddr4.cfg
+++ b/arch/arm/mach-imx/imx8m/imximage-8mm-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2019 NXP
  */
 
-#define __ASSEMBLY__
 
 FIT
 BOOT_FROM	sd
diff --git a/arch/arm/mach-imx/imx8m/imximage-8mn-ddr4.cfg b/arch/arm/mach-imx/imx8m/imximage-8mn-ddr4.cfg
index 1405c6560c7..120631a423a 100644
--- a/arch/arm/mach-imx/imx8m/imximage-8mn-ddr4.cfg
+++ b/arch/arm/mach-imx/imx8m/imximage-8mn-ddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2019 NXP
  */
 
-#define __ASSEMBLY__
 
 FIT
 ROM_VERSION	v2
diff --git a/arch/arm/mach-imx/imx8m/imximage-8mn-lpddr4.cfg b/arch/arm/mach-imx/imx8m/imximage-8mn-lpddr4.cfg
index 4c63b31db6d..7dae3fa93aa 100644
--- a/arch/arm/mach-imx/imx8m/imximage-8mn-lpddr4.cfg
+++ b/arch/arm/mach-imx/imx8m/imximage-8mn-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2019 NXP
  */
 
-#define __ASSEMBLY__
 
 FIT
 ROM_VERSION	v2
diff --git a/arch/arm/mach-imx/imx8m/imximage-8mp-lpddr4.cfg b/arch/arm/mach-imx/imx8m/imximage-8mp-lpddr4.cfg
index 586a5ff306d..0fba9f50f3e 100644
--- a/arch/arm/mach-imx/imx8m/imximage-8mp-lpddr4.cfg
+++ b/arch/arm/mach-imx/imx8m/imximage-8mp-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2019 NXP
  */
 
-#define __ASSEMBLY__
 
 FIT
 ROM_VERSION	v2
diff --git a/arch/arm/mach-imx/imx8m/imximage.cfg b/arch/arm/mach-imx/imx8m/imximage.cfg
index 2a3f9591835..30490e04182 100644
--- a/arch/arm/mach-imx/imx8m/imximage.cfg
+++ b/arch/arm/mach-imx/imx8m/imximage.cfg
@@ -3,7 +3,6 @@
  * Copyright 2018-2021 NXP
  */
 
-#define __ASSEMBLY__
 
 FIT
 BOOT_FROM	sd
diff --git a/arch/arm/mach-imx/spl_qspi.cfg b/arch/arm/mach-imx/spl_qspi.cfg
index 1e39ae2f01f..6df779b7715 100644
--- a/arch/arm/mach-imx/spl_qspi.cfg
+++ b/arch/arm/mach-imx/spl_qspi.cfg
@@ -3,7 +3,6 @@
  * Copyright (C) 2014, Compulab Ltd - http://compulab.co.il/
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 IMAGE_VERSION	2
diff --git a/arch/arm/mach-imx/spl_sd.cfg b/arch/arm/mach-imx/spl_sd.cfg
index dbaee815357..e739b547005 100644
--- a/arch/arm/mach-imx/spl_sd.cfg
+++ b/arch/arm/mach-imx/spl_sd.cfg
@@ -3,7 +3,6 @@
  * Copyright (C) 2014, Compulab Ltd - http://compulab.co.il/
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 IMAGE_VERSION	2
diff --git a/board/advantech/imx8qm_rom7720_a1/imximage.cfg b/board/advantech/imx8qm_rom7720_a1/imximage.cfg
index e324c7ca37c..5ecde0c5309 100644
--- a/board/advantech/imx8qm_rom7720_a1/imximage.cfg
+++ b/board/advantech/imx8qm_rom7720_a1/imximage.cfg
@@ -3,7 +3,6 @@
  * Copyright 2018 NXP
  */
 
-#define __ASSEMBLY__
 
 /* Boot from SD, sector size 0x400 */
 BOOT_FROM SD 0x400
diff --git a/board/aristainetos/aristainetos2.cfg b/board/aristainetos/aristainetos2.cfg
index d088cc83ad4..2454ac5515a 100644
--- a/board/aristainetos/aristainetos2.cfg
+++ b/board/aristainetos/aristainetos2.cfg
@@ -21,7 +21,6 @@ IMAGE_VERSION 2
  */
 BOOT_FROM      spi
 
-#define __ASSEMBLY__
 #include <config.h>
 #ifdef CONFIG_IMX_HAB
 CSF CONFIG_CSF_SIZE
diff --git a/board/beacon/imx8mm/imximage-8mm-lpddr4.cfg b/board/beacon/imx8mm/imximage-8mm-lpddr4.cfg
index 90573be5fd9..20061521f22 100644
--- a/board/beacon/imx8mm/imximage-8mm-lpddr4.cfg
+++ b/board/beacon/imx8mm/imximage-8mm-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 NXP
  */
 
-#define __ASSEMBLY__
 
 BOOT_FROM	sd
 LOADER		u-boot-spl-ddr.bin	0x7E1000
diff --git a/board/beacon/imx8mn/imximage-8mn-lpddr4.cfg b/board/beacon/imx8mn/imximage-8mn-lpddr4.cfg
index 7286b264944..0edda9c5e06 100644
--- a/board/beacon/imx8mn/imximage-8mn-lpddr4.cfg
+++ b/board/beacon/imx8mn/imximage-8mn-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 NXP
  */
 
-#define __ASSEMBLY__
 
 ROM_VERSION	v2
 BOOT_FROM	sd
diff --git a/board/boundary/nitrogen6x/nitrogen6dl.cfg b/board/boundary/nitrogen6x/nitrogen6dl.cfg
index 9558e26a2f1..a57b16a7670 100644
--- a/board/boundary/nitrogen6x/nitrogen6dl.cfg
+++ b/board/boundary/nitrogen6x/nitrogen6dl.cfg
@@ -17,7 +17,6 @@ IMAGE_VERSION 2
  */
 BOOT_FROM      spi
 
-#define __ASSEMBLY__
 #include <config.h>
 #ifdef CONFIG_IMX_HAB
 CSF CONFIG_CSF_SIZE
diff --git a/board/boundary/nitrogen6x/nitrogen6dl2g.cfg b/board/boundary/nitrogen6x/nitrogen6dl2g.cfg
index f5a107c2254..7379b891a65 100644
--- a/board/boundary/nitrogen6x/nitrogen6dl2g.cfg
+++ b/board/boundary/nitrogen6x/nitrogen6dl2g.cfg
@@ -17,7 +17,6 @@ IMAGE_VERSION 2
  */
 BOOT_FROM      spi
 
-#define __ASSEMBLY__
 #include <config.h>
 #ifdef CONFIG_IMX_HAB
 CSF CONFIG_CSF_SIZE
diff --git a/board/boundary/nitrogen6x/nitrogen6q.cfg b/board/boundary/nitrogen6x/nitrogen6q.cfg
index b0bbf0d7975..c7029ab0343 100644
--- a/board/boundary/nitrogen6x/nitrogen6q.cfg
+++ b/board/boundary/nitrogen6x/nitrogen6q.cfg
@@ -17,7 +17,6 @@ IMAGE_VERSION 2
  */
 BOOT_FROM      spi
 
-#define __ASSEMBLY__
 #include <config.h>
 #ifdef CONFIG_IMX_HAB
 CSF CONFIG_CSF_SIZE
diff --git a/board/boundary/nitrogen6x/nitrogen6q2g.cfg b/board/boundary/nitrogen6x/nitrogen6q2g.cfg
index 4999254329f..1d58cd4d13d 100644
--- a/board/boundary/nitrogen6x/nitrogen6q2g.cfg
+++ b/board/boundary/nitrogen6x/nitrogen6q2g.cfg
@@ -17,7 +17,6 @@ IMAGE_VERSION 2
  */
 BOOT_FROM      spi
 
-#define __ASSEMBLY__
 #include <config.h>
 #ifdef CONFIG_IMX_HAB
 CSF CONFIG_CSF_SIZE
diff --git a/board/boundary/nitrogen6x/nitrogen6s.cfg b/board/boundary/nitrogen6x/nitrogen6s.cfg
index 16d778491a4..b16d9447fa9 100644
--- a/board/boundary/nitrogen6x/nitrogen6s.cfg
+++ b/board/boundary/nitrogen6x/nitrogen6s.cfg
@@ -17,7 +17,6 @@ IMAGE_VERSION 2
  */
 BOOT_FROM      spi
 
-#define __ASSEMBLY__
 #include <config.h>
 #ifdef CONFIG_IMX_HAB
 CSF CONFIG_CSF_SIZE
diff --git a/board/boundary/nitrogen6x/nitrogen6s1g.cfg b/board/boundary/nitrogen6x/nitrogen6s1g.cfg
index 0320078a911..debec755d6b 100644
--- a/board/boundary/nitrogen6x/nitrogen6s1g.cfg
+++ b/board/boundary/nitrogen6x/nitrogen6s1g.cfg
@@ -17,7 +17,6 @@ IMAGE_VERSION 2
  */
 BOOT_FROM      spi
 
-#define __ASSEMBLY__
 #include <config.h>
 #ifdef CONFIG_IMX_HAB
 CSF CONFIG_CSF_SIZE
diff --git a/board/compulab/imx8mm-cl-iot-gate/imximage-8mm-lpddr4.cfg b/board/compulab/imx8mm-cl-iot-gate/imximage-8mm-lpddr4.cfg
index 4071219fbf4..f9ce7f89d7c 100644
--- a/board/compulab/imx8mm-cl-iot-gate/imximage-8mm-lpddr4.cfg
+++ b/board/compulab/imx8mm-cl-iot-gate/imximage-8mm-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 NXP
  */
 
-#define __ASSEMBLY__
 
 BOOT_FROM	sd
 LOADER		u-boot-spl-ddr.bin	0x7e1000
diff --git a/board/congatec/cgtqmx8/imximage.cfg b/board/congatec/cgtqmx8/imximage.cfg
index e324c7ca37c..5ecde0c5309 100644
--- a/board/congatec/cgtqmx8/imximage.cfg
+++ b/board/congatec/cgtqmx8/imximage.cfg
@@ -3,7 +3,6 @@
  * Copyright 2018 NXP
  */
 
-#define __ASSEMBLY__
 
 /* Boot from SD, sector size 0x400 */
 BOOT_FROM SD 0x400
diff --git a/board/ea/mx7ulp_com/imximage.cfg b/board/ea/mx7ulp_com/imximage.cfg
index 1b218996aea..1731da814d0 100644
--- a/board/ea/mx7ulp_com/imximage.cfg
+++ b/board/ea/mx7ulp_com/imximage.cfg
@@ -9,7 +9,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/freescale/imx8mm_evk/imximage-8mm-lpddr4.cfg b/board/freescale/imx8mm_evk/imximage-8mm-lpddr4.cfg
index 90573be5fd9..20061521f22 100644
--- a/board/freescale/imx8mm_evk/imximage-8mm-lpddr4.cfg
+++ b/board/freescale/imx8mm_evk/imximage-8mm-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 NXP
  */
 
-#define __ASSEMBLY__
 
 BOOT_FROM	sd
 LOADER		u-boot-spl-ddr.bin	0x7E1000
diff --git a/board/freescale/imx8mn_evk/imximage-8mn-ddr4.cfg b/board/freescale/imx8mn_evk/imximage-8mn-ddr4.cfg
index 22aec26da7d..d0f5b6ccd7b 100644
--- a/board/freescale/imx8mn_evk/imximage-8mn-ddr4.cfg
+++ b/board/freescale/imx8mn_evk/imximage-8mn-ddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 NXP
  */
 
-#define __ASSEMBLY__
 
 ROM_VERSION	v2
 BOOT_FROM	sd
diff --git a/board/freescale/imx8mp_evk/imximage-8mp-lpddr4.cfg b/board/freescale/imx8mp_evk/imximage-8mp-lpddr4.cfg
index 4c3ecf5a71a..6dedf1724ab 100644
--- a/board/freescale/imx8mp_evk/imximage-8mp-lpddr4.cfg
+++ b/board/freescale/imx8mp_evk/imximage-8mp-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 NXP
  */
 
-#define __ASSEMBLY__
 
 ROM_VERSION	v2
 BOOT_FROM	sd
diff --git a/board/freescale/imx8qm_mek/imximage.cfg b/board/freescale/imx8qm_mek/imximage.cfg
index 7dc6b93eb58..71612678c99 100644
--- a/board/freescale/imx8qm_mek/imximage.cfg
+++ b/board/freescale/imx8qm_mek/imximage.cfg
@@ -3,7 +3,6 @@
  * Copyright 2018 NXP
  */
 
-#define __ASSEMBLY__
 
 /* Boot from SD, sector size 0x400 */
 BOOT_FROM SD 0x400
diff --git a/board/freescale/imx8qm_mek/uboot-container.cfg b/board/freescale/imx8qm_mek/uboot-container.cfg
index 6cc47cd1027..93c5d39ae9b 100644
--- a/board/freescale/imx8qm_mek/uboot-container.cfg
+++ b/board/freescale/imx8qm_mek/uboot-container.cfg
@@ -3,7 +3,6 @@
  * Copyright 2019 NXP
  */
 
-#define __ASSEMBLY__
 
 /* This file is to create a container image could be loaded by SPL */
 BOOT_FROM SD 0x400
diff --git a/board/freescale/imx8qxp_mek/imximage.cfg b/board/freescale/imx8qxp_mek/imximage.cfg
index cd747d2eee7..89a4736ab7a 100644
--- a/board/freescale/imx8qxp_mek/imximage.cfg
+++ b/board/freescale/imx8qxp_mek/imximage.cfg
@@ -6,7 +6,6 @@
  * and create imx8image boot image
  */
 
-#define __ASSEMBLY__
 
 /* Boot from SD, sector size 0x400 */
 BOOT_FROM SD 0x400
diff --git a/board/freescale/imx8qxp_mek/uboot-container.cfg b/board/freescale/imx8qxp_mek/uboot-container.cfg
index 81658118185..b53896f2354 100644
--- a/board/freescale/imx8qxp_mek/uboot-container.cfg
+++ b/board/freescale/imx8qxp_mek/uboot-container.cfg
@@ -3,7 +3,6 @@
  * Copyright 2019 NXP
  */
 
-#define __ASSEMBLY__
 
 /* This file is to create a container image could be loaded by SPL */
 BOOT_FROM SD 0x400
diff --git a/board/freescale/imxrt1020-evk/imximage.cfg b/board/freescale/imxrt1020-evk/imximage.cfg
index 9bcc2c15907..0ed71479a60 100644
--- a/board/freescale/imxrt1020-evk/imximage.cfg
+++ b/board/freescale/imxrt1020-evk/imximage.cfg
@@ -4,7 +4,6 @@
  * Author(s): Giulio Benetti <giulio.benetti@benettiengineering.com>
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/freescale/imxrt1050-evk/imximage.cfg b/board/freescale/imxrt1050-evk/imximage.cfg
index cf1665be610..f1f09fd7ebb 100644
--- a/board/freescale/imxrt1050-evk/imximage.cfg
+++ b/board/freescale/imxrt1050-evk/imximage.cfg
@@ -4,7 +4,6 @@
  * Author(s): Giulio Benetti <giulio.benetti@benettiengineering.com>
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/freescale/mx6slevk/imximage.cfg b/board/freescale/mx6slevk/imximage.cfg
index b97761a5162..64be101d6ec 100644
--- a/board/freescale/mx6slevk/imximage.cfg
+++ b/board/freescale/mx6slevk/imximage.cfg
@@ -7,7 +7,6 @@
  *
  * The syntax is taken as close as possible with the kwbimage
  */
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/freescale/mx6sllevk/imximage.cfg b/board/freescale/mx6sllevk/imximage.cfg
index 74b3a907bf2..550be3f6c12 100644
--- a/board/freescale/mx6sllevk/imximage.cfg
+++ b/board/freescale/mx6sllevk/imximage.cfg
@@ -8,7 +8,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/freescale/mx6sxsabreauto/imximage.cfg b/board/freescale/mx6sxsabreauto/imximage.cfg
index 4a0bcc5f7d6..da703093aa6 100644
--- a/board/freescale/mx6sxsabreauto/imximage.cfg
+++ b/board/freescale/mx6sxsabreauto/imximage.cfg
@@ -3,7 +3,6 @@
  * Copyright (C) 2014 Freescale Semiconductor, Inc.
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/freescale/mx6sxsabresd/imximage.cfg b/board/freescale/mx6sxsabresd/imximage.cfg
index 28ffb2f8bc9..313ab589505 100644
--- a/board/freescale/mx6sxsabresd/imximage.cfg
+++ b/board/freescale/mx6sxsabresd/imximage.cfg
@@ -3,7 +3,6 @@
  * Copyright (C) 2014 Freescale Semiconductor, Inc.
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/freescale/mx6ullevk/imximage.cfg b/board/freescale/mx6ullevk/imximage.cfg
index 155503997d2..0c6f444a7a3 100644
--- a/board/freescale/mx6ullevk/imximage.cfg
+++ b/board/freescale/mx6ullevk/imximage.cfg
@@ -8,7 +8,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/freescale/mx7dsabresd/imximage.cfg b/board/freescale/mx7dsabresd/imximage.cfg
index 05446ac833d..59e66fbda16 100644
--- a/board/freescale/mx7dsabresd/imximage.cfg
+++ b/board/freescale/mx7dsabresd/imximage.cfg
@@ -8,7 +8,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/freescale/mx7ulp_evk/imximage.cfg b/board/freescale/mx7ulp_evk/imximage.cfg
index ec3673040ba..62fd79afd6c 100644
--- a/board/freescale/mx7ulp_evk/imximage.cfg
+++ b/board/freescale/mx7ulp_evk/imximage.cfg
@@ -8,7 +8,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/gateworks/venice/imximage-8mm-lpddr4.cfg b/board/gateworks/venice/imximage-8mm-lpddr4.cfg
index ccaa765cb7d..6bc457c6a20 100644
--- a/board/gateworks/venice/imximage-8mm-lpddr4.cfg
+++ b/board/gateworks/venice/imximage-8mm-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 Gateworks Corporation
  */
 
-#define __ASSEMBLY__
 
 BOOT_FROM	sd
 LOADER		u-boot-spl-ddr.bin	0x7E1000
diff --git a/board/ge/bx50v3/bx50v3.cfg b/board/ge/bx50v3/bx50v3.cfg
index de3955a94d2..1386516a16f 100644
--- a/board/ge/bx50v3/bx50v3.cfg
+++ b/board/ge/bx50v3/bx50v3.cfg
@@ -13,7 +13,6 @@
 IMAGE_VERSION 2
 BOOT_FROM sd
 
-#define __ASSEMBLY__
 #include <config.h>
 #include "asm/arch/mx6-ddr.h"
 #include "asm/arch/iomux.h"
diff --git a/board/kontron/sl-mx8mm/imximage.cfg b/board/kontron/sl-mx8mm/imximage.cfg
index f101f3d228f..b5380267114 100644
--- a/board/kontron/sl-mx8mm/imximage.cfg
+++ b/board/kontron/sl-mx8mm/imximage.cfg
@@ -3,7 +3,6 @@
  * Copyright (C) 2019 Kontron Electronics GmbH
  */
 
-#define __ASSEMBLY__
 
 BOOT_FROM	sd
 LOADER		u-boot-spl-ddr.bin	0x7E1000
diff --git a/board/novtech/meerkat96/imximage.cfg b/board/novtech/meerkat96/imximage.cfg
index 86275b84d9c..a67ce533141 100644
--- a/board/novtech/meerkat96/imximage.cfg
+++ b/board/novtech/meerkat96/imximage.cfg
@@ -9,7 +9,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/out4/o4-imx6ull-nano/K4B4G1646D-BCMA.cfg b/board/out4/o4-imx6ull-nano/K4B4G1646D-BCMA.cfg
index c0dcfe9a0c5..38c4572152b 100644
--- a/board/out4/o4-imx6ull-nano/K4B4G1646D-BCMA.cfg
+++ b/board/out4/o4-imx6ull-nano/K4B4G1646D-BCMA.cfg
@@ -2,7 +2,6 @@
 // Copyright (C) 2016 Freescale Semiconductor, Inc.
 // Copyright (C) 2021 Oleh Kravchenko <oleg@kaa.org.ua>
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/out4/o4-imx6ull-nano/MT41K256M16HA-125E.cfg b/board/out4/o4-imx6ull-nano/MT41K256M16HA-125E.cfg
index 6f823a7272a..497e7f8fc4a 100644
--- a/board/out4/o4-imx6ull-nano/MT41K256M16HA-125E.cfg
+++ b/board/out4/o4-imx6ull-nano/MT41K256M16HA-125E.cfg
@@ -2,7 +2,6 @@
 // Copyright (C) 2016 Freescale Semiconductor, Inc.
 // Copyright (C) 2021 Oleh Kravchenko <oleg@kaa.org.ua>
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/phytec/phycore_imx8mm/imximage-8mm-sd.cfg b/board/phytec/phycore_imx8mm/imximage-8mm-sd.cfg
index ea74fb7e590..722e62c92d6 100644
--- a/board/phytec/phycore_imx8mm/imximage-8mm-sd.cfg
+++ b/board/phytec/phycore_imx8mm/imximage-8mm-sd.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 Phytec Messtechnik GmbH
  */
 
-#define __ASSEMBLY__
 
 BOOT_FROM       sd
 LOADER          u-boot-spl-ddr.bin      0x7E1000
diff --git a/board/phytec/phycore_imx8mp/imximage-8mp-sd.cfg b/board/phytec/phycore_imx8mp/imximage-8mp-sd.cfg
index 4c3ecf5a71a..6dedf1724ab 100644
--- a/board/phytec/phycore_imx8mp/imximage-8mp-sd.cfg
+++ b/board/phytec/phycore_imx8mp/imximage-8mp-sd.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 NXP
  */
 
-#define __ASSEMBLY__
 
 ROM_VERSION	v2
 BOOT_FROM	sd
diff --git a/board/ronetix/imx8mq-cm/imximage-8mq-lpddr4.cfg b/board/ronetix/imx8mq-cm/imximage-8mq-lpddr4.cfg
index 268b5ae7163..fae7ad83693 100644
--- a/board/ronetix/imx8mq-cm/imximage-8mq-lpddr4.cfg
+++ b/board/ronetix/imx8mq-cm/imximage-8mq-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 NXP
  */
 
-#define __ASSEMBLY__
 
 BOOT_FROM	sd
 LOADER		mkimage.flash.mkimage	0x7E1000
\ No newline at end of file
diff --git a/board/siemens/capricorn/imximage.cfg b/board/siemens/capricorn/imximage.cfg
index 9f9df68e64c..fa871bac212 100644
--- a/board/siemens/capricorn/imximage.cfg
+++ b/board/siemens/capricorn/imximage.cfg
@@ -6,7 +6,6 @@
  * and create imx8image boot image
  */
 
-#define __ASSEMBLY__
 
 /* Boot from SD, sector size 0x400 */
 BOOT_FROM SD 0x400
diff --git a/board/siemens/capricorn/uboot-container.cfg b/board/siemens/capricorn/uboot-container.cfg
index 81658118185..b53896f2354 100644
--- a/board/siemens/capricorn/uboot-container.cfg
+++ b/board/siemens/capricorn/uboot-container.cfg
@@ -3,7 +3,6 @@
  * Copyright 2019 NXP
  */
 
-#define __ASSEMBLY__
 
 /* This file is to create a container image could be loaded by SPL */
 BOOT_FROM SD 0x400
diff --git a/board/softing/vining_2000/imximage.cfg b/board/softing/vining_2000/imximage.cfg
index f6f59ddf55c..300aafcae24 100644
--- a/board/softing/vining_2000/imximage.cfg
+++ b/board/softing/vining_2000/imximage.cfg
@@ -4,7 +4,6 @@
  * Copyright (C) 2017-2019 softing automotive electronics gmbH
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/somlabs/visionsom-6ull/imximage.cfg b/board/somlabs/visionsom-6ull/imximage.cfg
index b49a2df6dd8..370b303cfa6 100644
--- a/board/somlabs/visionsom-6ull/imximage.cfg
+++ b/board/somlabs/visionsom-6ull/imximage.cfg
@@ -9,7 +9,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/storopack/smegw01/imximage.cfg b/board/storopack/smegw01/imximage.cfg
index c7fa06996cc..fd457b27f5e 100644
--- a/board/storopack/smegw01/imximage.cfg
+++ b/board/storopack/smegw01/imximage.cfg
@@ -8,7 +8,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 IMAGE_VERSION	2
diff --git a/board/tbs/tbs2910/tbs2910.cfg b/board/tbs/tbs2910/tbs2910.cfg
index 3ca807b3157..2fa70947cec 100644
--- a/board/tbs/tbs2910/tbs2910.cfg
+++ b/board/tbs/tbs2910/tbs2910.cfg
@@ -3,7 +3,6 @@
  * Copyright (C) 2017 Soeren Moch <smoch@web.de>
  */
 
-#define __ASSEMBLY__
 #include "asm/arch/crm_regs.h"
 #include "asm/arch/iomux.h"
 #include "asm/arch/mx6-ddr.h"
diff --git a/board/technexion/pico-imx6ul/imximage.cfg b/board/technexion/pico-imx6ul/imximage.cfg
index 993c1da6700..98de1782037 100644
--- a/board/technexion/pico-imx6ul/imximage.cfg
+++ b/board/technexion/pico-imx6ul/imximage.cfg
@@ -8,7 +8,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/toradex/apalis-imx8/apalis-imx8-imximage.cfg b/board/toradex/apalis-imx8/apalis-imx8-imximage.cfg
index b8f0f3dc10f..16183f96679 100644
--- a/board/toradex/apalis-imx8/apalis-imx8-imximage.cfg
+++ b/board/toradex/apalis-imx8/apalis-imx8-imximage.cfg
@@ -6,7 +6,6 @@
  * and create imx8image boot image
  */
 
-#define __ASSEMBLY__
 
 /* Boot from SD, sector size 0x400 */
 BOOT_FROM EMMC_FASTBOOT 0x400
diff --git a/board/toradex/apalis-imx8x/apalis-imx8x-imximage.cfg b/board/toradex/apalis-imx8x/apalis-imx8x-imximage.cfg
index 58c62d0a659..c229706f80a 100644
--- a/board/toradex/apalis-imx8x/apalis-imx8x-imximage.cfg
+++ b/board/toradex/apalis-imx8x/apalis-imx8x-imximage.cfg
@@ -6,7 +6,6 @@
  * and create imx8image boot image
  */
 
-#define __ASSEMBLY__
 
 /* Boot from SD, sector size 0x400 */
 BOOT_FROM EMMC_FASTBOOT 0x400
diff --git a/board/toradex/colibri-imx6ull/imximage.cfg b/board/toradex/colibri-imx6ull/imximage.cfg
index e162cff90f0..0d81f9b2f4c 100644
--- a/board/toradex/colibri-imx6ull/imximage.cfg
+++ b/board/toradex/colibri-imx6ull/imximage.cfg
@@ -9,7 +9,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/toradex/colibri-imx8x/colibri-imx8x-imximage.cfg b/board/toradex/colibri-imx8x/colibri-imx8x-imximage.cfg
index 44f6c0c4554..fa176b04084 100644
--- a/board/toradex/colibri-imx8x/colibri-imx8x-imximage.cfg
+++ b/board/toradex/colibri-imx8x/colibri-imx8x-imximage.cfg
@@ -6,7 +6,6 @@
  * and create imx8image boot image
  */
 
-#define __ASSEMBLY__
 
 /* Boot from SD, sector size 0x400 */
 BOOT_FROM EMMC_FASTBOOT 0x400
diff --git a/board/toradex/colibri_imx7/imximage.cfg b/board/toradex/colibri_imx7/imximage.cfg
index bdce48b7ffa..41b3577b10d 100644
--- a/board/toradex/colibri_imx7/imximage.cfg
+++ b/board/toradex/colibri_imx7/imximage.cfg
@@ -9,7 +9,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/toradex/verdin-imx8mm/imximage.cfg b/board/toradex/verdin-imx8mm/imximage.cfg
index fcc92009f3b..0e02e447992 100644
--- a/board/toradex/verdin-imx8mm/imximage.cfg
+++ b/board/toradex/verdin-imx8mm/imximage.cfg
@@ -3,7 +3,6 @@
  * Copyright 2020-2021 Toradex
  */
 
-#define __ASSEMBLY__
 
 BOOT_FROM	emmc_fastboot
 LOADER		u-boot-spl-ddr.bin	0x7e1000
diff --git a/board/tq/tqma6/tqma6dl.cfg b/board/tq/tqma6/tqma6dl.cfg
index 80c71503161..8cd1885b43f 100644
--- a/board/tq/tqma6/tqma6dl.cfg
+++ b/board/tq/tqma6/tqma6dl.cfg
@@ -11,7 +11,6 @@
 /* image version */
 IMAGE_VERSION 2
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /*
diff --git a/board/tq/tqma6/tqma6q.cfg b/board/tq/tqma6/tqma6q.cfg
index 82a0a271d4f..a49489aed3f 100644
--- a/board/tq/tqma6/tqma6q.cfg
+++ b/board/tq/tqma6/tqma6q.cfg
@@ -11,7 +11,6 @@
 /* image version */
 IMAGE_VERSION 2
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /*
diff --git a/board/tq/tqma6/tqma6s.cfg b/board/tq/tqma6/tqma6s.cfg
index 9cdbb3c7676..02f7e109100 100644
--- a/board/tq/tqma6/tqma6s.cfg
+++ b/board/tq/tqma6/tqma6s.cfg
@@ -11,7 +11,6 @@
 /* image version */
 IMAGE_VERSION 2
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /*
diff --git a/board/warp/imximage.cfg b/board/warp/imximage.cfg
index d952c6f2e9e..f6bc604c8b2 100644
--- a/board/warp/imximage.cfg
+++ b/board/warp/imximage.cfg
@@ -7,7 +7,6 @@
  *
  * The syntax is taken as close as possible with the kwbimage
  */
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/warp7/imximage.cfg b/board/warp7/imximage.cfg
index 9e7d4725e4a..ca22ee159b7 100644
--- a/board/warp7/imximage.cfg
+++ b/board/warp7/imximage.cfg
@@ -8,7 +8,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 IMAGE_VERSION	2
-- 
2.34.1.703.g22d0c6ccf7-goog


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v4 02/13] mips: Avoid using config_enabled() directly
  2022-01-16 20:19 [PATCH v4 00/13] kconfig: Add some new macros Simon Glass
  2022-01-16 20:19 ` [PATCH v4 01/13] imx: Don't define __ASSEMBLY__ in C files Simon Glass
@ 2022-01-16 20:19 ` Simon Glass
  2022-01-18 19:47   ` Daniel Schwierzeck
  2022-01-16 20:19 ` [PATCH v4 03/13] mmc: fsl: Use brackets around if() Simon Glass
                   ` (10 subsequent siblings)
  12 siblings, 1 reply; 20+ messages in thread
From: Simon Glass @ 2022-01-16 20:19 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Rasmus Villemoes, Simon Glass, Daniel Schwierzeck

Use IS_ENABLED() instead, which is the correct macro for checking a CONFIG
option.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 arch/mips/lib/cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/lib/cache.c b/arch/mips/lib/cache.c
index 51a8f433475..ec652f0fba8 100644
--- a/arch/mips/lib/cache.c
+++ b/arch/mips/lib/cache.c
@@ -38,7 +38,7 @@ static void probe_l2(void)
 			l2c = read_c0_config5() & MIPS_CONF5_L2C;
 	}
 
-	if (l2c && config_enabled(CONFIG_MIPS_CM)) {
+	if (l2c && IS_ENABLED(CONFIG_MIPS_CM)) {
 		gd->arch.l2_line_size = mips_cm_l2_line_size();
 	} else if (l2c) {
 		/* We don't know how to retrieve L2 config on this system */
-- 
2.34.1.703.g22d0c6ccf7-goog


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v4 03/13] mmc: fsl: Use brackets around if()
  2022-01-16 20:19 [PATCH v4 00/13] kconfig: Add some new macros Simon Glass
  2022-01-16 20:19 ` [PATCH v4 01/13] imx: Don't define __ASSEMBLY__ in C files Simon Glass
  2022-01-16 20:19 ` [PATCH v4 02/13] mips: Avoid using config_enabled() directly Simon Glass
@ 2022-01-16 20:19 ` Simon Glass
  2022-01-16 21:06   ` Sean Anderson
  2022-01-16 23:50   ` Jaehoon Chung
  2022-01-16 20:19 ` [PATCH v4 04/13] kconfig: Update IS_ENABLED() internals Simon Glass
                   ` (9 subsequent siblings)
  12 siblings, 2 replies; 20+ messages in thread
From: Simon Glass @ 2022-01-16 20:19 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Rasmus Villemoes, Simon Glass, Jaehoon Chung, Peng Fan

At present the IS_ENABLED() macro has extra brackets, making it possible
to write:

   if IS_ENABLED(CONFIG_XXX)

but it is a bit confusing. Add the missing brackets.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 drivers/mmc/fsl_esdhc_imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
index 9299635f509..08ea98fe81a 100644
--- a/drivers/mmc/fsl_esdhc_imx.c
+++ b/drivers/mmc/fsl_esdhc_imx.c
@@ -453,7 +453,7 @@ static int esdhc_send_cmd_common(struct fsl_esdhc_priv *priv, struct mmc *mmc,
 
 	/* Send the command */
 	esdhc_write32(&regs->cmdarg, cmd->cmdarg);
-	if IS_ENABLED(CONFIG_FSL_USDHC) {
+	if (IS_ENABLED(CONFIG_FSL_USDHC)) {
 		u32 mixctrl = esdhc_read32(&regs->mixctrl);
 
 		esdhc_write32(&regs->mixctrl,
-- 
2.34.1.703.g22d0c6ccf7-goog


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v4 04/13] kconfig: Update IS_ENABLED() internals
  2022-01-16 20:19 [PATCH v4 00/13] kconfig: Add some new macros Simon Glass
                   ` (2 preceding siblings ...)
  2022-01-16 20:19 ` [PATCH v4 03/13] mmc: fsl: Use brackets around if() Simon Glass
@ 2022-01-16 20:19 ` Simon Glass
  2022-01-16 20:19 ` [PATCH v4 05/13] kconfig: Add support for conditional values Simon Glass
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: Simon Glass @ 2022-01-16 20:19 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Rasmus Villemoes, Simon Glass, Alexandru Gagniuc,
	Masahiro Yamada

The config_enabled() macro currently uses 0 as the default value. Update
it to allow any value, so we can pass it something else, such as a
non-existent function, to produce a build error if it is not defined.

Also tidy up the code style for IS_ENABLED() and drop the unnecessary
brackets (the value is a simple 0 or 1).

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 include/linux/kconfig.h | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h
index a1d1a298426..52586a7557b 100644
--- a/include/linux/kconfig.h
+++ b/include/linux/kconfig.h
@@ -17,18 +17,16 @@
  * the last step cherry picks the 2nd arg, we get a zero.
  */
 #define __ARG_PLACEHOLDER_1 0,
-#define config_enabled(cfg) _config_enabled(cfg)
-#define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value)
-#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0)
+#define config_enabled(cfg, def_val) _config_enabled(cfg, def_val)
+#define _config_enabled(value, def_val) __config_enabled(__ARG_PLACEHOLDER_##value, def_val)
+#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))
+#define IS_ENABLED(option)	config_enabled(option, 0)
 
 /*
  * U-Boot add-on: Helper macros to reference to different macros (prefixed by
@@ -76,7 +74,7 @@
 #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))) (case1, case0)
+	__concat(__unwrap, config_enabled(CONFIG_VAL(option), 0)) (case1, case0)
 
 /*
  * CONFIG_IS_ENABLED(FOO) expands to
-- 
2.34.1.703.g22d0c6ccf7-goog


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v4 05/13] kconfig: Add support for conditional values
  2022-01-16 20:19 [PATCH v4 00/13] kconfig: Add some new macros Simon Glass
                   ` (3 preceding siblings ...)
  2022-01-16 20:19 ` [PATCH v4 04/13] kconfig: Update IS_ENABLED() internals Simon Glass
@ 2022-01-16 20:19 ` Simon Glass
  2022-01-16 20:19 ` [PATCH v4 06/13] bloblist: Update to use conditional value Simon Glass
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: Simon Glass @ 2022-01-16 20:19 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Rasmus Villemoes, Simon Glass, Alexandru Gagniuc,
	Angelo Dureghello, Masahiro Yamada, Patrick Delaunay

At present if an optional Kconfig value needs to be used it must be
bracketed by #ifdef. For example, with this Kconfig setup:

config WIBBLE
	bool "Support wibbles, the world needs more wibbles"

config WIBBLE_ADDR
	hex "Address of the wibble"
	depends on WIBBLE

then the following code must be used:

 #ifdef CONFIG_WIBBLE
 static void handle_wibble(void)
 {
 	int val = CONFIG_WIBBLE_ADDR;

	...
 }
 #endif

 static void init_machine()
 {
 ...
 #ifdef CONFIG_WIBBLE
	handle_wibble();
 #endif
 }

Add a new IF_ENABLED_INT() to help with this. So now it is possible to
write, without #ifdefs:

 static void handle_wibble(void)
 {
        int val = IF_ENABLED_INT(CONFIG_WIBBLE, CONFIG_WIBBLE_ADDR);

	...
 }

 static void init_machine()
 {
 ...
 if (IS_ENABLED(CONFIG_WIBBLE))
	handle_wibble();
 }

The value will be CONFIG_WIBBLE_ADDR if CONFIG_WIBBLE is defined and will
produce a build error if not.. This allows us to reduce the use of #ifdef
in the code, ensuring that the compiler still checks the code even if it
is not ultimately used for a particular build.

Add a CONFIG_IF_ENABLED_INT() version as well.

If an attempt is made to use a value that does not exist (i.e. when the
conditional is not enabled), an error about a non-existing function is
generated, e.g.:

common/bloblist.c:447: undefined reference to `invalid_use_of_IF_ENABLED_INT'

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v4:
- Update stale mention of zero in commit message
- Update stale comments in the header file
- Define the macros even in assembly context

Changes in v3:
- Add a way to detect use of a non-existent value

 include/linux/kconfig.h   | 40 +++++++++++++++++++++++++++++++++++++++
 scripts/Makefile.autoconf |  2 +-
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h
index 52586a7557b..d20da615b96 100644
--- a/include/linux/kconfig.h
+++ b/include/linux/kconfig.h
@@ -57,6 +57,30 @@
  */
 #define CONFIG_VAL(option)  config_val(option)
 
+/*
+ * This uses a similar mechanism to config_enabled() above. If cfg is enabled,
+ * it resolves to the value of opt_cfg, otherwise it resolves to def_val
+ */
+#define config_opt_enabled(cfg, opt_cfg, def_val) _config_opt_enabled(cfg, opt_cfg, def_val)
+#define _config_opt_enabled(cfg_val, opt_value, def_val) \
+	__config_opt_enabled(__ARG_PLACEHOLDER_##cfg_val, opt_value, def_val)
+#define __config_opt_enabled(arg1_or_junk, arg2, def_val) \
+	___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.
@@ -111,5 +135,21 @@
 #define CONFIG_IS_ENABLED(option, ...)					\
 	__concat(__CONFIG_IS_ENABLED_, __count_args(option, ##__VA_ARGS__)) (option, ##__VA_ARGS__)
 
+#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_CONFIG_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, (CONFIG_VAL(int_option)), \
+		(invalid_use_of_CONFIG_IF_ENABLED_INT()))
 
 #endif /* __LINUX_KCONFIG_H */
diff --git a/scripts/Makefile.autoconf b/scripts/Makefile.autoconf
index 5ed9abc8e14..0b3ffa08bfa 100644
--- a/scripts/Makefile.autoconf
+++ b/scripts/Makefile.autoconf
@@ -68,7 +68,7 @@ quiet_cmd_u_boot_cfg = CFG     $@
       cmd_u_boot_cfg = \
 	$(CPP) $(c_flags) $2 -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && { \
 		grep 'define CONFIG_' $@.tmp | \
-			sed '/define CONFIG_IS_ENABLED(/d;/define CONFIG_VAL(/d;' > $@; \
+			sed '/define CONFIG_IS_ENABLED(/d;/define CONFIG_IF_ENABLED_INT(/d;/define CONFIG_VAL(/d;' > $@; \
 		rm $@.tmp;						\
 	} || {								\
 		rm $@.tmp; false;					\
-- 
2.34.1.703.g22d0c6ccf7-goog


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v4 06/13] bloblist: Update to use conditional value
  2022-01-16 20:19 [PATCH v4 00/13] kconfig: Add some new macros Simon Glass
                   ` (4 preceding siblings ...)
  2022-01-16 20:19 ` [PATCH v4 05/13] kconfig: Add support for conditional values Simon Glass
@ 2022-01-16 20:19 ` Simon Glass
  2022-01-16 20:19 ` [PATCH v4 07/13] patman: Update test_util to run doc tests Simon Glass
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: Simon Glass @ 2022-01-16 20:19 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Rasmus Villemoes, Simon Glass

Use the new IF_ENABLED_INT() feature to avoid needing our own inline
function to handle this case. Tidy up the logic to ensure that the value
is only used when present. Update the 'expected' comment also.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v3)

Changes in v3:
- Add new patch to update bloblist to use conditional value

 common/bloblist.c  | 15 +++++++++++----
 include/bloblist.h | 10 ----------
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/common/bloblist.c b/common/bloblist.c
index 056b50c2cb6..406073c8105 100644
--- a/common/bloblist.c
+++ b/common/bloblist.c
@@ -430,18 +430,23 @@ void bloblist_reloc(void *to, uint to_size, void *from, uint from_size)
 
 int bloblist_init(void)
 {
+	bool fixed = IS_ENABLED(CONFIG_BLOBLIST_FIXED);
 	int ret = -ENOENT;
 	ulong addr, size;
 	bool expected;
 
 	/**
-	 * Wed expect to find an existing bloblist in the first phase of U-Boot
-	 * that runs
+	 * We don't expect to find an existing bloblist in the first phase of
+	 * U-Boot that runs. Also we have no way to receive the address of an
+	 * allocated bloblist from a previous stage, so it must be at a fixed
+	 * address.
 	 */
-	expected = !u_boot_first_phase();
+	expected = fixed && !u_boot_first_phase();
 	if (spl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
 		expected = false;
-	addr = bloblist_addr();
+	if (fixed)
+		addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,
+				      CONFIG_BLOBLIST_ADDR);
 	size = CONFIG_BLOBLIST_SIZE;
 	if (expected) {
 		ret = bloblist_check(addr, size);
@@ -460,6 +465,8 @@ int bloblist_init(void)
 			if (!ptr)
 				return log_msg_ret("alloc", -ENOMEM);
 			addr = map_to_sysmem(ptr);
+		} else if (!fixed) {
+			return log_msg_ret("!fixed", ret);
 		}
 		log_debug("Creating new bloblist size %lx at %lx\n", size,
 			  addr);
diff --git a/include/bloblist.h b/include/bloblist.h
index 173129b0273..d0e128acf10 100644
--- a/include/bloblist.h
+++ b/include/bloblist.h
@@ -147,16 +147,6 @@ struct bloblist_rec {
 	u32 spare;
 };
 
-/* access CONFIG_BLOBLIST_ADDR, dealing with it possibly not being defined */
-static inline ulong bloblist_addr(void)
-{
-#ifdef CONFIG_BLOBLIST_FIXED
-	return CONFIG_BLOBLIST_ADDR;
-#else
-	return 0;
-#endif
-}
-
 /**
  * bloblist_check_magic() - return a bloblist if the magic matches
  *
-- 
2.34.1.703.g22d0c6ccf7-goog


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v4 07/13] patman: Update test_util to run doc tests
  2022-01-16 20:19 [PATCH v4 00/13] kconfig: Add some new macros Simon Glass
                   ` (5 preceding siblings ...)
  2022-01-16 20:19 ` [PATCH v4 06/13] bloblist: Update to use conditional value Simon Glass
@ 2022-01-16 20:19 ` Simon Glass
  2022-01-16 20:19 ` [PATCH v4 08/13] buildman: Add a flag to control the traceback Simon Glass
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: Simon Glass @ 2022-01-16 20:19 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Rasmus Villemoes, Simon Glass, Walter Lozano

At present this function does not run the doctests. Allow the caller to
pass these modules in as strings.

Update patman to use this.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 tools/dtoc/main.py        |  2 +-
 tools/patman/main.py      | 20 ++++----------------
 tools/patman/test_util.py | 17 +++++++++++------
 3 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/tools/dtoc/main.py b/tools/dtoc/main.py
index 6f9b526bd74..276cfadf5a3 100755
--- a/tools/dtoc/main.py
+++ b/tools/dtoc/main.py
@@ -58,7 +58,7 @@ def run_tests(processes, args):
     test_util.RunTestSuites(
         result, debug=True, verbosity=1, test_preserve_dirs=False,
         processes=processes, test_name=test_name, toolpath=[],
-        test_class_list=[test_dtoc.TestDtoc,test_src_scan.TestSrcScan])
+        class_and_module_list=[test_dtoc.TestDtoc,test_src_scan.TestSrcScan])
 
     return test_util.ReportResult('binman', test_name, result)
 
diff --git a/tools/patman/main.py b/tools/patman/main.py
index e5be28e3316..c01ae36e9f9 100755
--- a/tools/patman/main.py
+++ b/tools/patman/main.py
@@ -134,23 +134,11 @@ if args.cmd == 'test':
     import doctest
     from patman import func_test
 
-    sys.argv = [sys.argv[0]]
     result = unittest.TestResult()
-    suite = unittest.TestSuite()
-    loader = unittest.TestLoader()
-    for module in (test_checkpatch.TestPatch, func_test.TestFunctional):
-        if args.testname:
-            try:
-                suite.addTests(loader.loadTestsFromName(args.testname, module))
-            except AttributeError:
-                continue
-        else:
-            suite.addTests(loader.loadTestsFromTestCase(module))
-    suite.run(result)
-
-    for module in ['gitutil', 'settings', 'terminal']:
-        suite = doctest.DocTestSuite(module)
-        suite.run(result)
+    test_util.RunTestSuites(
+        result, False, False, False, None, None, None,
+        [test_checkpatch.TestPatch, func_test.TestFunctional,
+         'gitutil', 'settings', 'terminal'])
 
     sys.exit(test_util.ReportResult('patman', args.testname, result))
 
diff --git a/tools/patman/test_util.py b/tools/patman/test_util.py
index 4e261755dc6..9654e7319c1 100644
--- a/tools/patman/test_util.py
+++ b/tools/patman/test_util.py
@@ -4,6 +4,7 @@
 #
 
 from contextlib import contextmanager
+import doctest
 import glob
 import multiprocessing
 import os
@@ -139,7 +140,7 @@ def ReportResult(toolname:str, test_name: str, result: unittest.TestResult):
 
 
 def RunTestSuites(result, debug, verbosity, test_preserve_dirs, processes,
-                  test_name, toolpath, test_class_list):
+                  test_name, toolpath, class_and_module_list):
     """Run a series of test suites and collect the results
 
     Args:
@@ -154,11 +155,13 @@ def RunTestSuites(result, debug, verbosity, test_preserve_dirs, processes,
         processes: Number of processes to use to run tests (None=same as #CPUs)
         test_name: Name of test to run, or None for all
         toolpath: List of paths to use for tools
-        test_class_list: List of test classes to run
+        class_and_module_list: List of test classes (type class) and module
+           names (type str) to run
     """
-    for module in []:
-        suite = doctest.DocTestSuite(module)
-        suite.run(result)
+    for module in class_and_module_list:
+        if isinstance(module, str) and (not test_name or test_name == module):
+            suite = doctest.DocTestSuite(module)
+            suite.run(result)
 
     sys.argv = [sys.argv[0]]
     if debug:
@@ -171,7 +174,9 @@ def RunTestSuites(result, debug, verbosity, test_preserve_dirs, processes,
 
     suite = unittest.TestSuite()
     loader = unittest.TestLoader()
-    for module in test_class_list:
+    for module in class_and_module_list:
+        if isinstance(module, str):
+            continue
         # Test the test module about our arguments, if it is interested
         if hasattr(module, 'setup_test_args'):
             setup_test_args = getattr(module, 'setup_test_args')
-- 
2.34.1.703.g22d0c6ccf7-goog


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v4 08/13] buildman: Add a flag to control the traceback
  2022-01-16 20:19 [PATCH v4 00/13] kconfig: Add some new macros Simon Glass
                   ` (6 preceding siblings ...)
  2022-01-16 20:19 ` [PATCH v4 07/13] patman: Update test_util to run doc tests Simon Glass
@ 2022-01-16 20:19 ` Simon Glass
  2022-01-16 20:19 ` [PATCH v4 09/13] buildman: Make use of test_util Simon Glass
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: Simon Glass @ 2022-01-16 20:19 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Rasmus Villemoes, Simon Glass

At present the full horror of the Python traceback is shown by default. It
is normally only useful for debugging. Turn it off by default and add a
--debug flag to enable it.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 tools/buildman/cmdline.py | 2 ++
 tools/buildman/main.py    | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py
index 274b5ac3f45..092a82f4e9c 100644
--- a/tools/buildman/cmdline.py
+++ b/tools/buildman/cmdline.py
@@ -32,6 +32,8 @@ def ParseArgs():
           help='Show detailed size delta for each board in the -S summary')
     parser.add_option('-D', '--config-only', action='store_true', default=False,
           help="Don't build, just configure each commit")
+    parser.add_option('--debug', action='store_true',
+        help='Enabling debugging (provides a full traceback on error)')
     parser.add_option('-e', '--show_errors', action='store_true',
           default=False, help='Show errors and warnings')
     parser.add_option('-E', '--warnings-as-errors', action='store_true',
diff --git a/tools/buildman/main.py b/tools/buildman/main.py
index 2b714739a20..04698ce9e50 100755
--- a/tools/buildman/main.py
+++ b/tools/buildman/main.py
@@ -54,6 +54,9 @@ def RunTests(skip_net_tests):
 
 options, args = cmdline.ParseArgs()
 
+if not options.debug:
+    sys.tracebacklimit = 0
+
 # Run our meagre tests
 if options.test:
     RunTests(options.skip_net_tests)
-- 
2.34.1.703.g22d0c6ccf7-goog


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v4 09/13] buildman: Make use of test_util
  2022-01-16 20:19 [PATCH v4 00/13] kconfig: Add some new macros Simon Glass
                   ` (7 preceding siblings ...)
  2022-01-16 20:19 ` [PATCH v4 08/13] buildman: Add a flag to control the traceback Simon Glass
@ 2022-01-16 20:19 ` Simon Glass
  2022-01-16 20:19 ` [PATCH v4 10/13] buildman: Add helper functions for updating .config files Simon Glass
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: Simon Glass @ 2022-01-16 20:19 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Rasmus Villemoes, Simon Glass

Use test_util to run the tests, with the ability to select a single test
to run, if desired.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 tools/buildman/main.py | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/tools/buildman/main.py b/tools/buildman/main.py
index 04698ce9e50..c6af311a69b 100755
--- a/tools/buildman/main.py
+++ b/tools/buildman/main.py
@@ -27,30 +27,26 @@ from buildman import toolchain
 from patman import patchstream
 from patman import gitutil
 from patman import terminal
+from patman import test_util
 
-def RunTests(skip_net_tests):
+def RunTests(skip_net_tests, verboose, args):
     import func_test
     import test
     import doctest
 
     result = unittest.TestResult()
-    for module in ['buildman.toolchain', 'patman.gitutil']:
-        suite = doctest.DocTestSuite(module)
-        suite.run(result)
-
-    sys.argv = [sys.argv[0]]
+    test_name = args and args[0] or None
     if skip_net_tests:
         test.use_network = False
-    for module in (test.TestBuild, func_test.TestFunctional):
-        suite = unittest.TestLoader().loadTestsFromTestCase(module)
-        suite.run(result)
 
-    print(result)
-    for test, err in result.errors:
-        print(err)
-    for test, err in result.failures:
-        print(err)
+    # Run the entry tests first ,since these need to be the first to import the
+    # 'entry' module.
+    test_util.RunTestSuites(
+        result, False, verboose, False, None, test_name, [],
+        [test.TestBuild, func_test.TestFunctional,
+         'buildman.toolchain', 'patman.gitutil'])
 
+    return test_util.ReportResult('buildman', test_name, result)
 
 options, args = cmdline.ParseArgs()
 
@@ -59,7 +55,7 @@ if not options.debug:
 
 # Run our meagre tests
 if options.test:
-    RunTests(options.skip_net_tests)
+    RunTests(options.skip_net_tests, options.verbose, args)
 
 # Build selected commits for selected boards
 else:
-- 
2.34.1.703.g22d0c6ccf7-goog


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v4 10/13] buildman: Add helper functions for updating .config files
  2022-01-16 20:19 [PATCH v4 00/13] kconfig: Add some new macros Simon Glass
                   ` (8 preceding siblings ...)
  2022-01-16 20:19 ` [PATCH v4 09/13] buildman: Make use of test_util Simon Glass
@ 2022-01-16 20:19 ` Simon Glass
  2022-01-16 20:19 ` [PATCH v4 11/13] buildman: Provide a hint on how to debug thread crashes Simon Glass
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 20+ messages in thread
From: Simon Glass @ 2022-01-16 20:19 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Rasmus Villemoes, Simon Glass

At present the only straightforward way to write tests that need a
slightly different configuration is to create a new board with its own
configuration. This is cumbersome.

It would be useful if buildman could adjust the configuration of a build
on the fly. In preparation for this, add a utility library which can
modify a .config file according to various parameters passed to it.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 tools/buildman/cfgutil.py   | 235 ++++++++++++++++++++++++++++++++++++
 tools/buildman/func_test.py |   4 +-
 tools/buildman/test.py      | 123 +++++++++++++++++++
 3 files changed, 360 insertions(+), 2 deletions(-)
 create mode 100644 tools/buildman/cfgutil.py

diff --git a/tools/buildman/cfgutil.py b/tools/buildman/cfgutil.py
new file mode 100644
index 00000000000..4eba50868f5
--- /dev/null
+++ b/tools/buildman/cfgutil.py
@@ -0,0 +1,235 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2022 Google LLC
+# Written by Simon Glass <sjg@chromium.org>
+#
+
+"""Utility functions for dealing with Kconfig .confing files"""
+
+import re
+
+from patman import tools
+
+RE_LINE = re.compile(r'(# )?CONFIG_([A-Z0-9_]+)(=(.*)| is not set)')
+RE_CFG = re.compile(r'(~?)(CONFIG_)?([A-Z0-9_]+)(=.*)?')
+
+def make_cfg_line(opt, adj):
+    """Make a new config line for an option
+
+    Args:
+        opt (str): Option to process, without CONFIG_ prefix
+        adj (str): Adjustment to make (C is config option without prefix):
+             C to enable C
+             ~C to disable C
+             C=val to set the value of C (val must have quotes if C is
+                 a string Kconfig)
+
+    Returns:
+        str: New line to use, one of:
+            CONFIG_opt=y               - option is enabled
+            # CONFIG_opt is not set    - option is disabled
+            CONFIG_opt=val             - option is getting a new value (val is
+                in quotes if this is a string)
+    """
+    if adj[0] == '~':
+        return f'# CONFIG_{opt} is not set'
+    if '=' in adj:
+        return f'CONFIG_{adj}'
+    return f'CONFIG_{opt}=y'
+
+def adjust_cfg_line(line, adjust_cfg, done=None):
+    """Make an adjustment to a single of line from a .config file
+
+    This processes a .config line, producing a new line if a change for this
+    CONFIG is requested in adjust_cfg
+
+    Args:
+        line (str): line to process, e.g. '# CONFIG_FRED is not set' or
+            'CONFIG_FRED=y' or 'CONFIG_FRED=0x123' or 'CONFIG_FRED="fred"'
+        adjust_cfg (dict of str): Changes to make to .config file before
+                building:
+             key: str config to change, without the CONFIG_ prefix, e.g.
+                 FRED
+             value: str change to make (C is config option without prefix):
+                 C to enable C
+                 ~C to disable C
+                 C=val to set the value of C (val must have quotes if C is
+                     a string Kconfig)
+        done (set of set): Adds the config option to this set if it is changed
+            in some way. This is used to track which ones have been processed.
+            None to skip.
+
+    Returns:
+        tuple:
+            str: New string for this line (maybe unchanged)
+            str: Adjustment string that was used
+    """
+    out_line = line
+    m_line = RE_LINE.match(line)
+    adj = None
+    if m_line:
+        _, opt, _, _ = m_line.groups()
+        adj = adjust_cfg.get(opt)
+        if adj:
+            out_line = make_cfg_line(opt, adj)
+            if done is not None:
+                done.add(opt)
+
+    return out_line, adj
+
+def adjust_cfg_lines(lines, adjust_cfg):
+    """Make adjustments to a list of lines from a .config file
+
+    Args:
+        lines (list of str): List of lines to process
+        adjust_cfg (dict of str): Changes to make to .config file before
+                building:
+             key: str config to change, without the CONFIG_ prefix, e.g.
+                 FRED
+             value: str change to make (C is config option without prefix):
+                 C to enable C
+                 ~C to disable C
+                 C=val to set the value of C (val must have quotes if C is
+                     a string Kconfig)
+
+    Returns:
+        list of str: New list of lines resulting from the processing
+    """
+    out_lines = []
+    done = set()
+    for line in lines:
+        out_line, _ = adjust_cfg_line(line, adjust_cfg, done)
+        out_lines.append(out_line)
+
+    for opt in adjust_cfg:
+        if opt not in done:
+            adj = adjust_cfg.get(opt)
+            out_line = make_cfg_line(opt, adj)
+            out_lines.append(out_line)
+
+    return out_lines
+
+def adjust_cfg_file(fname, adjust_cfg):
+    """Make adjustments to a .config file
+
+    Args:
+        fname (str): Filename of .config file to change
+        adjust_cfg (dict of str): Changes to make to .config file before
+                building:
+             key: str config to change, without the CONFIG_ prefix, e.g.
+                 FRED
+             value: str change to make (C is config option without prefix):
+                 C to enable C
+                 ~C to disable C
+                 C=val to set the value of C (val must have quotes if C is
+                     a string Kconfig)
+    """
+    lines = tools.ReadFile(fname, binary=False).splitlines()
+    out_lines = adjust_cfg_lines(lines, adjust_cfg)
+    out = '\n'.join(out_lines) + '\n'
+    tools.WriteFile(fname, out, binary=False)
+
+def convert_list_to_dict(adjust_cfg_list):
+    """Convert a list of config changes into the dict used by adjust_cfg_file()
+
+    Args:
+        adjust_cfg_list (list of str): List of changes to make to .config file
+            before building. Each is one of (where C is the config option with
+            or without the CONFIG_ prefix)
+
+                C to enable C
+                ~C to disable C
+                C=val to set the value of C (val must have quotes if C is
+                    a string Kconfig
+
+    Returns:
+        dict of str: Changes to make to .config file before building:
+             key: str config to change, without the CONFIG_ prefix, e.g. FRED
+             value: str change to make (C is config option without prefix):
+                 C to enable C
+                 ~C to disable C
+                 C=val to set the value of C (val must have quotes if C is
+                     a string Kconfig)
+
+    Raises:
+        ValueError: if an item in adjust_cfg_list has invalid syntax
+    """
+    result = {}
+    for cfg in adjust_cfg_list or []:
+        m_cfg = RE_CFG.match(cfg)
+        if not m_cfg:
+            raise ValueError(f"Invalid CONFIG adjustment '{cfg}'")
+        negate, _, opt, val = m_cfg.groups()
+        result[opt] = f'%s{opt}%s' % (negate or '', val or '')
+
+    return result
+
+def check_cfg_lines(lines, adjust_cfg):
+    """Check that lines do not conflict with the requested changes
+
+    If a line enables a CONFIG which was requested to be disabled, etc., then
+    this is an error. This function finds such errors.
+
+    Args:
+        lines (list of str): List of lines to process
+        adjust_cfg (dict of str): Changes to make to .config file before
+                building:
+             key: str config to change, without the CONFIG_ prefix, e.g.
+                 FRED
+             value: str change to make (C is config option without prefix):
+                 C to enable C
+                 ~C to disable C
+                 C=val to set the value of C (val must have quotes if C is
+                     a string Kconfig)
+
+    Returns:
+        list of tuple: list of errors, each a tuple:
+            str: cfg adjustment requested
+            str: line of the config that conflicts
+    """
+    bad = []
+    done = set()
+    for line in lines:
+        out_line, adj = adjust_cfg_line(line, adjust_cfg, done)
+        if out_line != line:
+            bad.append([adj, line])
+
+    for opt in adjust_cfg:
+        if opt not in done:
+            adj = adjust_cfg.get(opt)
+            out_line = make_cfg_line(opt, adj)
+            bad.append([adj, f'Missing expected line: {out_line}'])
+
+    return bad
+
+def check_cfg_file(fname, adjust_cfg):
+    """Check that a config file has been adjusted according to adjust_cfg
+
+    Args:
+        fname (str): Filename of .config file to change
+        adjust_cfg (dict of str): Changes to make to .config file before
+                building:
+             key: str config to change, without the CONFIG_ prefix, e.g.
+                 FRED
+             value: str change to make (C is config option without prefix):
+                 C to enable C
+                 ~C to disable C
+                 C=val to set the value of C (val must have quotes if C is
+                     a string Kconfig)
+
+    Returns:
+        str: None if OK, else an error string listing the problems
+    """
+    lines = tools.ReadFile(fname, binary=False).splitlines()
+    bad_cfgs = check_cfg_lines(lines, adjust_cfg)
+    if bad_cfgs:
+        out = [f'{cfg:20}  {line}' for cfg, line in bad_cfgs]
+        content = '\\n'.join(out)
+        return f'''
+Some CONFIG adjustments did not take effect. This may be because
+the request CONFIGs do not exist or conflict with others.
+
+Failed adjustments:
+
+{content}
+'''
+    return None
diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py
index 7edbee0652f..e09ccb742e8 100644
--- a/tools/buildman/func_test.py
+++ b/tools/buildman/func_test.py
@@ -182,11 +182,11 @@ class TestFunctional(unittest.TestCase):
         self._buildman_pathname = sys.argv[0]
         self._buildman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
         command.test_result = self._HandleCommand
+        bsettings.Setup(None)
+        bsettings.AddFile(settings_data)
         self.setupToolchains()
         self._toolchains.Add('arm-gcc', test=False)
         self._toolchains.Add('powerpc-gcc', test=False)
-        bsettings.Setup(None)
-        bsettings.AddFile(settings_data)
         self._boards = board.Boards()
         for brd in boards:
             self._boards.AddBoard(board.Board(*brd))
diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index b9c65c0d326..2751377e879 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -12,6 +12,7 @@ import unittest
 from buildman import board
 from buildman import bsettings
 from buildman import builder
+from buildman import cfgutil
 from buildman import control
 from buildman import toolchain
 from patman import commit
@@ -624,5 +625,127 @@ class TestBuild(unittest.TestCase):
         expected = set([os.path.join(base_dir, f) for f in to_remove])
         self.assertEqual(expected, result)
 
+    def test_adjust_cfg_nop(self):
+        """check various adjustments of config that are nops"""
+        # enable an enabled CONFIG
+        self.assertEqual(
+            'CONFIG_FRED=y',
+            cfgutil.adjust_cfg_line('CONFIG_FRED=y', {'FRED':'FRED'})[0])
+
+        # disable a disabled CONFIG
+        self.assertEqual(
+            '# CONFIG_FRED is not set',
+            cfgutil.adjust_cfg_line(
+                '# CONFIG_FRED is not set', {'FRED':'~FRED'})[0])
+
+        # use the adjust_cfg_lines() function
+        self.assertEqual(
+            ['CONFIG_FRED=y'],
+            cfgutil.adjust_cfg_lines(['CONFIG_FRED=y'], {'FRED':'FRED'}))
+        self.assertEqual(
+            ['# CONFIG_FRED is not set'],
+            cfgutil.adjust_cfg_lines(['CONFIG_FRED=y'], {'FRED':'~FRED'}))
+
+        # handling an empty line
+        self.assertEqual('#', cfgutil.adjust_cfg_line('#', {'FRED':'~FRED'})[0])
+
+    def test_adjust_cfg(self):
+        """check various adjustments of config"""
+        # disable a CONFIG
+        self.assertEqual(
+            '# CONFIG_FRED is not set',
+            cfgutil.adjust_cfg_line('CONFIG_FRED=1' , {'FRED':'~FRED'})[0])
+
+        # enable a disabled CONFIG
+        self.assertEqual(
+            'CONFIG_FRED=y',
+            cfgutil.adjust_cfg_line(
+                '# CONFIG_FRED is not set', {'FRED':'FRED'})[0])
+
+        # enable a CONFIG that doesn't exist
+        self.assertEqual(
+            ['CONFIG_FRED=y'],
+            cfgutil.adjust_cfg_lines([], {'FRED':'FRED'}))
+
+        # disable a CONFIG that doesn't exist
+        self.assertEqual(
+            ['# CONFIG_FRED is not set'],
+            cfgutil.adjust_cfg_lines([], {'FRED':'~FRED'}))
+
+        # disable a value CONFIG
+        self.assertEqual(
+            '# CONFIG_FRED is not set',
+            cfgutil.adjust_cfg_line('CONFIG_FRED="fred"' , {'FRED':'~FRED'})[0])
+
+        # setting a value CONFIG
+        self.assertEqual(
+            'CONFIG_FRED="fred"',
+            cfgutil.adjust_cfg_line('# CONFIG_FRED is not set' ,
+                                    {'FRED':'FRED="fred"'})[0])
+
+        # changing a value CONFIG
+        self.assertEqual(
+            'CONFIG_FRED="fred"',
+            cfgutil.adjust_cfg_line('CONFIG_FRED="ernie"' ,
+                                    {'FRED':'FRED="fred"'})[0])
+
+        # setting a value for a CONFIG that doesn't exist
+        self.assertEqual(
+            ['CONFIG_FRED="fred"'],
+            cfgutil.adjust_cfg_lines([], {'FRED':'FRED="fred"'}))
+
+    def test_convert_adjust_cfg_list(self):
+        """Check conversion of the list of changes into a dict"""
+        self.assertEqual({}, cfgutil.convert_list_to_dict(None))
+
+        expect = {
+            'FRED':'FRED',
+            'MARY':'~MARY',
+            'JOHN':'JOHN=0x123',
+            'ALICE':'ALICE="alice"',
+            'AMY':'AMY',
+            'ABE':'~ABE',
+            'MARK':'MARK=0x456',
+            'ANNA':'ANNA="anna"',
+            }
+        actual = cfgutil.convert_list_to_dict(
+            ['FRED', '~MARY', 'JOHN=0x123', 'ALICE="alice"',
+             'CONFIG_AMY', '~CONFIG_ABE', 'CONFIG_MARK=0x456',
+             'CONFIG_ANNA="anna"'])
+        self.assertEqual(expect, actual)
+
+    def test_check_cfg_file(self):
+        """Test check_cfg_file detects conflicts as expected"""
+        # Check failure to disable CONFIG
+        result = cfgutil.check_cfg_lines(['CONFIG_FRED=1'], {'FRED':'~FRED'})
+        self.assertEqual([['~FRED', 'CONFIG_FRED=1']], result)
+
+        result = cfgutil.check_cfg_lines(
+            ['CONFIG_FRED=1', 'CONFIG_MARY="mary"'], {'FRED':'~FRED'})
+        self.assertEqual([['~FRED', 'CONFIG_FRED=1']], result)
+
+        result = cfgutil.check_cfg_lines(
+            ['CONFIG_FRED=1', 'CONFIG_MARY="mary"'], {'MARY':'~MARY'})
+        self.assertEqual([['~MARY', 'CONFIG_MARY="mary"']], result)
+
+        # Check failure to enable CONFIG
+        result = cfgutil.check_cfg_lines(
+            ['# CONFIG_FRED is not set'], {'FRED':'FRED'})
+        self.assertEqual([['FRED', '# CONFIG_FRED is not set']], result)
+
+        # Check failure to set CONFIG value
+        result = cfgutil.check_cfg_lines(
+            ['# CONFIG_FRED is not set', 'CONFIG_MARY="not"'],
+            {'MARY':'MARY="mary"', 'FRED':'FRED'})
+        self.assertEqual([
+            ['FRED', '# CONFIG_FRED is not set'],
+            ['MARY="mary"', 'CONFIG_MARY="not"']], result)
+
+        # Check failure to add CONFIG value
+        result = cfgutil.check_cfg_lines([], {'MARY':'MARY="mary"'})
+        self.assertEqual([
+            ['MARY="mary"', 'Missing expected line: CONFIG_MARY="mary"']], result)
+
+
 if __name__ == "__main__":
     unittest.main()
-- 
2.34.1.703.g22d0c6ccf7-goog


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v4 11/13] buildman: Provide a hint on how to debug thread crashes
  2022-01-16 20:19 [PATCH v4 00/13] kconfig: Add some new macros Simon Glass
                   ` (9 preceding siblings ...)
  2022-01-16 20:19 ` [PATCH v4 10/13] buildman: Add helper functions for updating .config files Simon Glass
@ 2022-01-16 20:19 ` Simon Glass
  2022-01-16 20:19 ` [PATCH v4 12/13] buildman: Allow adjusting board config on the fly Simon Glass
  2022-01-16 20:19 ` [PATCH v4 13/13] test: Add some tests for kconfig.h Simon Glass
  12 siblings, 0 replies; 20+ messages in thread
From: Simon Glass @ 2022-01-16 20:19 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Rasmus Villemoes, Simon Glass

If a thread crashes it is helpful to try the operation again with
threading disabled. Add a hint about that.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 tools/buildman/builderthread.py | 2 +-
 tools/buildman/func_test.py     | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index 3e450e40670..0faa3ac9385 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -557,6 +557,6 @@ class BuilderThread(threading.Thread):
             try:
                 self.RunJob(job)
             except Exception as e:
-                print('Thread exception:', e)
+                print('Thread exception (use -T0 to run without threads):', e)
                 self.builder.thread_exceptions.append(e)
             self.builder.queue.task_done()
diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py
index e09ccb742e8..c2e0b0b5c62 100644
--- a/tools/buildman/func_test.py
+++ b/tools/buildman/func_test.py
@@ -623,4 +623,6 @@ class TestFunctional(unittest.TestCase):
         with test_util.capture_sys_output() as (stdout, stderr):
             self.assertEqual(102, self._RunControl('-o', self._output_dir,
                                                    test_thread_exceptions=True))
-        self.assertIn('Thread exception: test exception', stdout.getvalue())
+        self.assertIn(
+            'Thread exception (use -T0 to run without threads): test exception',
+            stdout.getvalue())
-- 
2.34.1.703.g22d0c6ccf7-goog


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v4 12/13] buildman: Allow adjusting board config on the fly
  2022-01-16 20:19 [PATCH v4 00/13] kconfig: Add some new macros Simon Glass
                   ` (10 preceding siblings ...)
  2022-01-16 20:19 ` [PATCH v4 11/13] buildman: Provide a hint on how to debug thread crashes Simon Glass
@ 2022-01-16 20:19 ` Simon Glass
  2022-01-16 20:19 ` [PATCH v4 13/13] test: Add some tests for kconfig.h Simon Glass
  12 siblings, 0 replies; 20+ messages in thread
From: Simon Glass @ 2022-01-16 20:19 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Rasmus Villemoes, Simon Glass

Add a -a option to specify changes to the config before the build
commences. For example

   buildman -a ~CONFIG_CMDLINE

disables CONFIG_CMDLINE before doing the build.

This makes it easier to try things out as well as to write tests without
creating a new board or manually manging the .config file.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 tools/buildman/README           | 49 +++++++++++++++++++++++++++++++++
 tools/buildman/builder.py       | 14 +++++++++-
 tools/buildman/builderthread.py | 30 ++++++++++++++++----
 tools/buildman/cmdline.py       |  2 ++
 tools/buildman/control.py       |  6 +++-
 5 files changed, 93 insertions(+), 8 deletions(-)

diff --git a/tools/buildman/README b/tools/buildman/README
index ce277884326..bafb3b065ce 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -1095,6 +1095,55 @@ This will write the full build into /tmp/build including object files. You must
 specify the output directory with -o when using -w.
 
 
+Changing the configuration
+==========================
+
+Sometimes it is useful to change the CONFIG options for a build on the fly. This
+can be used to build a board (or multiple) with a few changes to see the impact.
+The -a option supports this:
+
+   -a <cfg>
+
+where <cfg> is a CONFIG option (with or without the CONFIG_ prefix) to enable.
+For example:
+
+    buildman -a CMD_SETEXPR_FMT
+
+will build with CONFIG_CMD_SETEXPR_FMT enabled.
+
+You can disable options by preceding them with tilde (~). You can specify the
+-a option multiple times:
+
+    buildman -a CMD_SETEXPR_FMT -a ~CMDLINE
+
+Some options have values, in which case you can change them:
+
+    buildman -a 'BOOTCOMMAND="echo hello"' CONFIG_SYS_LOAD_ADDR=0x1000
+
+Note that you must put quotes around string options and the whole thing must be
+in single quotes, to make sure the shell leave it alone.
+
+If you try to set an option that does not exist, or that cannot be changed for
+some other reason (e.g. it is 'selected' by another option), then buildman
+shows an error:
+
+   buildman --board sandbox -a FRED
+   Building current source for 1 boards (1 thread, 32 jobs per thread)
+       0    0    0 /1       -1      (starting)errs
+   Some CONFIG adjustments did not take effect. This may be because
+   the request CONFIGs do not exist or conflict with others.
+
+   Failed adjustments:
+
+   FRED                  Missing expected line: CONFIG_FRED=y
+
+
+One major caveat with this feature with branches (-b) is that buildman does not
+name the output directories differently when you change the configuration, so
+doing the same build again with different configuration will not trigger a
+rebuild. You can use -f to work around that.
+
+
 Other options
 =============
 
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 122f0d14065..720bbb2cf4d 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -250,7 +250,7 @@ class Builder:
                  mrproper=False, per_board_out_dir=False,
                  config_only=False, squash_config_y=False,
                  warnings_as_errors=False, work_in_output=False,
-                 test_thread_exceptions=False):
+                 test_thread_exceptions=False, adjust_cfg=None):
         """Create a new Builder object
 
         Args:
@@ -280,6 +280,15 @@ class Builder:
             test_thread_exceptions: Uses for tests only, True to make the
                 threads raise an exception instead of reporting their result.
                 This simulates a failure in the code somewhere
+            adjust_cfg_list (list of str): List of changes to make to .config
+                file before building. Each is one of (where C is the config
+                option with or without the CONFIG_ prefix)
+
+                    C to enable C
+                    ~C to disable C
+                    C=val to set the value of C (val must have quotes if C is
+                        a string Kconfig
+
         """
         self.toolchains = toolchains
         self.base_dir = base_dir
@@ -315,6 +324,8 @@ class Builder:
         self.squash_config_y = squash_config_y
         self.config_filenames = BASE_CONFIG_FILENAMES
         self.work_in_output = work_in_output
+        self.adjust_cfg = adjust_cfg
+
         if not self.squash_config_y:
             self.config_filenames += EXTRA_CONFIG_FILENAMES
         self._terminated = False
@@ -1747,6 +1758,7 @@ class Builder:
             job.commits = commits
             job.keep_outputs = keep_outputs
             job.work_in_output = self.work_in_output
+            job.adjust_cfg = self.adjust_cfg
             job.step = self._step
             if self.num_threads:
                 self.queue.put(job)
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index 0faa3ac9385..ecb285c0bfa 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -9,6 +9,7 @@ import shutil
 import sys
 import threading
 
+from buildman import cfgutil
 from patman import command
 from patman import gitutil
 
@@ -130,7 +131,8 @@ class BuilderThread(threading.Thread):
                 **kwargs)
 
     def RunCommit(self, commit_upto, brd, work_dir, do_config, config_only,
-                  force_build, force_build_failures, work_in_output):
+                  force_build, force_build_failures, work_in_output,
+                  adjust_cfg):
         """Build a particular commit.
 
         If the build is already done, and we are not forcing a build, we skip
@@ -147,6 +149,13 @@ class BuilderThread(threading.Thread):
                 failure
             work_in_output: Use the output directory as the work directory and
                 don't write to a separate output directory.
+            adjust_cfg (list of str): List of changes to make to .config file
+                before building. Each is one of (where C is either CONFIG_xxx
+                or just xxx):
+                     C to enable C
+                     ~C to disable C
+                     C=val to set the value of C (val must have quotes if C is
+                         a string Kconfig
 
         Returns:
             tuple containing:
@@ -261,7 +270,8 @@ class BuilderThread(threading.Thread):
                         os.remove(fname)
 
                 # If we need to reconfigure, do that now
-                if do_config:
+                cfg_file = os.path.join(out_dir, '.config')
+                if do_config or adjust_cfg:
                     config_out = ''
                     if self.mrproper:
                         result = self.Make(commit, brd, 'mrproper', cwd,
@@ -271,11 +281,19 @@ class BuilderThread(threading.Thread):
                             *(args + config_args), env=env)
                     config_out += result.combined
                     do_config = False   # No need to configure next time
+                    if adjust_cfg:
+                        cfgutil.adjust_cfg_file(cfg_file, adjust_cfg)
                 if result.return_code == 0:
                     if config_only:
                         args.append('cfg')
                     result = self.Make(commit, brd, 'build', cwd, *args,
                             env=env)
+                    if adjust_cfg:
+                        errs = cfgutil.check_cfg_file(cfg_file, adjust_cfg)
+                        if errs:
+                            print('errs', errs)
+                            result.stderr += errs
+                            result.return_code = 1
                 result.stderr = result.stderr.replace(src_dir + '/', '')
                 if self.builder.verbose_build:
                     result.stdout = config_out + result.stdout
@@ -486,7 +504,7 @@ class BuilderThread(threading.Thread):
                         work_dir, do_config, self.builder.config_only,
                         force_build or self.builder.force_build,
                         self.builder.force_build_failures,
-                        work_in_output=job.work_in_output)
+                        job.work_in_output, job.adjust_cfg)
                 failed = result.return_code or result.stderr
                 did_config = do_config
                 if failed and not do_config:
@@ -495,7 +513,7 @@ class BuilderThread(threading.Thread):
                     if self.builder.force_config_on_failure:
                         result, request_config = self.RunCommit(commit_upto,
                             brd, work_dir, True, False, True, False,
-                            work_in_output=job.work_in_output)
+                            job.work_in_output, job.adjust_cfg)
                         did_config = True
                 if not self.builder.force_reconfig:
                     do_config = request_config
@@ -540,8 +558,8 @@ class BuilderThread(threading.Thread):
             # Just build the currently checked-out build
             result, request_config = self.RunCommit(None, brd, work_dir, True,
                         self.builder.config_only, True,
-                        self.builder.force_build_failures,
-                        work_in_output=job.work_in_output)
+                        self.builder.force_build_failures, job.work_in_output,
+                        job.adjust_cfg)
             result.commit_upto = 0
             self._WriteResult(result, job.keep_outputs, job.work_in_output)
             self._SendResult(result)
diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py
index 092a82f4e9c..8586bdf3b58 100644
--- a/tools/buildman/cmdline.py
+++ b/tools/buildman/cmdline.py
@@ -13,6 +13,8 @@ def ParseArgs():
             args: command lin arguments
     """
     parser = OptionParser()
+    parser.add_option('-a', '--adjust-cfg', type=str, action='append',
+          help='Adjust the Kconfig settings in .config before building')
     parser.add_option('-A', '--print-prefix', action='store_true',
           help='Print the tool-chain prefix for a board (CROSS_COMPILE=)')
     parser.add_option('-b', '--branch', type='string',
diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index fd9664c85d8..eee81130663 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -10,6 +10,7 @@ import sys
 
 from buildman import board
 from buildman import bsettings
+from buildman import cfgutil
 from buildman import toolchain
 from buildman.builder import Builder
 from patman import command
@@ -321,6 +322,8 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
             output_dir = os.path.join(options.output_dir, dirname)
         if clean_dir and os.path.exists(output_dir):
             shutil.rmtree(output_dir)
+    adjust_cfg = cfgutil.convert_list_to_dict(options.adjust_cfg)
+
     builder = Builder(toolchains, output_dir, options.git_dir,
             options.threads, options.jobs, gnu_make=gnu_make, checkout=True,
             show_unknown=options.show_unknown, step=options.step,
@@ -332,7 +335,8 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
             squash_config_y=not options.preserve_config_y,
             warnings_as_errors=options.warnings_as_errors,
             work_in_output=options.work_in_output,
-            test_thread_exceptions=test_thread_exceptions)
+            test_thread_exceptions=test_thread_exceptions,
+            adjust_cfg=adjust_cfg)
     builder.force_config_on_failure = not options.quick
     if make_func:
         builder.do_make = make_func
-- 
2.34.1.703.g22d0c6ccf7-goog


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v4 13/13] test: Add some tests for kconfig.h
  2022-01-16 20:19 [PATCH v4 00/13] kconfig: Add some new macros Simon Glass
                   ` (11 preceding siblings ...)
  2022-01-16 20:19 ` [PATCH v4 12/13] buildman: Allow adjusting board config on the fly Simon Glass
@ 2022-01-16 20:19 ` Simon Glass
  12 siblings, 0 replies; 20+ messages in thread
From: Simon Glass @ 2022-01-16 20:19 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Rasmus Villemoes, Simon Glass, Heiko Schocher,
	Heinrich Schuchardt, Sean Anderson, Steffen Jaeckel

The macros in this file are a little confusing and we currently have no
tests to check that they work as expected.

Add some tests which check the macros in C code. Add a few tests which
check that the build errors are generated correctly too, using buildman's
-a option.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v4:
- Expand the series with tests and buildman changes

 test/Kconfig                  |  1 +
 test/Makefile                 |  2 +-
 test/lib/Kconfig              | 23 ++++++++++++++
 test/lib/Makefile             |  5 +++
 test/lib/kconfig.c            | 58 +++++++++++++++++++++++++++++++++++
 test/lib/kconfig_spl.c        | 44 ++++++++++++++++++++++++++
 test/py/tests/test_kconfig.py | 34 ++++++++++++++++++++
 7 files changed, 166 insertions(+), 1 deletion(-)
 create mode 100644 test/lib/Kconfig
 create mode 100644 test/lib/kconfig.c
 create mode 100644 test/lib/kconfig_spl.c
 create mode 100644 test/py/tests/test_kconfig.py

diff --git a/test/Kconfig b/test/Kconfig
index e15ba239eb3..4137e7eabf5 100644
--- a/test/Kconfig
+++ b/test/Kconfig
@@ -97,5 +97,6 @@ config UT_UNICODE
 
 source "test/dm/Kconfig"
 source "test/env/Kconfig"
+source "test/lib/Kconfig"
 source "test/optee/Kconfig"
 source "test/overlay/Kconfig"
diff --git a/test/Makefile b/test/Makefile
index b3b2902e2e7..379f1e9fda7 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_$(SPL_)CMDLINE) += cmd_ut.o
 obj-$(CONFIG_$(SPL_)CMDLINE) += command_ut.o
 obj-$(CONFIG_$(SPL_)UT_COMPRESSION) += compression.o
 obj-y += dm/
+obj-$(CONFIG_UNIT_TEST) += lib/
 obj-$(CONFIG_$(SPL_)CMDLINE) += print_ut.o
 obj-$(CONFIG_$(SPL_)CMDLINE) += str_ut.o
 obj-$(CONFIG_UT_TIME) += time_ut.o
@@ -23,7 +24,6 @@ obj-y += ut.o
 
 ifeq ($(CONFIG_SPL_BUILD),)
 obj-$(CONFIG_UNIT_TEST) += common/
-obj-$(CONFIG_UNIT_TEST) += lib/
 obj-y += log/
 obj-$(CONFIG_$(SPL_)UT_UNICODE) += unicode_ut.o
 endif
diff --git a/test/lib/Kconfig b/test/lib/Kconfig
new file mode 100644
index 00000000000..dbb03e4a36f
--- /dev/null
+++ b/test/lib/Kconfig
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2022 Google LLC
+
+if SANDBOX
+
+config TEST_KCONFIG
+	bool "Enable detection of Kconfig macro errors"
+	help
+	  This is used to test that the IF_ENABLED_INT() macro causes a build error
+	  if the value is used when the CONFIG Is not enabled.
+
+config TEST_KCONFIG_ENABLE
+	bool "Option to enable"
+	help
+	  This is the option that controls whether the value is present.
+
+config TEST_KCONFIG_VALUE
+	int "Value associated with the option"
+	depends on TEST_KCONFIG_ENABLE
+	help
+	  This is the value whgch is present if TEST_KCONFIG_ENABLE is enabled.
+
+endif # SANDBOX
diff --git a/test/lib/Makefile b/test/lib/Makefile
index d244bb431d4..7e7922fe3b4 100644
--- a/test/lib/Makefile
+++ b/test/lib/Makefile
@@ -2,11 +2,13 @@
 #
 # (C) Copyright 2018
 # Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
+ifeq ($(CONFIG_SPL_BUILD),)
 obj-y += cmd_ut_lib.o
 obj-y += abuf.o
 obj-$(CONFIG_EFI_LOADER) += efi_device_path.o
 obj-$(CONFIG_EFI_SECURE_BOOT) += efi_image_region.o
 obj-y += hexdump.o
+obj-$(CONFIG_SANDBOX) += kconfig.o
 obj-y += lmb.o
 obj-y += longjmp.o
 obj-$(CONFIG_CONSOLE_RECORD) += test_print.o
@@ -19,3 +21,6 @@ obj-$(CONFIG_UT_LIB_RSA) += rsa.o
 obj-$(CONFIG_AES) += test_aes.o
 obj-$(CONFIG_GETOPT) += getopt.o
 obj-$(CONFIG_UT_LIB_CRYPT) += test_crypt.o
+else
+obj-$(CONFIG_SANDBOX) += kconfig_spl.o
+endif
diff --git a/test/lib/kconfig.c b/test/lib/kconfig.c
new file mode 100644
index 00000000000..472d2c57280
--- /dev/null
+++ b/test/lib/kconfig.c
@@ -0,0 +1,58 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test of linux/kconfig.h macros
+ *
+ * Copyright 2022 Google LLC
+ * Written by Simon Glass <sjg@chromium.org>
+ */
+
+#include <common.h>
+#include <test/lib.h>
+#include <test/test.h>
+#include <test/ut.h>
+
+static int lib_test_is_enabled(struct unit_test_state *uts)
+{
+	ulong val;
+
+	ut_asserteq(1, IS_ENABLED(CONFIG_CMDLINE))
+	ut_asserteq(0, IS_ENABLED(CONFIG__UNDEFINED))
+
+	ut_asserteq(1, CONFIG_IS_ENABLED(CMDLINE))
+	ut_asserteq(0, CONFIG_IS_ENABLED(OF_PLATDATA))
+	ut_asserteq(0, CONFIG_IS_ENABLED(_UNDEFINED))
+
+	ut_asserteq(0xc000,
+		    IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED, CONFIG_BLOBLIST_ADDR));
+	ut_asserteq(0xc000,
+		    CONFIG_IF_ENABLED_INT(BLOBLIST_FIXED, BLOBLIST_ADDR));
+
+	/*
+	 * 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 = IF_ENABLED_INT(CONFIG_TEST_KCONFIG_ENABLE,
+				     CONFIG_TEST_KCONFIG_VALUE);
+		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) &&
+	    CONFIG_IS_ENABLED(TEST_KCONFIG)) {
+		val = CONFIG_IF_ENABLED_INT(TEST_KCONFIG_ENABLE,
+					    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
new file mode 100644
index 00000000000..c89ceaec66f
--- /dev/null
+++ b/test/lib/kconfig_spl.c
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test of linux/kconfig.h macros for SPL
+ *
+ * Copyright 2022 Google LLC
+ * Written by Simon Glass <sjg@chromium.org>
+ */
+
+#include <common.h>
+#include <test/lib.h>
+#include <test/test.h>
+#include <test/ut.h>
+
+static int lib_test_spl_is_enabled(struct unit_test_state *uts)
+{
+	ulong val;
+
+	ut_asserteq(0, CONFIG_IS_ENABLED(CMDLINE))
+	ut_asserteq(1, CONFIG_IS_ENABLED(OF_PLATDATA))
+	ut_asserteq(0, CONFIG_IS_ENABLED(_UNDEFINED))
+
+	/*
+	 * This fails if CONFIG_TEST_KCONFIG_ENABLE is not enabled, since the
+	 * value is used.
+	 */
+	if (IS_ENABLED(CONFIG_TEST_KCONFIG)) {
+		val = IF_ENABLED_INT(CONFIG_TEST_KCONFIG_ENABLE,
+				     CONFIG_TEST_KCONFIG_VALUE);
+		printf("value %ld\n", val);
+	}
+
+	/*
+	 * This fails if CONFIG_TEST_KCONFIG_ENABLE is not enabled, since the
+	 * value is used.
+	 */
+	if (CONFIG_IS_ENABLED(TEST_KCONFIG)) {
+		val = CONFIG_IF_ENABLED_INT(TEST_KCONFIG_ENABLE,
+					    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
new file mode 100644
index 00000000000..43ab4824334
--- /dev/null
+++ b/test/py/tests/test_kconfig.py
@@ -0,0 +1,34 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright 2022 Google LLC
+# Written by Simon Glass <sjg@chromium.org>
+
+import pytest
+
+import u_boot_utils as util
+
+@pytest.mark.slow
+def test_kconfig(u_boot_console):
+    """Test build failures when IF_ENABLED_INT() option is not enabled"""
+    cons = u_boot_console
+
+    # This detects build errors in test/lib/kconfig.c
+    out = util.run_and_log(
+        cons, ['./tools/buildman/buildman', '--board', 'sandbox',
+               '-a', 'TEST_KCONFIG'], 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
+def test_kconfig_spl(u_boot_console):
+    """Test build failures when IF_ENABLED_INT() option is not enabled"""
+    cons = u_boot_console
+
+    # This detects build errors in test/lib/kconfig_spl.c
+    out = util.run_and_log(
+        cons, ['./tools/buildman/buildman', '--board', 'sandbox_spl',
+               '-a', 'TEST_KCONFIG'], 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()
+    # line should not generate an error
+    assert 'invalid_use_of_CONFIG_IF_ENABLED_INT' not in out
-- 
2.34.1.703.g22d0c6ccf7-goog


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH v4 03/13] mmc: fsl: Use brackets around if()
  2022-01-16 20:19 ` [PATCH v4 03/13] mmc: fsl: Use brackets around if() Simon Glass
@ 2022-01-16 21:06   ` Sean Anderson
  2022-01-16 23:50   ` Jaehoon Chung
  1 sibling, 0 replies; 20+ messages in thread
From: Sean Anderson @ 2022-01-16 21:06 UTC (permalink / raw)
  To: Simon Glass, U-Boot Mailing List
  Cc: Tom Rini, Rasmus Villemoes, Jaehoon Chung, Peng Fan

On 1/16/22 3:19 PM, Simon Glass wrote:
> At present the IS_ENABLED() macro has extra brackets, making it possible
> to write:
> 
>     if IS_ENABLED(CONFIG_XXX)
> 
> but it is a bit confusing. Add the missing brackets.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
> (no changes since v1)
> 
>   drivers/mmc/fsl_esdhc_imx.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
> index 9299635f509..08ea98fe81a 100644
> --- a/drivers/mmc/fsl_esdhc_imx.c
> +++ b/drivers/mmc/fsl_esdhc_imx.c
> @@ -453,7 +453,7 @@ static int esdhc_send_cmd_common(struct fsl_esdhc_priv *priv, struct mmc *mmc,
>   
>   	/* Send the command */
>   	esdhc_write32(&regs->cmdarg, cmd->cmdarg);
> -	if IS_ENABLED(CONFIG_FSL_USDHC) {
> +	if (IS_ENABLED(CONFIG_FSL_USDHC)) {
>   		u32 mixctrl = esdhc_read32(&regs->mixctrl);
>   
>   		esdhc_write32(&regs->mixctrl,
> 

Reviewed-by: Sean Anderson <seanga2@gmail.com>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v4 03/13] mmc: fsl: Use brackets around if()
  2022-01-16 20:19 ` [PATCH v4 03/13] mmc: fsl: Use brackets around if() Simon Glass
  2022-01-16 21:06   ` Sean Anderson
@ 2022-01-16 23:50   ` Jaehoon Chung
  2022-01-17 14:26     ` Minkyu Kang
  1 sibling, 1 reply; 20+ messages in thread
From: Jaehoon Chung @ 2022-01-16 23:50 UTC (permalink / raw)
  To: Simon Glass, U-Boot Mailing List; +Cc: Tom Rini, Rasmus Villemoes, Peng Fan

On 1/17/22 5:19 AM, Simon Glass wrote:
> At present the IS_ENABLED() macro has extra brackets, making it possible
> to write:
> 
>    if IS_ENABLED(CONFIG_XXX)
> 
> but it is a bit confusing. Add the missing brackets.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> ---
> 
> (no changes since v1)
> 
>  drivers/mmc/fsl_esdhc_imx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
> index 9299635f509..08ea98fe81a 100644
> --- a/drivers/mmc/fsl_esdhc_imx.c
> +++ b/drivers/mmc/fsl_esdhc_imx.c
> @@ -453,7 +453,7 @@ static int esdhc_send_cmd_common(struct fsl_esdhc_priv *priv, struct mmc *mmc,
>  
>  	/* Send the command */
>  	esdhc_write32(&regs->cmdarg, cmd->cmdarg);
> -	if IS_ENABLED(CONFIG_FSL_USDHC) {
> +	if (IS_ENABLED(CONFIG_FSL_USDHC)) {
>  		u32 mixctrl = esdhc_read32(&regs->mixctrl);
>  
>  		esdhc_write32(&regs->mixctrl,
> 


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v4 01/13] imx: Don't define __ASSEMBLY__ in C files
  2022-01-16 20:19 ` [PATCH v4 01/13] imx: Don't define __ASSEMBLY__ in C files Simon Glass
@ 2022-01-17 13:53   ` Tom Rini
  2022-01-19 14:37     ` Simon Glass
  0 siblings, 1 reply; 20+ messages in thread
From: Tom Rini @ 2022-01-17 13:53 UTC (permalink / raw)
  To: Simon Glass
  Cc: U-Boot Mailing List, Rasmus Villemoes, Adam Ford, Adrian Alonso,
	Anatolij Gustschin, Arkadiusz Karas, Fabio Estevam,
	Frieder Schrempf, Giulio Benetti, Heiko Schocher, Ian Ray,
	Ilko Iliev, Marcel Ziswiler, Marek Vasut, Markus Niebel,
	Martyn Welch, NXP i.MX U-Boot Team, Oleh Kravchenko,
	Oliver Graute, Otavio Salvador, Patrick Wildt, Peng Fan,
	Richard Hu, Shawn Guo, Silvio Fricke, Soeren Moch, Stefano Babic,
	Teresa Remmet, Tim Harvey, Troy Kisky, Ying-Chun Liu (PaulLiu)

[-- Attachment #1: Type: text/plain, Size: 382 bytes --]

On Sun, Jan 16, 2022 at 01:19:25PM -0700, Simon Glass wrote:

> This is supposed to be a build-system flag. Move it there so we can
> define it before linux/kconfig.h is included.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

These aren't "C" files, they're DCD files.  I think we can move the
define as you're suggesting but the subject is wrong is all.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v4 03/13] mmc: fsl: Use brackets around if()
  2022-01-16 23:50   ` Jaehoon Chung
@ 2022-01-17 14:26     ` Minkyu Kang
  0 siblings, 0 replies; 20+ messages in thread
From: Minkyu Kang @ 2022-01-17 14:26 UTC (permalink / raw)
  To: Jaehoon Chung
  Cc: Peng Fan, Rasmus Villemoes, Simon Glass, Tom Rini, U-Boot Mailing List

Hi!

2022년 1월 17일 (월) 08:50, Jaehoon Chung <jh80.chung@samsung.com>님이 작성:

> On 1/17/22 5:19 AM, Simon Glass wrote:
> > At present the IS_ENABLED() macro has extra brackets, making it possible
> > to write:
> >
> >    if IS_ENABLED(CONFIG_XXX)
> >
> > but it is a bit confusing. Add the missing brackets.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
>
> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
>
> Best Regards,
> Jaehoon Chung


Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>


>
> > ---
> >
> > (no changes since v1)
> >
> >  drivers/mmc/fsl_esdhc_imx.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
> > index 9299635f509..08ea98fe81a 100644
> > --- a/drivers/mmc/fsl_esdhc_imx.c
> > +++ b/drivers/mmc/fsl_esdhc_imx.c
> > @@ -453,7 +453,7 @@ static int esdhc_send_cmd_common(struct
> fsl_esdhc_priv *priv, struct mmc *mmc,
> >
> >       /* Send the command */
> >       esdhc_write32(&regs->cmdarg, cmd->cmdarg);
> > -     if IS_ENABLED(CONFIG_FSL_USDHC) {
> > +     if (IS_ENABLED(CONFIG_FSL_USDHC)) {
> >               u32 mixctrl = esdhc_read32(&regs->mixctrl);
> >
> >               esdhc_write32(&regs->mixctrl,
> >
>
> --
Thanks. Minkyu Kang.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v4 02/13] mips: Avoid using config_enabled() directly
  2022-01-16 20:19 ` [PATCH v4 02/13] mips: Avoid using config_enabled() directly Simon Glass
@ 2022-01-18 19:47   ` Daniel Schwierzeck
  0 siblings, 0 replies; 20+ messages in thread
From: Daniel Schwierzeck @ 2022-01-18 19:47 UTC (permalink / raw)
  To: Simon Glass, U-Boot Mailing List; +Cc: Tom Rini, Rasmus Villemoes

Am Sonntag, dem 16.01.2022 um 13:19 -0700 schrieb Simon Glass:
> Use IS_ENABLED() instead, which is the correct macro for checking a
> CONFIG
> option.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

> ---
> 
> (no changes since v1)
> 
>  arch/mips/lib/cache.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/lib/cache.c b/arch/mips/lib/cache.c
> index 51a8f433475..ec652f0fba8 100644
> --- a/arch/mips/lib/cache.c
> +++ b/arch/mips/lib/cache.c
> @@ -38,7 +38,7 @@ static void probe_l2(void)
>  			l2c = read_c0_config5() & MIPS_CONF5_L2C;
>  	}
>  
> -	if (l2c && config_enabled(CONFIG_MIPS_CM)) {
> +	if (l2c && IS_ENABLED(CONFIG_MIPS_CM)) {
>  		gd->arch.l2_line_size = mips_cm_l2_line_size();
>  	} else if (l2c) {
>  		/* We don't know how to retrieve L2 config on this
> system */
-- 
- Daniel


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v4 01/13] imx: Don't define __ASSEMBLY__ in C files
  2022-01-17 13:53   ` Tom Rini
@ 2022-01-19 14:37     ` Simon Glass
  0 siblings, 0 replies; 20+ messages in thread
From: Simon Glass @ 2022-01-19 14:37 UTC (permalink / raw)
  To: Tom Rini
  Cc: U-Boot Mailing List, Rasmus Villemoes, Adam Ford, Adrian Alonso,
	Anatolij Gustschin, Arkadiusz Karas, Fabio Estevam,
	Frieder Schrempf, Giulio Benetti, Heiko Schocher, Ian Ray,
	Ilko Iliev, Marcel Ziswiler, Marek Vasut, Markus Niebel,
	Martyn Welch, NXP i.MX U-Boot Team, Oleh Kravchenko,
	Oliver Graute, Otavio Salvador, Patrick Wildt, Peng Fan,
	Richard Hu, Shawn Guo, Silvio Fricke, Soeren Moch, Stefano Babic,
	Teresa Remmet, Tim Harvey, Troy Kisky, Ying-Chun Liu (PaulLiu)

Hi Tom,

On Mon, 17 Jan 2022 at 06:54, Tom Rini <trini@konsulko.com> wrote:
>
> On Sun, Jan 16, 2022 at 01:19:25PM -0700, Simon Glass wrote:
>
> > This is supposed to be a build-system flag. Move it there so we can
> > define it before linux/kconfig.h is included.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
>
> These aren't "C" files, they're DCD files.  I think we can move the
> define as you're suggesting but the subject is wrong is all.

I was thinking 'source' files but wrote 'C'. I'll hold off sending a
new version unti lI get comments on the rest of it.

Regards,
Simon

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2022-01-19 14:59 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-16 20:19 [PATCH v4 00/13] kconfig: Add some new macros Simon Glass
2022-01-16 20:19 ` [PATCH v4 01/13] imx: Don't define __ASSEMBLY__ in C files Simon Glass
2022-01-17 13:53   ` Tom Rini
2022-01-19 14:37     ` Simon Glass
2022-01-16 20:19 ` [PATCH v4 02/13] mips: Avoid using config_enabled() directly Simon Glass
2022-01-18 19:47   ` Daniel Schwierzeck
2022-01-16 20:19 ` [PATCH v4 03/13] mmc: fsl: Use brackets around if() Simon Glass
2022-01-16 21:06   ` Sean Anderson
2022-01-16 23:50   ` Jaehoon Chung
2022-01-17 14:26     ` Minkyu Kang
2022-01-16 20:19 ` [PATCH v4 04/13] kconfig: Update IS_ENABLED() internals Simon Glass
2022-01-16 20:19 ` [PATCH v4 05/13] kconfig: Add support for conditional values Simon Glass
2022-01-16 20:19 ` [PATCH v4 06/13] bloblist: Update to use conditional value Simon Glass
2022-01-16 20:19 ` [PATCH v4 07/13] patman: Update test_util to run doc tests Simon Glass
2022-01-16 20:19 ` [PATCH v4 08/13] buildman: Add a flag to control the traceback Simon Glass
2022-01-16 20:19 ` [PATCH v4 09/13] buildman: Make use of test_util Simon Glass
2022-01-16 20:19 ` [PATCH v4 10/13] buildman: Add helper functions for updating .config files Simon Glass
2022-01-16 20:19 ` [PATCH v4 11/13] buildman: Provide a hint on how to debug thread crashes Simon Glass
2022-01-16 20:19 ` [PATCH v4 12/13] buildman: Allow adjusting board config on the fly Simon Glass
2022-01-16 20:19 ` [PATCH v4 13/13] test: Add some tests for kconfig.h Simon Glass

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.