[U-Boot] scripts to sanity-check the Kconfig files

Michal Simek monstr at monstr.eu
Wed Jan 4 16:22:27 CET 2017


On 4.1.2017 15:38, Robert P. J. Day wrote:
> 
>   while i'm in a chatty mood, a few years back, i wrote some simple
> shell scripts that scanned the linux kernel source tree for
> inconsistencies in the Kconfig files, and pointed out things like
> "config" entries that were never used or tested, "select" directives
> that referred to non-existent variables, and so on.
> 
>   i just ran that first script on the current u-boot source, and there
> are quite a number of these. as just partial output, here are some
> Kconfig variables that are (apparently, as long as i didn't screw up
> anything in the script) defined but never used or tested anywhere:
> 
>   ... snip ...
>   >>>>> CMD_MX_CYCLIC
>   cmd/Kconfig:338:config CMD_MX_CYCLIC
>   >>>>> CPU_SPECIFIC_OPTIONS
>   arch/x86/cpu/ivybridge/Kconfig:23:config CPU_SPECIFIC_OPTIONS
>   arch/x86/cpu/broadwell/Kconfig:21:config CPU_SPECIFIC_OPTIONS
>   >>>>> DEBUG_EFI_CONSOLE
>   drivers/serial/Kconfig:115:config DEBUG_EFI_CONSOLE
>   >>>>> DM_MOD_EXP
>   drivers/crypto/rsa_mod_exp/Kconfig:1:config DM_MOD_EXP
>   ... snip ...
> 
> so as to that first example, that shows that the variable
> CMD_MX_CYCLIC is defined in cmd/Kconfig:
> 
>   config CMD_MX_CYCLIC
>         bool "mdc, mwc"
>         help
>           mdc - memory display cyclic
>           mwc - memory write cyclic
> 
> but is never tested for anything, and a grep seems to show that:
> 
> $ grep -r CMD_MX_CYCLIC *
> cmd/Kconfig:config CMD_MX_CYCLIC
> configs/sandbox_noblk_defconfig:CONFIG_CMD_MX_CYCLIC=y
> configs/sandbox_spl_defconfig:CONFIG_CMD_MX_CYCLIC=y
> configs/sandbox_defconfig:CONFIG_CMD_MX_CYCLIC=y
> $
> 
>   OTOH, if you search for just "MX_CYCLIC":
> 
> $ grep -r MX_CYCLIC *A
> cmd/Kconfig:config CMD_MX_CYCLIC
> cmd/mem.c:#ifdef CONFIG_MX_CYCLIC
> cmd/mem.c:#endif /* CONFIG_MX_CYCLIC */
> cmd/mem.c:#ifdef CONFIG_MX_CYCLIC
> cmd/mem.c:#endif /* CONFIG_MX_CYCLIC */
> configs/sandbox_noblk_defconfig:CONFIG_CMD_MX_CYCLIC=y
> configs/sandbox_spl_defconfig:CONFIG_CMD_MX_CYCLIC=y
> configs/sandbox_defconfig:CONFIG_CMD_MX_CYCLIC=y
> include/configs/ea20.h:#define CONFIG_MX_CYCLIC
> include/configs/lwmon5.h:#define CONFIG_MX_CYCLIC        1       /* enable mdc/mwc commands      */
> include/configs/M5249EVB.h:#define CONFIG_MX_CYCLIC	1	/* enable mdc/mwc commands	*/
> include/configs/PMC405DE.h:#define CONFIG_MX_CYCLIC	1	/* enable mdc/mwc commands      */
> include/configs/x600.h:#define CONFIG_MX_CYCLIC		/* enable mdc/mwc commands      */
> include/configs/ipam390.h:#define CONFIG_MX_CYCLIC
> include/configs/da850evm.h:#define CONFIG_MX_CYCLIC
> include/configs/bcm23550_w1d.h:#define CONFIG_MX_CYCLIC
> include/configs/bcm28155_ap.h:#define CONFIG_MX_CYCLIC
> include/configs/omapl138_lcdk.h:#define CONFIG_MX_CYCLIC
> include/configs/bcm_ep_board.h:#define CONFIG_MX_CYCLIC
> include/configs/amcore.h:#define CONFIG_MX_CYCLIC		1 /* enable mdc/mwc commands	*/
> include/configs/digsy_mtc.h:#define CONFIG_MX_CYCLIC	1
> include/configs/amcc-common.h:#define CONFIG_MX_CYCLIC		/* enable mdc/mwc commands      */
> include/configs/xtfpga.h:#define CONFIG_MX_CYCLIC
> include/configs/xilinx-ppc.h:#define CONFIG_MX_CYCLIC		/* enable mdc/mwc commands      */
> include/configs/ti_armv7_keystone2.h:#define CONFIG_MX_CYCLIC
> include/configs/PMC440.h:#define CONFIG_MX_CYCLIC	1	/* enable mdc/mwc commands      */
> include/configs/calimain.h:#define CONFIG_MX_CYCLIC
> include/configs/legoev3.h:#define CONFIG_MX_CYCLIC
> README:- CONFIG_MX_CYCLIC
> scripts/config_whitelist.txt:CONFIG_MX_CYCLIC
> $
> 
>   so it would appear that the *correct* spelling is "CONFIG_MX_CYCLIC"
> as defined in the header file, which is what is being tested in the
> source file cmd/mem.c.

I looked at this. Correct name should be CONFIG_CMD_MX_CYCLIC and for
the rest s/CONFIG_MX_CYCLIC/CONFIG_CMD_MX_CYCLIC/g with move to defconfig.
+ in Kconfig there should be dependecy on CMD_MEMORY.

Thanks,
Michal


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170104/62e6501c/attachment.sig>


More information about the U-Boot mailing list