CONFIG_IS_ENABLED vs IS_ENABLED
Subsystems (14)
v3 cover CONFIG_IS_ENABLED vs IS_ENABLED
This patch set gets ready to checks the usage of
CONFIG_IS_ENABLED/IS_ENABLED.
After the set has been applied, you can deletetest/usage_of_is_enabled_todo.txt
and run test/usage_of_is_enabled_commit.sh
The script test/usage_of_is_enabled_check.sh
checks for new questionable uses of
CONFIG_IS_ENABLED/IS_ENABLED and is added
to .azure-pipelines.yml, and
.gitlab-ci.yml
version 3 changes:
Dropped changes to puma-rk3399 and ringneck-px30 in favor of Quentin Schulz's patch
https://patchwork.ozlabs.org/project/uboot/patch/20230301-tsd-env-nowhere-kconfig-v1-1-d5c08e096906@theobroma-systems.com/
https://patchwork.ozlabs.org/project/uboot/patch/20230301-tsd-env-nowhere-kconfig-v1-2-d5c08e096906@theobroma-systems.com/
Please apply them before this series.
Drop gateworks: venice: Always define setup_fec and setup_eqos Drop arm: cpu: armv7: ls102xa: fdt: remove eth_device support Simon's patches took care of these
Add to todo list, these new questionable uses that snuck into the code. PARTITION_TYPE_GUID
PHY_ATHEROS
RTC_SANDBOX
Changes in v3:
remove error entirely and prevent with Kconfig new patch to address Tom's concerns
- Rebase on Simon's s/CMD_SATA/SATA/ change
- commit message updated
Changes in v2:
- new patch
- delay include of linux/kconfig.h to do from Makefile
- as suggested by Simon
- delay include of linux/kconfig.h to do from Makefile
- as suggested by Simon
- delay include of linux/kconfig.h to do from Makefile
- as suggested by Simon
- delay include of linux/kconfig.h to do from Makefile
- as suggested by Simon
- delay include of linux/kconfig.h to do from Makefile
- as suggested by Simon
- include linux/kconfig.h from tools/Makefile
- as suggested by Simon
- changed condition of when to include field bdf
- added protection to another instance of bdf in uart.c
- Thanks to Simon for getting this corrected
- use normal if, not preprocessor
- new in series
- use an accessor function gd_set_pci_ram_top
Troy Kisky (23):
kconfig: add IS_ENABLED_NOCHECK to bypass usage_of_is_enabled_check
cmd: nvedit: remove error check, handle with Kconfig
lib: crc32: prepare for CONFIG_IS_ENABLED changes
lib: md5: prepare for CONFIG_IS_ENABLED changes
lib: sha1: prepare for CONFIG_IS_ENABLED changes
lib: sha256: prepare for CONFIG_IS_ENABLED changes
lib: sha512: prepare for CONFIG_IS_ENABLED changes
watchdog: add and use Kconfig HAS_WATCHDOG_RUNNING
tools: prevent CONFIG_IS_ENABLED errors by including linux/kconfig.h
tools: Makefile: prepare for CONFIG_IS_ENABLED changes by adding
CONFIG_TOOLS_xxx
x86: cpu: qemu: qemu: remove SPL use with CONFIG_IS_ENABLED
config_distro_bootcmd: remove booting environment variables from SPL
environment
ofnode: fdt_support definitions needed if OF_CONTROL is enabled
fdt_support: always define fdt_fixup_mtdparts
m53menlo: define ft_board_setup only if CONFIG_IS_ENABLED(OF_LIBFDT)
freescale: common: pfuze: define pfuze_mode_init only if
defined(CONFIG_DM_PMIC)
ns16550: match when to define bdf with uart code
solidrun: mx6cuboxi: use CONFIG_IS_ENABLED(SATA) instead of ifdef
CONFIG_SATA
wandboard: use CONFIG_IS_ENABLED(SATA) instead of ifdef CONFIG_SATA
arm: mach-imx: use CONFIG_$(SPL_)SATA instead of CONFIG_SATA
x86: cpu: i386: cpu: only set pci_ram_top if CONFIG_IS_ENABLED(PCI)
power: pmic: add dm style definitions if not
CONFIG_IS_ENABLED(POWER_LEGACY)
CI: add test/usage_of_is_enabled_check.sh
.azure-pipelines.yml | 11 ++ .gitlab-ci.yml | 5 + arch/arm/mach-imx/Makefile | 2 +- arch/arm/mach-omap2/boot-common.c | 5 +- arch/m68k/lib/time.c | 7 +- arch/powerpc/lib/interrupts.c | 5 +- arch/powerpc/lib/ticks.S | 2 +- arch/x86/cpu/apollolake/uart.c | 4 + arch/x86/cpu/i386/cpu.c | 2 +- arch/x86/cpu/qemu/qemu.c | 2 +- board/astro/mcf5373l/fpga.c | 10 +- board/freescale/common/pfuze.c | 2 +- board/menlo/m53menlo/m53menlo.c | 2 + board/solidrun/mx6cuboxi/mx6cuboxi.c | 5 +- board/wandboard/wandboard.c | 5 +- boot/image-board.c | 2 +- cmd/nvedit.c | 32 +--- cmd/ximg.c | 10 +- common/board_f.c | 4 +- common/spl/Kconfig | 4 + drivers/crypto/aspeed/aspeed_hace.c | 2 +- drivers/crypto/hash/hash_sw.c | 2 +- drivers/timer/mpc83xx_timer.c | 5 +- drivers/watchdog/Kconfig | 3 + env/Kconfig | 17 ++- fs/cramfs/uncompress.c | 9 +- include/asm-generic/global_data.h | 6 + include/config_distro_bootcmd.h | 23 +++ include/fdt_support.h | 26 ++-- include/linux/kconfig.h | 5 + include/ns16550.h | 2 +- include/power/pmic.h | 2 +- include/watchdog.h | 7 +- lib/bzip2/bzlib.c | 5 +- lib/bzip2/bzlib_decompress.c | 20 +-- lib/crc32.c | 11 +- lib/md5.c | 7 +- lib/sha1.c | 7 +- lib/sha256.c | 7 +- lib/sha512.c | 11 +- test/usage_of_is_enabled_check.sh | 19 +++ test/usage_of_is_enabled_commit.sh | 12 ++ test/usage_of_is_enabled_correct.sh | 50 +++++++ test/usage_of_is_enabled_exempt.txt | 9 ++ test/usage_of_is_enabled_list.sh | 86 +++++++++++ test/usage_of_is_enabled_splcfg.txt | 21 +++ test/usage_of_is_enabled_todo.txt | 213 +++++++++++++++++++++++++++ tools/Makefile | 3 + 48 files changed, 584 insertions(+), 127 deletions(-) create mode 100755 test/usage_of_is_enabled_check.sh create mode 100755 test/usage_of_is_enabled_commit.sh create mode 100755 test/usage_of_is_enabled_correct.sh create mode 100644 test/usage_of_is_enabled_exempt.txt create mode 100755 test/usage_of_is_enabled_list.sh create mode 100644 test/usage_of_is_enabled_splcfg.txt create mode 100644 test/usage_of_is_enabled_todo.txt
Signature · 1 line
2.34.1
PATCH v3 1/23 kconfig: add IS_ENABLED_NOCHECK to bypass usage_of_is_enabled_check
This is for use when a config with an SPL version needs to always check the non-spl verion of the config. It avoids error messages from CI test script usage_of_is_enabled_check.sh
---
(no changes since v2)
Changes in v2:
- new patch
include/linux/kconfig.h | 5 +++++ 1 file changed, 5 insertions(+)
include/linux/kconfig.h +5 -0
@@ -27,6 +27,11 @@* 0 otherwise. */ #define IS_ENABLED (option) config_enabled(option, 0) +/* +* Using IS_ENABLED_NOCHECK instead of IS_ENABLED prevents +* complaints from test/usage_of_is_enabled_check.sh +*/ +#define IS_ENABLED_NOCHECK (option) config_enabled(option, 0)/* * U-Boot add-on: Helper macros to reference to different macros (prefixed by
Signature · 1 line
2.34.1
PATCH v3 2/23 cmd: nvedit: remove error check, handle with Kconfig
In reply to Troy KiskyAvoid error messages when SPL,TPL,VPL build don't have the environment options of the main build. This is needed when defined(CONFIG_ENV_IS_IN_xxx) is changed to CONFIG_IS_ENABLED(ENV_IS_IN_xxx).
---
Changes in v3:
remove error entirely and prevent with Kconfig
cmd/nvedit.c | 32 +++++--------------------------- env/Kconfig | 17 ++++++++++------- 2 files changed, 15 insertions(+), 34 deletions(-)
cmd/nvedit.c +5 -27
@@ -43,28 +43,6 @@DECLARE_GLOBAL_DATA_PTR ; -#if defined(CONFIG_ENV_IS_IN_EEPROM ) || \ - defined(CONFIG_ENV_IS_IN_FLASH ) || \ - defined(CONFIG_ENV_IS_IN_MMC ) || \ - defined(CONFIG_ENV_IS_IN_FAT ) || \ - defined(CONFIG_ENV_IS_IN_EXT4 ) || \ - defined(CONFIG_ENV_IS_IN_NAND ) || \ - defined(CONFIG_ENV_IS_IN_NVRAM ) || \ - defined(CONFIG_ENV_IS_IN_ONENAND ) || \ - defined(CONFIG_ENV_IS_IN_SPI_FLASH ) || \ - defined(CONFIG_ENV_IS_IN_REMOTE ) || \ - defined(CONFIG_ENV_IS_IN_UBI ) - -#define ENV_IS_IN_DEVICE - -#endif - -#if !defined(ENV_IS_IN_DEVICE ) && \ - !defined(CONFIG_ENV_IS_NOWHERE ) -# error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\ -NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE -#endif -/* * Maximum expected input data size for import command */
@@ -596,7 +574,7 @@ static int do_env_edit(struct cmd_tbl *cmdtp, int flag, int argc, }#endif /* CONFIG_CMD_EDITENV */ -#if defined(CONFIG_CMD_SAVEENV ) && defined(ENV_IS_IN_DEVICE ) +#if defined(CONFIG_CMD_SAVEENV ) && !IS_ENABLED (CONFIG_ENV_IS_DEFAULT )static int do_env_save (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) {
@@ -1108,7 +1086,7 @@ static int do_env_info(struct cmd_tbl *cmdtp, int flag,int eval_flags =0 ;int eval_results =0 ;bool quiet = false; -#if defined(CONFIG_CMD_SAVEENV ) && defined(ENV_IS_IN_DEVICE ) +#if defined(CONFIG_CMD_SAVEENV ) && !IS_ENABLED (CONFIG_ENV_IS_DEFAULT )enum env_location loc;#endif
@@ -1151,7 +1129,7 @@ static int do_env_info(struct cmd_tbl *cmdtp, int flag,/* evaluate whether environment can be persisted */ if (eval_flags &ENV_INFO_IS_PERSISTED ) { -#if defined(CONFIG_CMD_SAVEENV ) && defined(ENV_IS_IN_DEVICE ) +#if defined(CONFIG_CMD_SAVEENV ) && !IS_ENABLED (CONFIG_ENV_IS_DEFAULT ) loc =env_get_location (ENVOP_SAVE , gd->env_load_prio);if (ENVL_NOWHERE != loc &&ENVL_UNKNOWN != loc) {if (!quiet)
@@ -1232,7 +1210,7 @@ static struct cmd_tbl cmd_env_sub[] = {#if defined(CONFIG_CMD_RUN ) U_BOOT_CMD_MKENT(run, CONFIG_SYS_MAXARGS, 1, do_run, "", ""),#endif -#if defined(CONFIG_CMD_SAVEENV ) && defined(ENV_IS_IN_DEVICE ) +#if defined(CONFIG_CMD_SAVEENV ) && !IS_ENABLED (CONFIG_ENV_IS_DEFAULT ) U_BOOT_CMD_MKENT(save, 1, 0, do_env_save, "", ""),#if defined(CONFIG_CMD_ERASEENV ) U_BOOT_CMD_MKENT(erase, 1, 0, do_env_erase, "", ""),
@@ -1323,7 +1301,7 @@ static char env_help_text[] =#if defined(CONFIG_CMD_RUN ) "env run var [...] - run commands in an environment variable\n"#endif -#if defined(CONFIG_CMD_SAVEENV ) && defined(ENV_IS_IN_DEVICE ) +#if defined(CONFIG_CMD_SAVEENV ) && !IS_ENABLED (CONFIG_ENV_IS_DEFAULT ) "env save - save environment\n"#if defined(CONFIG_CMD_ERASEENV )"env erase - erase environment\n"
env/Kconfig +10 -7
@@ -55,20 +55,23 @@ config ENV_MAX_ENTRIES be generous and should work in most cases. This setting can be used to tune behaviour; see lib/hashtable.c for details. -config ENV_IS_NOWHERE - bool "Environment is not stored" - default y if !ENV_IS_IN_EEPROM && !ENV_IS_IN_EXT4 && \ +config ENV_IS_DEFAULT + def_bool y if !ENV_IS_IN_EEPROM && !ENV_IS_IN_EXT4 && \ !ENV_IS_IN_FAT && !ENV_IS_IN_FLASH && \ !ENV_IS_IN_MMC && !ENV_IS_IN_NAND && \ !ENV_IS_IN_NVRAM && !ENV_IS_IN_ONENAND && \ !ENV_IS_IN_REMOTE && !ENV_IS_IN_SPI_FLASH && \ !ENV_IS_IN_UBI + select ENV_IS_NOWHERE + +config ENV_IS_NOWHERE + bool "Environment is not stored" help - Define this if you don't want to or can't have an environment stored + Define this if you don't care whether or not an environment is stored on a storage medium. In this case the environment will still exist - while U-Boot is running, but once U-Boot exits it will not be - stored. U-Boot will therefore always start up with a default - environment. + while U-Boot is running, but once U-Boot exits it may not be + stored. If no other ENV_IS_IN_ is defined, U-Boot will always start + up with the default environment. config ENV_IS_IN_EEPROM bool "Environment in EEPROM"
Signature · 1 line
2.34.1
Re: [PATCH v3 02/23] cmd: nvedit: remove error check, handle with Kconfig
Quoted 6 lines · Troy Kisky
Avoid error messages when SPL,TPL,VPL build don't have the environment options of the main build. This is needed when
defined(CONFIG_ENV_IS_IN_xxx)is changed toCONFIG_IS_ENABLED(ENV_IS_IN_xxx).Signed-off-by Troy Kisky <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH v3 3/23 lib: crc32: prepare for CONFIG_IS_ENABLED changes
In reply to Troy KiskyWe need to include <linux/kconfig.h> in order to include files that use CONFIG_IS_ENABLED. TO prepare for that be more direct with using defined(USE_HOSTCC).
---
(no changes since v2)
Changes in v2:
- delay include of linux/kconfig.h to do from Makefile
- as suggested by Simon
lib/crc32.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
lib/crc32.c +7 -4
@@ -14,11 +14,14 @@#else #include <common.h> #include <efi_loader.h> +#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#define PET_WDG +#endif #endif #include <compiler.h> #include <u-boot/crc.h> -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#ifdef PET_WDG #include <watchdog.h> #endif #include "u-boot/zlib.h"
@@ -84,7 +87,7 @@ static void __efi_runtime make_crc_table(void) } crc_table_empty =0 ; } -#elif !defined(CONFIG_ARM64_CRC32) +#elif !defined(CONFIG_ARM64_CRC32) || defined(USE_HOSTCC)/* ======================================================================== * Table of CRC-32's of all single-byte values (made by make_crc_table) */
@@ -184,7 +187,7 @@ const uint32_t * ZEXPORT get_crc_table()*/ uint32_t __efi_runtime crc32_no_comp(uint32_t crc, const Bytef *buf, uInt len) { -#ifdef CONFIG_ARM64_CRC32 +#if defined(CONFIG_ARM64_CRC32 ) && !defined(USE_HOSTCC ) crc =cpu_to_le32 (crc);while (len--) crc =__builtin_aarch64_crc32b (crc, *buf++);
@@ -243,7 +246,7 @@ uint32_t __efi_runtime crc32(uint32_t crc, const Bytef *p, uInt len)uint32_t crc32_wd (uint32_t crc,const unsigned char *buf,uInt len,uInt chunk_sz) { -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#ifdef PET_WDG const unsigned char *end, *curr;int chunk;
Signature · 1 line
2.34.1
Re: [PATCH v3 03/23] lib: crc32: prepare for CONFIG_IS_ENABLED changes
Quoted 8 lines · Troy Kisky
We need to include <
linux/kconfig.h> in order to include files that useCONFIG_IS_ENABLED. TO prepare for that be more direct with usingdefined(USE_HOSTCC).Signed-off-by Troy Kisky <[email protected]>Reviewed-by Simon Glass <[email protected]>---
Quoted 8 lines
(no changes since v2)
Changes in v2:
- delay include oflinux/kconfig.hto do fromMakefile
- as suggested by Simonlib/crc32.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
We end up with two problems with this (and all of the similar patches) which is first, evb-ast2600 stops petting the watchdog in SPL, and then the CONFIG_IS_ENABLED macros in host tools makes clang very unhappy. I'm also not sure that introducing PET_WDT makes the code clearer than it was before.
Signature · 1 line
Tom
PATCH v3 4/23 lib: md5: prepare for CONFIG_IS_ENABLED changes
In reply to Troy KiskyWe need to include <linux/kconfig.h> in order to include files that use CONFIG_IS_ENABLED. TO prepare for that don't pet the watchdog when USE_HOSTCC is defined.
---
(no changes since v2)
Changes in v2:
- delay include of linux/kconfig.h to do from Makefile
- as suggested by Simon
lib/md5.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/md5.c +5 -2
@@ -29,7 +29,10 @@#ifndef USE_HOSTCC #include <common.h> +#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG )#include <watchdog.h> +#define PET_WDG +#endif #endif /* USE_HOSTCC */ #include <u-boot/md5.h>
@@ -288,14 +291,14 @@ md5_wd(const unsigned char *input, unsigned int len, unsigned char output[16], unsigned int chunk_sz) {struct MD5Context context; -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#ifdef PET_WDG const unsigned char *end, *curr;int chunk;#endif MD5Init (&context); -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#ifdef PET_WDG curr = input; end = input + len;while (curr < end) {
Signature · 1 line
2.34.1
PATCH v3 5/23 lib: sha1: prepare for CONFIG_IS_ENABLED changes
In reply to Troy KiskyWe need to include <linux/kconfig.h> in order to include files that use CONFIG_IS_ENABLED. TO prepare for that don't pet the watchdog when USE_HOSTCC is defined.
---
(no changes since v2)
Changes in v2:
- delay include of linux/kconfig.h to do from Makefile
- as suggested by Simon
lib/sha1.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/sha1.c +5 -2
@@ -19,6 +19,9 @@#ifndef USE_HOSTCC #include <common.h> #include <linux/string.h> +#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#define PET_WDG +#endif #else #include <string.h> #endif /* USE_HOSTCC */
@@ -328,14 +331,14 @@ void sha1_csum_wd(const unsigned char *input, unsigned int ilen, unsigned char *output, unsigned int chunk_sz) {sha1_context ctx; -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#ifdef PET_WDG const unsigned char *end, *curr;int chunk;#endif sha1_starts (&ctx); -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#ifdef PET_WDG curr = input; end = input + ilen;while (curr < end) {
Signature · 1 line
2.34.1
PATCH v3 6/23 lib: sha256: prepare for CONFIG_IS_ENABLED changes
In reply to Troy KiskyWe need to include <linux/kconfig.h> in order to include files that use CONFIG_IS_ENABLED. TO prepare for that don't pet the watchdog when USE_HOSTCC is defined.
---
(no changes since v2)
Changes in v2:
- delay include of linux/kconfig.h to do from Makefile
- as suggested by Simon
lib/sha256.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/sha256.c +5 -2
@@ -8,6 +8,9 @@#ifndef USE_HOSTCC #include <common.h> #include <linux/string.h> +#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#define PET_WDG +#endif #else #include <string.h> #endif /* USE_HOSTCC */
@@ -276,7 +279,7 @@ void sha256_csum_wd(const unsigned char *input, unsigned int ilen, unsigned char *output, unsigned int chunk_sz) {sha256_context ctx; -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#ifdef PET_WDG const unsigned char *end;unsigned char *curr;int chunk;
@@ -284,7 +287,7 @@ void sha256_csum_wd(const unsigned char *input, unsigned int ilen,sha256_starts (&ctx); -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#ifdef PET_WDG curr = (unsigned char *)input; end = input + ilen;while (curr < end) {
Signature · 1 line
2.34.1
PATCH v3 7/23 lib: sha512: prepare for CONFIG_IS_ENABLED changes
In reply to Troy KiskyWe need to include <linux/kconfig.h> in order to include files that use CONFIG_IS_ENABLED. TO prepare for that don't pet the watchdog when USE_HOSTCC is defined.
---
(no changes since v2)
Changes in v2:
- delay include of linux/kconfig.h to do from Makefile
- as suggested by Simon
lib/sha512.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
lib/sha512.c +7 -4
@@ -13,6 +13,9 @@#ifndef USE_HOSTCC #include <common.h> #include <linux/string.h> +#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#define PET_WDG +#endif #else #include <string.h> #endif /* USE_HOSTCC */
@@ -292,7 +295,7 @@ void sha384_csum_wd(const unsigned char *input, unsigned int ilen, unsigned char *output, unsigned int chunk_sz) {sha512_context ctx; -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#ifdef PET_WDG const unsigned char *end;unsigned char *curr;int chunk;
@@ -300,7 +303,7 @@ void sha384_csum_wd(const unsigned char *input, unsigned int ilen,sha384_starts (&ctx); -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#ifdef PET_WDG curr = (unsigned char *)input; end = input + ilen;while (curr < end) {
@@ -355,7 +358,7 @@ void sha512_csum_wd(const unsigned char *input, unsigned int ilen, unsigned char *output, unsigned int chunk_sz) {sha512_context ctx; -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#ifdef PET_WDG const unsigned char *end;unsigned char *curr;int chunk;
@@ -363,7 +366,7 @@ void sha512_csum_wd(const unsigned char *input, unsigned int ilen,sha512_starts (&ctx); -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#ifdef PET_WDG curr = (unsigned char *)input; end = input + ilen;while (curr < end) {
Signature · 1 line
2.34.1
PATCH v3 8/23 watchdog: add and use Kconfig HAS_WATCHDOG_RUNNING
In reply to Troy Kiskydefined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) is a common pattern. Create an new config symbol HAS_WATCHDOG_RUNNING to express it.
---
Changes in v3:
new patch to address Tom's concerns
arch/arm/mach-omap2/boot-common.c | 5 ++--- arch/m68k/lib/time.c | 7 +++---- arch/powerpc/lib/interrupts.c | 5 ++--- arch/powerpc/lib/ticks.S | 2 +- board/astro/mcf5373l/fpga.c | 10 ++++------ boot/image-board.c | 2 +- cmd/ximg.c | 10 ++++------ common/board_f.c | 4 ++-- common/spl/Kconfig | 4 ++++ drivers/crypto/aspeed/aspeed_hace.c | 2 +- drivers/crypto/hash/hash_sw.c | 2 +- drivers/timer/mpc83xx_timer.c | 5 ++--- drivers/watchdog/Kconfig | 3 +++ fs/cramfs/uncompress.c | 9 ++++----- include/watchdog.h | 7 ++----- lib/bzip2/bzlib.c | 5 ++--- lib/bzip2/bzlib_decompress.c | 20 ++++++++------------ lib/crc32.c | 2 +- lib/md5.c | 2 +- lib/sha1.c | 2 +- lib/sha256.c | 2 +- lib/sha512.c | 2 +- 22 files changed, 51 insertions(+), 61 deletions(-)
arch/arm/mach-omap2/boot-common.c +2 -3
@@ -302,9 +302,8 @@ void spl_board_init(void)#if defined(CONFIG_AM33XX ) && defined(CONFIG_SPL_MUSB_NEW )arch_misc_init ();#endif -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) -hw_watchdog_init (); -#endif +if (CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )) +hw_watchdog_init ();#ifdef CONFIG_AM33XX am33xx_spl_board_init ();#endif
arch/m68k/lib/time.c +3 -4
@@ -70,11 +70,10 @@ void dtimer_interrupt(void *not_used) timerp->ter = (DTIM_DTER_CAP |DTIM_DTER_REF ); timestamp++; -#if defined(CONFIG_WATCHDOG ) || defined (CONFIG_HW_WATCHDOG ) -if (CFG_SYS_WATCHDOG_FREQ && (timestamp % (CFG_SYS_WATCHDOG_FREQ )) ==0 ) { +if (CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING ) && +CFG_SYS_WATCHDOG_FREQ && + !(timestamp %CFG_SYS_WATCHDOG_FREQ ))schedule (); - } -#endif /* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */ return ; } }
arch/powerpc/lib/interrupts.c +2 -3
@@ -79,10 +79,9 @@ void timer_interrupt(struct pt_regs *regs) timestamp++; -#if defined(CONFIG_WATCHDOG ) || defined (CONFIG_HW_WATCHDOG ) -if (CFG_SYS_WATCHDOG_FREQ && (timestamp % (CFG_SYS_WATCHDOG_FREQ )) ==0 ) +if (CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING ) && +CFG_SYS_WATCHDOG_FREQ && !(timestamp %CFG_SYS_WATCHDOG_FREQ ))schedule (); -#endif /* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */ #ifdef CONFIG_LED_STATUS status_led_tick (timestamp);
arch/powerpc/lib/ticks.S +1 -1
@@ -41,7 +41,7 @@ wait_ticks: addc r14, r4, r14 /* Compute end time lower */ addze r15, r3 /* and end time upper */ -#if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG) +#if CONFIG_IS_ENABLED(HAS_WATCHDOG_RUNNING) bl schedule /* Trigger watchdog, if needed */ #endif 1: bl get_ticks /* Get current time */
board/astro/mcf5373l/fpga.c +4 -6
@@ -122,9 +122,8 @@ int altera_write_fn(const void *buf, size_t len, int flush, int cookie) }while (i >0 );if (bytecount % len_40 ==0 ) { -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) -schedule (); -#endif +if (CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )) +schedule ();#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK putc ('.' );/* let them know we are alive */ #endif
@@ -342,9 +341,8 @@ int xilinx_fastwr_config_fn(void *buf, size_t len, int flush, int cookie) val <<=1 ; }if (bytecount % len_40 ==0 ) { -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) -schedule (); -#endif +if (CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )) +schedule ();#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK putc ('.' );/* let them know we are alive */ #endif
boot/image-board.c +1 -1
@@ -173,7 +173,7 @@ void memmove_wd(void *to, void *from, size_t len, ulong chunksz)if (to == from)return ; -if (IS_ENABLED (CONFIG_HW_WATCHDOG ) ||IS_ENABLED (CONFIG_WATCHDOG )) { +if (CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )) {if (to > from) { from += len; to += len;
cmd/ximg.c +4 -6
@@ -186,8 +186,7 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])if (argc >3 ) {switch (comp) {case IH_COMP_NONE : -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) - { +if (CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )) {size_t l = len;size_t tail;void *to = (void *) dest;
@@ -203,11 +202,10 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) from += tail; l -= tail; } + }else { +printf (" Loading part %d ... " , part); +memmove ((char *)dest, (char *)data, len); } -#else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */ -printf (" Loading part %d ... " , part); -memmove ((char *) dest, (char *)data, len); -#endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */ break ;#ifdef CONFIG_GZIP case IH_COMP_GZIP :
common/board_f.c +2 -2
@@ -84,7 +84,7 @@ __weak void blue_led_off(void) {}* a structure... */ -#if defined(CONFIG_WATCHDOG ) || defined(CONFIG_HW_WATCHDOG ) +#if CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )static int init_func_watchdog_init (void ) { # if defined(CONFIG_HW_WATCHDOG) && \
@@ -106,7 +106,7 @@ int init_func_watchdog_reset(void) return 0; } -#endif /* CONFIG_WATCHDOG */ +#endif /* HAS_WATCHDOG_RUNNING */ __weak void board_add_ram_info (int use_default) {
common/spl/Kconfig +4 -0
@@ -1444,6 +1444,10 @@ config SPL_WATCHDOG detects no activity for a while (such as a software crash). This enables the drivers in drivers/watchdog as part of an SPL build. +config SPL_HAS_WATCHDOG_RUNNING + def_bool y if SPL_WATCHDOG || HW_WATCHDOG + depends on HAS_WATCHDOG_RUNNING + config SPL_YMODEM_SUPPORT bool "Support loading using Ymodem" depends on SPL_SERIAL
drivers/crypto/aspeed/aspeed_hace.c +1 -1
@@ -288,7 +288,7 @@ static int aspeed_hace_digest_wd(struct udevice *dev, enum HASH_ALGO algo,if (rc)return rc; -if (IS_ENABLED (CONFIG_HW_WATCHDOG ) ||CONFIG_IS_ENABLED (WATCHDOG )) { +if (CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )) { cur = ibuf; end = ibuf + ilen;
drivers/crypto/hash/hash_sw.c +1 -1
@@ -244,7 +244,7 @@ static int sw_hash_digest_wd(struct udevice *dev, enum HASH_ALGO algo,if (rc)return rc; -if (IS_ENABLED (CONFIG_HW_WATCHDOG ) ||CONFIG_IS_ENABLED (WATCHDOG )) { +if (CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )) { cur = ibuf; end = ibuf + ilen;
drivers/timer/mpc83xx_timer.c +2 -3
@@ -174,10 +174,9 @@ void timer_interrupt(struct pt_regs *regs) priv->timestamp++; -#if defined(CONFIG_WATCHDOG ) || defined(CONFIG_HW_WATCHDOG ) -if (CFG_SYS_WATCHDOG_FREQ && (priv->timestamp % (CFG_SYS_WATCHDOG_FREQ )) ==0 ) +if (CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING ) && +CFG_SYS_WATCHDOG_FREQ && !(priv->timestamp %CFG_SYS_WATCHDOG_FREQ ))schedule (); -#endif /* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */ #ifdef CONFIG_LED_STATUS status_led_tick (priv->timestamp);
drivers/watchdog/Kconfig +3 -0
@@ -35,6 +35,9 @@ config WATCHDOG_TIMEOUT_MSECS help Watchdog timeout in msec +config HAS_WATCHDOG_RUNNING + def_bool y if WATCHDOG || HW_WATCHDOG + config HW_WATCHDOG bool
fs/cramfs/uncompress.c +4 -5
@@ -62,11 +62,10 @@ int cramfs_uncompress_init (void) stream.next_in =0 ; stream.avail_in =0 ; -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) - stream.outcb = (cb_func )cyclic_run; -#else - stream.outcb =Z_NULL ; -#endif /* CONFIG_HW_WATCHDOG */ +if (CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )) + stream.outcb = (cb_func )cyclic_run; +else + stream.outcb =Z_NULL ; err =inflateInit (&stream);if (err !=Z_OK ) {
include/watchdog.h +2 -5
@@ -20,7 +20,7 @@*/ int init_func_watchdog_reset (void ); -#if defined(CONFIG_WATCHDOG ) || defined(CONFIG_HW_WATCHDOG ) +#if CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )#define INIT_FUNC_WATCHDOG_INIT init_func_watchdog_init,#define INIT_FUNC_WATCHDOG_RESET init_func_watchdog_reset,#else
@@ -35,10 +35,7 @@ int init_func_watchdog_reset(void);/* * Prototypes from $(CPU)/cpu.c. */ - -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) -void hw_watchdog_init (void ); -#endif +void hw_watchdog_init (void );#if defined(CONFIG_MPC85xx)void init_85xx_watchdog (void );
lib/bzip2/bzlib.c +2 -3
@@ -843,9 +843,8 @@ int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )if (s->strm != strm)return BZ_PARAM_ERROR ;while (True) { -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) -schedule (); -#endif +if (CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )) +schedule ();if (s->state ==BZ_X_IDLE )return BZ_SEQUENCE_ERROR ;if (s->state ==BZ_X_OUTPUT ) {if (s->smallDecompress)
lib/bzip2/bzlib_decompress.c +8 -12
@@ -417,9 +417,8 @@ Int32 BZ2_decompress ( DState* s )while (True) { -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) -schedule (); -#endif +if (CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )) +schedule ();if (nextSym ==EOB )break ;if (nextSym ==BZ_RUNA || nextSym ==BZ_RUNB ) {
@@ -502,9 +501,8 @@ Int32 BZ2_decompress ( DState* s )if (s->mtfbase[0 ] ==0 ) { kk =MTFA_SIZE -1 ;for (ii =256 /MTFL_SIZE -1 ; ii >=0 ; ii--) { -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) -schedule (); -#endif +if (CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )) +schedule ();for (jj =MTFL_SIZE -1 ; jj >=0 ; jj--) { s->mtfa[kk] = s->mtfa[s->mtfbase[ii] + jj]; kk--;
@@ -567,9 +565,8 @@ Int32 BZ2_decompress ( DState* s ) }while (i != s->origPtr); -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) -schedule (); -#endif +if (CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )) +schedule (); s->tPos = s->origPtr; s->nblock_used =0 ;if (s->blockRandomised) {
@@ -582,9 +579,8 @@ Int32 BZ2_decompress ( DState* s ) }else { -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) -schedule (); -#endif +if (CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )) +schedule ();/*-- compute the T^(-1) vector --*/ for (i =0 ; i < nblock; i++) { uc = (UChar)(s->tt[i] &0xff );
lib/crc32.c +1 -1
@@ -14,7 +14,7 @@#else #include <common.h> #include <efi_loader.h> -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#if CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )#define PET_WDG #endif #endif
lib/md5.c +1 -1
@@ -29,7 +29,7 @@#ifndef USE_HOSTCC #include <common.h> -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#if CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )#include <watchdog.h> #define PET_WDG #endif
lib/sha1.c +1 -1
@@ -19,7 +19,7 @@#ifndef USE_HOSTCC #include <common.h> #include <linux/string.h> -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#if CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )#define PET_WDG #endif #else
lib/sha256.c +1 -1
@@ -8,7 +8,7 @@#ifndef USE_HOSTCC #include <common.h> #include <linux/string.h> -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#if CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )#define PET_WDG #endif #else
lib/sha512.c +1 -1
@@ -13,7 +13,7 @@#ifndef USE_HOSTCC #include <common.h> #include <linux/string.h> -#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +#if CONFIG_IS_ENABLED (HAS_WATCHDOG_RUNNING )#define PET_WDG #endif #else
Signature · 1 line
2.34.1
PATCH v3 9/23 tools: prevent CONFIG_IS_ENABLED errors by including linux/kconfig.h
In reply to Troy KiskyWe need to include <linux/kconfig.h> in order to include files that use CONFIG_IS_ENABLED.
---
(no changes since v2)
Changes in v2:
- include linux/kconfig.h from tools/Makefile
- as suggested by Simon
tools/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/Makefile +1 -0
@@ -298,6 +298,7 @@ endif # !LOGO_BMP # Define _GNU_SOURCE to obtain the getline prototype from stdio.h # HOST_EXTRACFLAGS += -include $(srctree)/include/compiler.h \ + -include $(srctree)/include/linux/kconfig.h \ $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \ -I$(srctree)/scripts/dtc/libfdt \ -I$(srctree)/tools \
Signature · 1 line
2.34.1
PATCH v3 10/23 tools: Makefile: prepare for CONFIG_IS_ENABLED changes by adding CONFIG_TOOLS_xxx
In reply to Troy KiskyCONFIG_IS_ENABLED(FIT_SIGNATURE) will check for CONFIG_TOOLS_FIT_SIGNATURE. So define it now in preparation.
---
(no changes since v1)
tools/Makefile | 2 ++ 1 file changed, 2 insertions(+)
tools/Makefile +2 -0
@@ -162,8 +162,10 @@ ifdef CONFIG_TOOLS_LIBCRYPTO # This affects include/image.h, but including the board config file # is tricky, so manually define this options here. HOST_EXTRACFLAGS += -DCONFIG_FIT_SIGNATURE +HOST_EXTRACFLAGS += -DCONFIG_TOOLS_FIT_SIGNATURE=1 HOST_EXTRACFLAGS += -DCONFIG_FIT_SIGNATURE_MAX_SIZE=0xffffffff HOST_EXTRACFLAGS += -DCONFIG_FIT_CIPHER +HOST_EXTRACFLAGS += -DCONFIG_TOOLS_FIT_CIPHER=1 endif # MXSImage needs LibSSL
Signature · 1 line
2.34.1
PATCH v3 11/23 x86: cpu: qemu: qemu: remove SPL use with CONFIG_IS_ENABLED
In reply to Troy KiskyCONFIG_IS_ENABLED(SPL_X86_32BIT_INIT)
would check for CONFIG_SPL_SPL_X86_32BIT_INIT for SPL builds
---
(no changes since v1)
arch/x86/cpu/qemu/qemu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/cpu/qemu/qemu.c +1 -1
@@ -97,7 +97,7 @@ static void qemu_chipset_init(void) } } -#if !CONFIG_IS_ENABLED (SPL_X86_32BIT_INIT ) +#if CONFIG_IS_ENABLED (X86_32BIT_INIT )int arch_cpu_init (void ) {post_code (POST_CPU_INIT );
Signature · 1 line
2.34.1
Re: [PATCH v3 11/23] x86: cpu: qemu: qemu: remove SPL use with CONFIG_IS_ENABLED
Quoted 5 lines · Troy Kisky
CONFIG_IS_ENABLED(SPL_X86_32BIT_INIT)
would check forCONFIG_SPL_SPL_X86_32BIT_INITfor SPL buildsSigned-off-by Troy Kisky <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH v3 12/23 config_distro_bootcmd: remove booting environment variables from SPL environment
In reply to Troy KiskySPL environments don't need commands that they can never use. Avoid errors with CONFIG_IS_ENABLED conversions by skipping them now.
---
(no changes since v1)
include/config_distro_bootcmd.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
include/config_distro_bootcmd.h +23 -0
@@ -35,11 +35,15 @@#devtypel "_boot=" \ BOOTENV_SHARED_BLKDEV_BODY(devtypel) +#define BOOTENV_DEV_BLKDEV_NONE (devtypeu, devtypel, instance) +#define BOOTENV_DEV_BLKDEV (devtypeu, devtypel, instance) \ "bootcmd_" #devtypel #instance "=" \ "devnum=" #instance "; " \ "run " #devtypel "_boot\0" +#define BOOTENV_DEV_NAME_BLKDEV_NONE (devtypeu, devtypel, instance) +#define BOOTENV_DEV_NAME_BLKDEV (devtypeu, devtypel, instance) \ #devtypel #instance " "
@@ -59,6 +63,10 @@#define BOOTENV_SHARED_MMC BOOTENV_SHARED_BLKDEV(mmc)#define BOOTENV_DEV_MMC BOOTENV_DEV_BLKDEV#define BOOTENV_DEV_NAME_MMC BOOTENV_DEV_NAME_BLKDEV +#elif defined(CONFIG_SPL_BUILD ) +#define BOOTENV_SHARED_MMC +#define BOOTENV_DEV_MMC BOOTENV_DEV_BLKDEV_NONE +#define BOOTENV_DEV_NAME_MMC BOOTENV_DEV_NAME_BLKDEV_NONE#else #define BOOTENV_SHARED_MMC #define BOOTENV_DEV_MMC \
@@ -190,6 +198,10 @@#define BOOTENV_SHARED_SATA BOOTENV_SHARED_BLKDEV(sata)#define BOOTENV_DEV_SATA BOOTENV_DEV_BLKDEV#define BOOTENV_DEV_NAME_SATA BOOTENV_DEV_NAME_BLKDEV +#elif defined(CONFIG_SPL_BUILD ) +#define BOOTENV_SHARED_SATA +#define BOOTENV_DEV_SATA BOOTENV_DEV_BLKDEV_NONE +#define BOOTENV_DEV_NAME_SATA BOOTENV_DEV_NAME_BLKDEV_NONE#else #define BOOTENV_SHARED_SATA #define BOOTENV_DEV_SATA \
@@ -293,6 +305,11 @@ BOOTENV_SHARED_BLKDEV_BODY(usb)#define BOOTENV_DEV_USB BOOTENV_DEV_BLKDEV#define BOOTENV_DEV_NAME_USB BOOTENV_DEV_NAME_BLKDEV +#elif defined(CONFIG_SPL_BUILD ) +#define BOOTENV_RUN_NET_USB_START +#define BOOTENV_SHARED_USB +#define BOOTENV_DEV_USB BOOTENV_DEV_BLKDEV_NONE +#define BOOTENV_DEV_NAME_USB BOOTENV_DEV_NAME_BLKDEV_NONE#else #define BOOTENV_RUN_NET_USB_START #define BOOTENV_SHARED_USB
@@ -395,6 +412,9 @@ "\0"#define BOOTENV_DEV_NAME_DHCP (devtypeu, devtypel, instance) \ "dhcp " +#elif defined(CONFIG_SPL_BUILD ) +#define BOOTENV_DEV_DHCP BOOTENV_DEV_BLKDEV_NONE +#define BOOTENV_DEV_NAME_DHCP BOOTENV_DEV_NAME_BLKDEV_NONE#else #define BOOTENV_DEV_DHCP \ BOOT_TARGET_DEVICES_references_DHCP_without_CONFIG_CMD_DHCP
@@ -413,6 +433,9 @@ "fi\0"#define BOOTENV_DEV_NAME_PXE (devtypeu, devtypel, instance) \ "pxe " +#elif defined(CONFIG_SPL_BUILD ) +#define BOOTENV_DEV_PXE BOOTENV_DEV_BLKDEV_NONE +#define BOOTENV_DEV_NAME_PXE BOOTENV_DEV_NAME_BLKDEV_NONE#else #define BOOTENV_DEV_PXE \ BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE
Signature · 1 line
2.34.1
Re: [PATCH v3 12/23] config_distro_bootcmd: remove booting environment variables from SPL environment
Quoted 5 lines · Troy Kisky
SPL environments don't need commands that they can never use. Avoid errors with
CONFIG_IS_ENABLEDconversions by skipping them now.Signed-off-by Troy Kisky <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH v3 13/23 ofnode: fdt_support definitions needed if OF_CONTROL is enabled
In reply to Troy KiskyWith the use of CONFIG_IS_ENABLED in code, instead of at the preprocessor level, these defines are still needed if OF_CONTROL is enabled.
---
(no changes since v1)
include/fdt_support.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/fdt_support.h +2 -1
@@ -7,7 +7,8 @@#ifndef __FDT_SUPPORT_H#define __FDT_SUPPORT_H -#if defined(CONFIG_OF_LIBFDT ) && !defined(USE_HOSTCC ) +#if (defined(CONFIG_OF_LIBFDT ) || defined(CONFIG_OF_CONTROL )) && \ + !defined(USE_HOSTCC )#include <asm/u-boot.h> #include <linux/libfdt.h>
Signature · 1 line
2.34.1
Re: [PATCH v3 13/23] ofnode: fdt_support definitions needed if OF_CONTROL is enabled
Quoted 5 lines · Troy Kisky
With the use of
CONFIG_IS_ENABLEDin code, instead of at the preprocessor level, these defines are still needed ifOF_CONTROLis enabled.Signed-off-by Troy Kisky <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH v3 14/23 fdt_support: always define fdt_fixup_mtdparts
In reply to Troy KiskySPL code wants fdt_fixup_mtdparts defined as a NOP when the function isn't linked in.
Prepare for ifdef CONFIG_OF_LIBFDT being converted to
if CONFIG_IS_ENABLED(OF_LIBFDT)
---
(no changes since v1)
include/fdt_support.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
include/fdt_support.h +13 -10
@@ -245,16 +245,6 @@ int fdt_increase_size(void *fdt, int add_len);int fdt_delete_disabled_nodes (void *blob);struct node_info ; -#if defined(CONFIG_FDT_FIXUP_PARTITIONS ) -void fdt_fixup_mtdparts (void *fdt,const struct node_info *node_info, -int node_info_size); -#else -static inline void fdt_fixup_mtdparts (void *fdt, -const struct node_info *node_info, -int node_info_size) -{ -} -#endif void fdt_del_node_and_alias (void *blob,const char *alias);
@@ -412,6 +402,19 @@ int fdt_get_cells_len(const void *blob, char *nr_cells_name);#endif /* ifdef CONFIG_OF_LIBFDT */ +#if CONFIG_IS_ENABLED (OF_LIBFDT ) && defined(CONFIG_FDT_FIXUP_PARTITIONS ) +struct node_info ; +void fdt_fixup_mtdparts (void *fdt,const struct node_info *node_info, +int node_info_size); +#else +struct node_info ; +static inline void fdt_fixup_mtdparts (void *fdt, +const struct node_info *node_info, +int node_info_size) +{ +} +#endif +#ifdef USE_HOSTCC int fdtdec_get_int (const void *blob,int node,const char *prop_name,int default_val);
Signature · 1 line
2.34.1
Re: [PATCH v3 14/23] fdt_support: always define fdt_fixup_mtdparts
Quoted 6 lines · Troy Kisky
SPL code wants
fdt_fixup_mtdpartsdefined as a NOP when the function isn't linked in.Prepare for ifdef
CONFIG_OF_LIBFDTbeing converted to
ifCONFIG_IS_ENABLED(OF_LIBFDT)
Quoted 8 lines
Signed-off-by Troy Kisky <[email protected]>Reviewed-by Simon Glass <[email protected]>---
(no changes since v1)
include/fdt_support.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
As Francesco's thread discusses, this function needs to be removed, by and large, really is the answer.
Signature · 1 line
Tom
PATCH v3 15/23 m53menlo: define ft_board_setup only if CONFIG_IS_ENABLED(OF_LIBFDT)
In reply to Troy KiskyThe function ft_board_setup calls do_fixup_by_path_string which is only available on CONFIG_IS_ENABLED(OF_LIBFDT). This prepares for the conversion.
ft_board_setup is only called from image-fdt which is linked by obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += image-fdt.o
---
(no changes since v1)
board/menlo/m53menlo/m53menlo.c | 2 ++ 1 file changed, 2 insertions(+)
board/menlo/m53menlo/m53menlo.c +2 -0
@@ -264,6 +264,7 @@ void board_preboot_os(void)gpio_direction_output (IMX_GPIO_NR (6 ,0 ),0 ); } +#if CONFIG_IS_ENABLED (OF_LIBFDT )int ft_board_setup (void *blob,struct bd_info *bd) {if (lvds_compat_string)
@@ -272,6 +273,7 @@ int ft_board_setup(void *blob, struct bd_info *bd)return 0 ; } +#endif struct display_info_t const displays[] = { {
Signature · 1 line
2.34.1
Re: [PATCH v3 15/23] m53menlo: define ft_board_setup only if CONFIG_IS_ENABLED(OF_LIBFDT)
Quoted 9 lines · Troy Kisky
The function
ft_board_setupcallsdo_fixup_by_path_stringwhich is only available onCONFIG_IS_ENABLED(OF_LIBFDT). This prepares for the conversion.
ft_board_setupis only called from image-fdt which is linked by obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += image-fdt.oSigned-off-by Troy Kisky <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH v3 16/23 freescale: common: pfuze: define pfuze_mode_init only if defined(CONFIG_DM_PMIC)
In reply to Troy Kiskypfuze_mode_init calls pmic_reg_read which is only available from
obj-$(CONFIG_$(SPL_TPL_)DM_PMIC) += pmic-uclass.o
Prepare for conversion of defined(CONFIG_DM_PMIC) to CONFIG_IS_ENABLED(DM_PMIC).
---
(no changes since v1)
board/freescale/common/pfuze.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/freescale/common/pfuze.c +1 -1
@@ -91,7 +91,7 @@ struct pmic *pfuze_common_init(unsigned char i2cbus) return p; } -#else +#elif defined(CONFIG_DM_PMIC)int pfuze_mode_init (struct udevice *dev,u32 mode) {unsigned char offset, i, switch_num;
Signature · 1 line
2.34.1
Re: [PATCH v3 16/23] freescale: common: pfuze: define pfuze_mode_init only if defined(CONFIG_DM_PMIC)
Quoted 9 lines · Troy Kisky
pfuze_mode_initcallspmic_reg_readwhich is only available fromobj-$(CONFIG_$(SPL_TPL_)DM_PMIC) += pmic-uclass.o
Prepare for conversion of
defined(CONFIG_DM_PMIC)toCONFIG_IS_ENABLED(DM_PMIC).Signed-off-by Troy Kisky <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH v3 17/23 ns16550: match when to define bdf with uart code
In reply to Troy KiskyWhen switching defined(CONFIG_PCI) to CONFIG_IS_ENABLED(PCI) bdf is no longer accessible. So add preprocessor protection to avoid access.
---
(no changes since v2)
Changes in v2:
- changed condition of when to include field bdf
- added protection to another instance of bdf in uart.c
- Thanks to Simon for getting this corrected
arch/x86/cpu/apollolake/uart.c | 4 ++++ include/ns16550.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
arch/x86/cpu/apollolake/uart.c +4 -0
@@ -79,10 +79,12 @@ void apl_uart_init(pci_dev_t bdf, ulong base)static int apl_ns16550_probe (struct udevice *dev) { +#if IS_ENABLED_NOCHECK (CONFIG_PCI ) && defined(CONFIG_SPL_BUILD )struct apl_ns16550_plat *plat =dev_get_plat (dev);if (!CONFIG_IS_ENABLED (PCI ))apl_uart_init (plat->ns16550.bdf, plat->ns16550.base); +#endif return ns16550_serial_probe (dev); }
@@ -110,7 +112,9 @@ static int apl_ns16550_of_to_plat(struct udevice *dev) ns.reg_offset =0 ; ns.clock = dtplat->clock_frequency; ns.fcr =UART_FCR_DEFVAL ; +#if IS_ENABLED_NOCHECK (CONFIG_PCI ) && defined(CONFIG_SPL_BUILD ) ns.bdf =pci_ofplat_get_devfn (dtplat->reg[0 ]); +#endif memcpy (plat, &ns,sizeof (ns));#else int ret;
include/ns16550.h +1 -1
@@ -74,7 +74,7 @@ struct ns16550_plat {int clock;u32 fcr;int flags; -#if defined(CONFIG_PCI ) && defined(CONFIG_SPL ) +#if IS_ENABLED_NOCHECK (CONFIG_PCI ) && defined(CONFIG_SPL_BUILD )int bdf;#endif };
Signature · 1 line
2.34.1
Re: [PATCH v3 17/23] ns16550: match when to define bdf with uart code
Quoted 26 lines · Troy Kisky
When switching
defined(CONFIG_PCI)toCONFIG_IS_ENABLED(PCI)bdf is no longer accessible. So add preprocessor protection to avoid access.Signed-off-by Troy Kisky <[email protected]>Reviewed-by Simon Glass <[email protected]>---
(no changes since v2)
Changes in v2:
- changed condition of when to include field bdf
- added protection to another instance of bdf inuart.c
- Thanks to Simon for getting this correctedarch/x86/cpu/apollolake/uart.c | 4 ++++ include/ns16550.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)arch/x86/cpu/apollolake/uart.c +0
-0@@ -79,10 +79,12 @@ void apl_uart_init(pci_dev_t bdf, ulong base)static int apl_ns16550_probe (struct udevice *dev)
arch/x86/cpu/apollolake/uart.c void apl_uart_init(pci_dev_t bdf, ulong base) · line 90
Quoted 10 lines
arch/x86/cpu/apollolake/uart.c +2
-0{ +#if IS_ENABLED (CONFIG_PCI ) && defined(CONFIG_SPL_BUILD )struct apl_ns16550_plat *plat =dev_get_plat (dev);if (!CONFIG_IS_ENABLED (PCI ))apl_uart_init (plat->ns16550.bdf, plat->ns16550.base); +#endif return ns16550_serial_probe (dev); }
Looking at this again, this hunk here doesn't make sense. Reading outloud, "if we have CONFIG_PCI enabled and CONFIG_SPL_BUILD, declare plat to be .. and then if we do not have PCI enabled ...". I really don't know what the code is supposed to be doing here.
Signature · 1 line
Tom
Re: [PATCH v3 17/23] ns16550: match when to define bdf with uart code
Hi Tom,
Quoted 37 lines · Tom Rini
Quoted 34 lines · Troy Kisky
When switching
defined(CONFIG_PCI)toCONFIG_IS_ENABLED(PCI)bdf is no longer accessible. So add preprocessor protection to avoid access.Signed-off-by Troy Kisky <[email protected]>Reviewed-by Simon Glass <[email protected]>---
(no changes since v2)
Changes in v2:
- changed condition of when to include field bdf
- added protection to another instance of bdf inuart.c
- Thanks to Simon for getting this correctedarch/x86/cpu/apollolake/uart.c | 4 ++++ include/ns16550.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)arch/x86/cpu/apollolake/uart.c +2
-0@@ -79,10 +79,12 @@ void apl_uart_init(pci_dev_t bdf, ulong base)static int apl_ns16550_probe (struct udevice *dev) { +#if IS_ENABLED (CONFIG_PCI ) && defined(CONFIG_SPL_BUILD )struct apl_ns16550_plat *plat =dev_get_plat (dev);if (!CONFIG_IS_ENABLED (PCI ))apl_uart_init (plat->ns16550.bdf, plat->ns16550.base); +#endif
Quoted 7 lines
arch/x86/cpu/apollolake/uart.c void apl_uart_init(pci_dev_t bdf, ulong base) · line 90
Quoted 2 lines
arch/x86/cpu/apollolake/uart.c +0
-0return ns16550_serial_probe (dev); }Looking at this again, this hunk here doesn't make sense. Reading outloud, "if we have
CONFIG_PCIenabled andCONFIG_SPL_BUILD, declare plat to be .. and then if we do not have PCI enabled ...". I really don't know what the code is supposed to be doing here.
This is because the bdf member is only present in SPL when PCI is enabled.
Perhaps it could be CONFIG_SPL instead of CONFIG_SPL_BUILD ?
You can apply whatever makes it build if you like. I can look at it either tonight or when I get back.
Regards,
Simon
Re: [PATCH v3 17/23] ns16550: match when to define bdf with uart code
Quoted 48 lines · Simon Glass
Hi Tom,
Quoted 37 lines · Tom Rini
Quoted 34 lines · Troy Kisky
When switching
defined(CONFIG_PCI)toCONFIG_IS_ENABLED(PCI)bdf is no longer accessible. So add preprocessor protection to avoid access.Signed-off-by Troy Kisky <[email protected]>Reviewed-by Simon Glass <[email protected]>---
(no changes since v2)
Changes in v2:
- changed condition of when to include field bdf
- added protection to another instance of bdf inuart.c
- Thanks to Simon for getting this correctedarch/x86/cpu/apollolake/uart.c | 4 ++++ include/ns16550.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)arch/x86/cpu/apollolake/uart.c +2
-0@@ -79,10 +79,12 @@ void apl_uart_init(pci_dev_t bdf, ulong base)static int apl_ns16550_probe (struct udevice *dev) { +#if IS_ENABLED (CONFIG_PCI ) && defined(CONFIG_SPL_BUILD )struct apl_ns16550_plat *plat =dev_get_plat (dev);if (!CONFIG_IS_ENABLED (PCI ))apl_uart_init (plat->ns16550.bdf, plat->ns16550.base); +#endif Quoted 7 lines
arch/x86/cpu/apollolake/uart.c void apl_uart_init(pci_dev_t bdf, ulong base) · line 90
Quoted 2 lines
arch/x86/cpu/apollolake/uart.c +0
-0return ns16550_serial_probe (dev); }Looking at this again, this hunk here doesn't make sense. Reading outloud, "if we have
CONFIG_PCIenabled andCONFIG_SPL_BUILD, declare plat to be .. and then if we do not have PCI enabled ...". I really don't know what the code is supposed to be doing here.
Quoted 6 lines
This is because the bdf member is only present in SPL when PCI is enabled.
Perhaps it could be
CONFIG_SPLinstead ofCONFIG_SPL_BUILD?You can apply whatever makes it build if you like. I can look at it either tonight or when I get back.
Digging at this when you get back is fine since it still makes no sense to say "If PCI is enabled, when PCI is not enabled actually do something". There's no side-effects on "dev" from the call to dev_get_plat which is the only thing that happens, in this case.
Signature · 1 line
Tom
Troy Kisky
Reviewed-by Simon GlassRe: [PATCH v3 17/23] ns16550: match when to define bdf with uart code
Hi Tom,
You are looking at an old patch, here's the new.
commit c969bedb9cb6029360e6fe7e25a331680fabe3ee
Author: Troy Kisky <[email protected]> Date: Thu Feb 23 08:01:46 2023 -0800
ns16550: match when to define bdf with uart code
When switching defined(CONFIG_PCI) to CONFIG_IS_ENABLED(PCI) bdf is no longer accessible. So add preprocessor protection to avoid access.
Series-changes: 2
- changed condition of when to include field bdf
- added protection to another instance of bdf in uart.c
- Thanks to Simon for getting this corrected
arch/x86/cpu/apollolake/uart.c +4 -0
@@ -79,10 +79,12 @@ void apl_uart_init(pci_dev_t bdf, ulong base)static int apl_ns16550_probe (struct udevice *dev) { +#if IS_ENABLED_NOCHECK (CONFIG_PCI ) && defined(CONFIG_SPL_BUILD )struct apl_ns16550_plat *plat =dev_get_plat (dev);if (!CONFIG_IS_ENABLED (PCI ))apl_uart_init (plat->ns16550.bdf, plat->ns16550.base); +#endif return ns16550_serial_probe (dev); }
@@ -110,7 +112,9 @@ static int apl_ns16550_of_to_plat(struct udevice *dev) ns.reg_offset =0 ; ns.clock = dtplat->clock_frequency; ns.fcr =UART_FCR_DEFVAL ; +#if IS_ENABLED_NOCHECK (CONFIG_PCI ) && defined(CONFIG_SPL_BUILD ) ns.bdf =pci_ofplat_get_devfn (dtplat->reg[0 ]); +#endif memcpy (plat, &ns,sizeof (ns));#else int ret;
include/ns16550.h +1 -1
@@ -74,7 +74,7 @@ struct ns16550_plat {int clock;u32 fcr;int flags; -#if defined(CONFIG_PCI ) && defined(CONFIG_SPL ) +#if IS_ENABLED_NOCHECK (CONFIG_PCI ) && defined(CONFIG_SPL_BUILD )int bdf;#endif };
__________________________
It reads as,
If the bdf exists, then if spl var PCI is not enabled, then init uart.
The PCI code will handle it if PCI is enabled.
So, PCI needs to be enabled, and SPL_PCI needs to not be enabled, and currently building for SPL
Quoted 66 lines · Tom Rini
Quoted 21 lines · Simon Glass
Hi Tom,
Quoted 18 lines · Tom Rini
Quoted 15 lines · Troy Kisky
When switching
defined(CONFIG_PCI)toCONFIG_IS_ENABLED(PCI)bdf is no longer accessible. So add preprocessor protection to avoid access.Signed-off-by Troy Kisky <[email protected]>Reviewed-by Simon Glass <[email protected]>---
(no changes since v2)
Changes in v2:
- changed condition of when to include field bdf
- added protection to another instance of bdf inuart.c
- Thanks to Simon for getting this correctedQuoted 5 lines
Quoted 5 lines
Review
Quoted 5 lines
arch/x86/cpu/apollolake/uart.c | 4 ++++ include/ns16550.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/arch/x86/cpu/apollolake/uart.cQuoted 22 lines
Quoted 14 lines
Quoted 14 lines
index
a9362436000..878aa48ed76100644arch/x86/cpu/apollolake/uart.c +2
-0@@ -79,10 +79,12 @@ void apl_uart_init(pci_dev_t bdf, ulong base)static int apl_ns16550_probe (struct udevice *dev) { +#if IS_ENABLED (CONFIG_PCI ) && defined(CONFIG_SPL_BUILD )struct apl_ns16550_plat *plat =dev_get_plat (dev);if (!CONFIG_IS_ENABLED (PCI ))apl_uart_init (plat->ns16550.bdf, plat->ns16550.base); +#endif Quoted 7 lines
arch/x86/cpu/apollolake/uart.c void apl_uart_init(pci_dev_t bdf, ulong base) · line 90
Quoted 2 lines
arch/x86/cpu/apollolake/uart.c +0
-0return ns16550_serial_probe (dev); }Looking at this again, this hunk here doesn't make sense. Reading outloud, "if we have
CONFIG_PCIenabled andCONFIG_SPL_BUILD, declare plat to be .. and then if we do not have PCI enabled ...". I really don't know what the code is supposed to be doing here.Quoted 1 line
This is because the bdf member is only present in SPL when PCI is
enabled.
Quoted 5 lines
Perhaps it could be
CONFIG_SPLinstead ofCONFIG_SPL_BUILD?You can apply whatever makes it build if you like. I can look at it either tonight or when I get back.
Digging at this when you get back is fine since it still makes no sense to say "If PCI is enabled, when PCI is not enabled actually do something". There's no side-effects on "dev" from the call to
dev_get_platwhich is the only thing that happens, in this case.--
Tom
Re: [PATCH v3 17/23] ns16550: match when to define bdf with uart code
Quoted 3 lines · Troy Kisky
Hi Tom,
You are looking at an old patch, here's the new.
It was the new one, sorry, I just edited out NOCHECK at least for now.
Quoted 65 lines
commit
c969bedb9cb6029360e6fe7e25a331680fabe3eeAuthor: Troy Kisky <[email protected]> Date: Thu Feb 23 08:01:46 2023 -0800ns16550: match when to define bdf with uart code
When switching
defined(CONFIG_PCI)toCONFIG_IS_ENABLED(PCI)bdf is no longer accessible. So add preprocessor protection to avoid access.Series-changes: 2
- changed condition of when to include field bdf
- added protection to another instance of bdf inuart.c
- Thanks to Simon for getting this correctedSigned-off-by Troy Kisky <[email protected]>Reviewed-by Simon Glass <[email protected]>arch/x86/cpu/apollolake/uart.c +4
-0@@ -79,10 +79,12 @@ void apl_uart_init(pci_dev_t bdf, ulong base)static int apl_ns16550_probe (struct udevice *dev) { +#if IS_ENABLED_NOCHECK (CONFIG_PCI ) && defined(CONFIG_SPL_BUILD )struct apl_ns16550_plat *plat =dev_get_plat (dev);if (!CONFIG_IS_ENABLED (PCI ))apl_uart_init (plat->ns16550.bdf, plat->ns16550.base); +#endif return ns16550_serial_probe (dev); }@@ -110,7 +112,9 @@ static int apl_ns16550_of_to_plat(struct udevice *dev) ns.reg_offset =0 ; ns.clock = dtplat->clock_frequency; ns.fcr =UART_FCR_DEFVAL ; +#if IS_ENABLED_NOCHECK (CONFIG_PCI ) && defined(CONFIG_SPL_BUILD ) ns.bdf =pci_ofplat_get_devfn (dtplat->reg[0 ]); +#endif memcpy (plat, &ns,sizeof (ns));#else int ret;include/ns16550.h +1
-1@@ -74,7 +74,7 @@ struct ns16550_plat {int clock;u32 fcr;int flags; -#if defined(CONFIG_PCI ) && defined(CONFIG_SPL ) +#if IS_ENABLED_NOCHECK (CONFIG_PCI ) && defined(CONFIG_SPL_BUILD )int bdf;#endif };__________________________
It reads as,
If the bdf exists, then if spl var PCI is not enabled, then init uart.
Quoted 5 lines
The PCI code will handle it if PCI is enabled.
So, PCI needs to be enabled, and
SPL_PCIneeds to not be enabled, and currently building for SPL
So the case is CONFIG_PCI=y, CONFIG_SPL_PCI=n and CONFIG_SPL_BUILD=y? That's what the code needs to test and express clearly and likely with a comment.
Signature · 1 line
Tom
PATCH v3 18/23 solidrun: mx6cuboxi: use CONFIG_IS_ENABLED(SATA) instead of ifdef CONFIG_SATA
In reply to Troy KiskyPrepare for linking setup_sata only when CONFIG_SATA/CONFIG_SPL_SATA is defined.
---
Changes in v3:
- Rebase on Simon's s/CMD_SATA/SATA/ change
- commit message updated
Changes in v2:
- use normal if, not preprocessor
board/solidrun/mx6cuboxi/mx6cuboxi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
board/solidrun/mx6cuboxi/mx6cuboxi.c +2 -3
@@ -275,9 +275,8 @@ int board_early_init_f(void) {setup_iomux_uart (); -#ifdef CONFIG_SATA -setup_sata (); -#endif +if (CONFIG_IS_ENABLED (SATA )) +setup_sata ();setup_fec ();return 0 ;
Signature · 1 line
2.34.1
Re: [PATCH v3 18/23] solidrun: mx6cuboxi: use CONFIG_IS_ENABLED(SATA) instead of ifdef CONFIG_SATA
Quoted 5 lines · Troy Kisky
Prepare for linking
setup_sataonly when CONFIG_SATA/CONFIG_SPL_SATA is defined.Signed-off-by Troy Kisky <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH v3 19/23 wandboard: use CONFIG_IS_ENABLED(SATA) instead of ifdef CONFIG_SATA
In reply to Troy KiskyPrepare for linking setup_sata only when CONFIG_SATA/CONFIG_SPL_SATA is defined.
---
(no changes since v2)
Changes in v2:
- new in series
board/wandboard/wandboard.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
board/wandboard/wandboard.c +2 -3
@@ -352,9 +352,8 @@ static void setup_display(void)int board_early_init_f (void ) {setup_iomux_uart (); -#ifdef CONFIG_SATA -setup_sata (); -#endif +if (CONFIG_IS_ENABLED (SATA )) +setup_sata ();return 0 ; }
Signature · 1 line
2.34.1
Re: [PATCH v3 19/23] wandboard: use CONFIG_IS_ENABLED(SATA) instead of ifdef CONFIG_SATA
Quoted 4 lines · Troy Kisky
Prepare for linking
setup_sataonly when CONFIG_SATA/CONFIG_SPL_SATA is defined.Signed-off-by Troy Kisky <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH v3 20/23 arm: mach-imx: use CONFIG_$(SPL_)SATA instead of CONFIG_SATA
In reply to Troy KiskyThis avoid an error with enable_sata_clock when defined(CONFIG_SATA) is changed to CONFIG_IS_ENABLED(SATA).
---
(no changes since v1)
arch/arm/mach-imx/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/Makefile +1 -1
@@ -54,7 +54,7 @@ obj-$(CONFIG_IMX_RDC) += rdc-sema.o ifneq ($(CONFIG_SPL_BUILD),y) obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o endif -obj-$(CONFIG_SATA) += sata.o +obj-$(CONFIG_$(SPL_)SATA) += sata.o obj-$(CONFIG_IMX_HAB) += hab.o obj-$(CONFIG_SYSCOUNTER_TIMER) += syscounter.o endif
Signature · 1 line
2.34.1
Re: [PATCH v3 20/23] arm: mach-imx: use CONFIG_$(SPL_)SATA instead of CONFIG_SATA
Quoted 5 lines · Troy Kisky
This avoid an error with
enable_sata_clockwhendefined(CONFIG_SATA)is changed toCONFIG_IS_ENABLED(SATA).Signed-off-by Troy Kisky <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH v3 21/23 x86: cpu: i386: cpu: only set pci_ram_top if CONFIG_IS_ENABLED(PCI)
In reply to Troy KiskyThis avoids an error when ifdef CONFIG_PCI is changed to if CONFIG_IS_ENABLED(PCI)
---
(no changes since v2)
Changes in v2:
- use an accessor function gd_set_pci_ram_top
arch/x86/cpu/i386/cpu.c | 2 +- include/asm-generic/global_data.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-)
arch/x86/cpu/i386/cpu.c +1 -1
@@ -415,7 +415,7 @@ int cpu_phys_address_size(void)/* Don't allow PCI region 3 to use memory in the 2-4GB memory hole */ static void setup_pci_ram_top (void ) { - gd->pci_ram_top =0x80000000U ; +gd_set_pci_ram_top (0x80000000U ); }static void setup_mtrr (void )
include/asm-generic/global_data.h +6 -0
@@ -560,6 +560,12 @@ static_assert(sizeof(struct global_data) == GD_SIZE);#define gd_event_state () NULL#endif +#if CONFIG_IS_ENABLED (PCI ) +#define gd_set_pci_ram_top (val) gd->pci_ram_top = val +#else +#define gd_set_pci_ram_top (val) +#endif +/** * enum gd_flags - global data flags *
Signature · 1 line
2.34.1
Re: [PATCH v3 21/23] x86: cpu: i386: cpu: only set pci_ram_top if CONFIG_IS_ENABLED(PCI)
Quoted 35 lines · Troy Kisky
This avoids an error when ifdef
CONFIG_PCIis changed to ifCONFIG_IS_ENABLED(PCI)Signed-off-by Troy Kisky <[email protected]>---
(no changes since v2)
Changes in v2:
- use an accessor functiongd_set_pci_ram_toparch/x86/cpu/i386/cpu.c | 2 +- include/asm-generic/global_data.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-)arch/x86/cpu/i386/cpu.c +1
-1@@ -415,7 +415,7 @@ int cpu_phys_address_size(void)/* Don't allow PCI region 3 to use memory in the 2-4GB memory hole */ static void setup_pci_ram_top (void ) { - gd->pci_ram_top =0x80000000U ; +gd_set_pci_ram_top (0x80000000U ); }static void setup_mtrr (void )include/asm-generic/global_data.h +0
-0@@ -560,6 +560,12 @@ static_assert(sizeof(struct global_data) == GD_SIZE);#define gd_event_state () NULL#endif
include/asm-generic/global_data.h static_assert(sizeof(struct global_data) == GD_SIZE); · line 571
Quoted 10 lines
include/asm-generic/global_data.h +6
-0+#if CONFIG_IS_ENABLED (PCI ) +#define gd_set_pci_ram_top (val) gd->pci_ram_top = val +#else +#define gd_set_pci_ram_top (val) +#endif +/** * enum gd_flags - global data flags *
This ends up being a size change on I think it was coreboot64 and as such I'd like to see it come via the x86 tree, and run time tested first.
Signature · 1 line
Tom
Re: [PATCH v3 21/23] x86: cpu: i386: cpu: only set pci_ram_top if CONFIG_IS_ENABLED(PCI)
In reply to Troy KiskyQuoted 7 lines · Troy Kisky
This avoids an error when ifdef
CONFIG_PCIis changed to ifCONFIG_IS_ENABLED(PCI)Signed-off-by Troy Kisky <[email protected]>---
Quoted 9 lines
(no changes since v2)
Changes in v2:
- use an accessor functiongd_set_pci_ram_toparch/x86/cpu/i386/cpu.c | 2 +- include/asm-generic/global_data.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-)
rebased on u-boot-x86/master, and applied to u-boot-x86, thanks!
PATCH v3 22/23 power: pmic: add dm style definitions if not CONFIG_IS_ENABLED(POWER_LEGACY)
In reply to Troy KiskyThis avoids an error in converting to CONFIG_IS_ENABLED(DM_PMIC). Many boards SPL code needs these definitions to compile, even if the functions are not linked.
---
(no changes since v1)
include/power/pmic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/power/pmic.h +1 -1
@@ -86,7 +86,7 @@ struct pmic {#endif /* CONFIG_IS_ENABLED(POWER_LEGACY) */ /* TODO: Change to CONFIG_IS_ENABLED(DM_PMIC) when SPL_DM_PMIC exists */ -#ifdef CONFIG_DM_PMIC +#if defined(CONFIG_DM_PMIC ) || !CONFIG_IS_ENABLED (POWER_LEGACY )/** * U-Boot PMIC Framework * =====================
Signature · 1 line
2.34.1
Re: [PATCH v3 22/23] power: pmic: add dm style definitions if not CONFIG_IS_ENABLED(POWER_LEGACY)
Quoted 6 lines · Troy Kisky
This avoids an error in converting to
CONFIG_IS_ENABLED(DM_PMIC). Many boards SPL code needs these definitions to compile, even if the functions are not linked.Signed-off-by Troy Kisky <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH v3 23/23 CI: add test/usage_of_is_enabled_check.sh
In reply to Troy KiskyAdd script usage_of_is_enabled_check to print any configs that use CONFIG_IS_ENABLED instead of IS_ENABLED and vice versa.
Add usage_of_is_enabled_commit.sh to generate commits to fix the above issues.
You can remove entries from test/usage_of_is_enabled_todo.txt or the entire file and then run test/usage_of_is_enabled_commit.sh
to convert to suggested usage of CONFIG_IS_ENABLED/IS_ENABLED
or run test/usage_of_is_enabled_check.sh to
see which configs are still todo.
---
(no changes since v1)
.azure-pipelines.yml | 11 ++ .gitlab-ci.yml | 5 + test/usage_of_is_enabled_check.sh | 19 +++ test/usage_of_is_enabled_commit.sh | 12 ++ test/usage_of_is_enabled_correct.sh | 50 +++++++ test/usage_of_is_enabled_exempt.txt | 9 ++ test/usage_of_is_enabled_list.sh | 86 +++++++++++ test/usage_of_is_enabled_splcfg.txt | 21 +++ test/usage_of_is_enabled_todo.txt | 213 ++++++++++++++++++++++++++++ 9 files changed, 426 insertions(+) create mode 100755 test/usage_of_is_enabled_check.sh create mode 100755 test/usage_of_is_enabled_commit.sh create mode 100755 test/usage_of_is_enabled_correct.sh create mode 100644 test/usage_of_is_enabled_exempt.txt create mode 100755 test/usage_of_is_enabled_list.sh create mode 100644 test/usage_of_is_enabled_splcfg.txt create mode 100644 test/usage_of_is_enabled_todo.txt
.azure-pipelines.yml +11 -0
@@ -67,6 +67,17 @@ stages: :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0 + - job: check_usage_of_is_enabled + displayName: 'Check usage of CONFIG_IS_ENABLED vs IS_ENABLED' + pool: + vmImage: $(ubuntu_vm) + container: + image: $(ci_runner_image) + options: $(container_option) + steps: + # generate list of SPL configs + - script: test/usage_of_is_enabled_check.sh + - job: cppcheck displayName: 'Static code analysis with cppcheck' pool:
.gitlab-ci.yml +5 -0
@@ -137,6 +137,11 @@ check for new CONFIG symbols outside Kconfig: :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0 +check usage of CONFIG_IS_ENABLED vs IS_ENABLED: + stage: testsuites + script: + - ./test/usage_of_is_enabled_check.sh + # QA jobs for code analytics # static code analysis with cppcheck (we can add --enable=all later) cppcheck:
test/usage_of_is_enabled_check.sh new file +19 -0
@@ -0,0 +1,19 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0+ +# +# Written by Troy Kisky <[email protected]> + +scriptdir=`dirname "$0"`; +${scriptdir}/usage_of_is_enabled_list.sh | grep -vw FOO; +if [ $? -eq 0 ] ; then + echo "The above may have incorrect usage of IS_ENABLED/"\ +"CONFIG_IS_ENABLED" + echo "Run test/usage_of_is_enabled_commit.sh and "\ +"squash with appropriate commit" + ret=1; +else + ret=0; +fi + +rm ${scriptdir}/splcfg.tmp ${scriptdir}/exclude.tmp +exit ${ret}
test/usage_of_is_enabled_commit.sh new file +12 -0
@@ -0,0 +1,12 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0+ +# +# Written by Troy Kisky <[email protected]> + +scriptdir=`dirname "$0"`; +${scriptdir}/usage_of_is_enabled_list.sh | \ +xargs -I {} sh -c "${scriptdir}/usage_of_is_enabled_correct.sh {}; \ +git commit -a -m\"CONFIG_{}: correct usage of CONFIG_IS_ENABLED/IS_ENABLED\";" + + +rm ${scriptdir}/splcfg.tmp ${scriptdir}/exclude.tmp
test/usage_of_is_enabled_correct.sh new file +50 -0
50 lines not on this page · raw message
test/usage_of_is_enabled_exempt.txt new file +9 -0
@@ -0,0 +1,9 @@ +BLOBLIST +BLOBLIST_FIXED +DM_PMIC_PFUZE100 +FOO +NAND_BOOT +OF_CONTROL +SYS_L2_PL310 +WATCHDOG +X86_64
test/usage_of_is_enabled_list.sh new file +86 -0
86 lines not on this page · raw message
test/usage_of_is_enabled_splcfg.txt new file +21 -0
@@ -0,0 +1,21 @@ +BZIP2 +CONFIG_CLK +CONSOLE_MUX +DM_EVENT +DM_HWSPINLOCK +DM_RNG +DM_STDIO +EFI_DEVICE_PATH_TO_TEXT +EFI_LOADER +ERRNO_STR +EVENT_DYNAMIC +GENERATE_SMBIOS_TABLE +IOMMU +MMC_HW_PARTITIONING +NAND_CS_INIT +OFNODE_MULTI_TREE +PINCTRL_ARMADA_38X +PRE_CONSOLE_BUFFER +RESET_MEDIATEK +RESET_ROCKCHIP +UT_DM
test/usage_of_is_enabled_todo.txt new file +213 -0
213 lines not on this page · raw message
Signature · 1 line
2.34.1
Quoted 47 lines · Troy Kisky
This patch set gets ready to checks the usage of
CONFIG_IS_ENABLED/IS_ENABLED.After the set has been applied, you can delete
test/usage_of_is_enabled_todo.txt
and runtest/usage_of_is_enabled_commit.shThe script
test/usage_of_is_enabled_check.sh
checks for new questionable uses of
CONFIG_IS_ENABLED/IS_ENABLED and is added
to .azure-pipelines.yml, and
.gitlab-ci.ymlversion 3 changes:
Dropped changes to puma-rk3399 and ringneck-px30 in favor of Quentin Schulz's patch
https://patchwork.ozlabs.org/project/uboot/patch/20230301-tsd-env-nowhere-kconfig-v1-1-d5c08e096906@theobroma-systems.com/
https://patchwork.ozlabs.org/project/uboot/patch/20230301-tsd-env-nowhere-kconfig-v1-2-d5c08e096906@theobroma-systems.com/
Please apply them before this series.Drop gateworks: venice: Always define
setup_fecandsetup_eqosDrop arm: cpu: armv7: ls102xa: fdt: removeeth_devicesupport Simon's patches took care of theseAdd to todo list, these new questionable uses that snuck into the code.
PARTITION_TYPE_GUID
PHY_ATHEROS
RTC_SANDBOXChanges in v3:
remove error entirely and prevent withKconfignew patch to address Tom's concerns
- Rebase on Simon's s/CMD_SATA/SATA/ change
- commit message updatedChanges in v2:
- new patch
- delay include oflinux/kconfig.hto do fromMakefile
- as suggested by Simon
- delay include oflinux/kconfig.hto do fromMakefile
- as suggested by Simon
- delay include oflinux/kconfig.hto do fromMakefile
- as suggested by Simon
- delay include oflinux/kconfig.hto do fromMakefile
- as suggested by Simon
- delay include oflinux/kconfig.hto do fromMakefile
- as suggested by Simon
Quoted 8 lines
- include
linux/kconfig.hfromtools/Makefile
- as suggested by Simon
- changed condition of when to include field bdf
- added protection to another instance of bdf inuart.c
- Thanks to Simon for getting this corrected
- use normal if, not preprocessor
- new in series
- use an accessor functiongd_set_pci_ram_top
So, I've provided some feedback on a few of these in particular, and applied a number of others. The biggest problems I see are that I'm not sure that overall the changes make the code more readable. When I ran the whole conversion series there were a few places where the resulting code changed because of how things are used today.
Not as a problem for you to jump off and solve, but, looking harder at this makes me think that going for CONFIG_(SPL|TPL|VPL|etc)_FOO makes it harder to use the macros people expect from the kernel, where things are done as a suffix and so we could just use IS_ENABLED(CONFIG_FOO) and have things expand to test for CONFIG_FOO || (CONFIG_FOO_SPL && CONFIG_SPL_BUILD) || ..
Signature · 1 line
Tom