[U-Boot] policy regarding unused code

Robert P. J. Day rpjday at crashcourse.ca
Tue Dec 11 19:24:35 UTC 2018


On Tue, 11 Dec 2018, Tom Rini wrote:

... snip ...

> > This is not a small list and a lot of them we probably want to keep.
> >
> > ['CONFIG_MX8M', 'CONFIG_POWER_PMIC_MAX77693', 'CONFIG_TPM2_TIS_SANDBOX',
> > 'CONFIG_TPM_ST33ZP24_SPI', 'CONFIG_USB_SL811HS', 'CONFIG_RAM_SUPPORT',
> > 'CONFIG_BCM2835_WDT', 'CONFIG_ENV_IS_IN_SATA', 'CONFIG_IO64',
> > 'CONFIG_NAND_SUPPORT', 'CONFIG_NOR_SUPPORT', 'CONFIG_RISCV_ISA_A',
> > 'CONFIG_I2C_MUX_GPIO', 'CONFIG_POWER_FG_MAX17042', 'CONFIG_DNET',
> > 'CONFIG_CMD_SH_ZIMAGEBOOT', 'CONFIG_USE_DEFAULT_ENV_FILE',
> > 'CONFIG_CMD_IOTRACE', 'CONFIG_ALI152X', 'CONFIG_M5271',
> > 'CONFIG_CPU_MPC83XX', 'CONFIG_NXP_TDA19988', 'CONFIG_IMX',

... big snip ...

> I suspect this splits into three categories:
> - Dead symbols and code to drop.
> - Typos/thinkos
> - Mistake in your grep?  I see CONFIG_VIRTIO_SANDBOX is used today for
>   example.

  what did you run to get that list of CONFIG_* symbols? years ago, i
wrote some scripts that scanned the linux source tree looking for
things like that; i just dragged that script out of mothballs and ran
it against the current u-boot tree and got over 4,500 lines of
output, but my script lists apparently unused CONFIG variables, then
does a recursive search against a given directory to show anywhere
that symbol shows up, a symbol at a time.

  for example, my script for "badref" goes looking for CONFIG settings
that are being tested somewhere but that have no corresponding
"config" stanza in a Kconfig file somewhere.

  $ find_badref_configs.sh drivers

the first few lines of output:

>>>>> ACX517AKN
drivers/video/pxa_lcd.c:201:#ifdef CONFIG_ACX517AKN
drivers/video/pxa_lcd.c:231:#endif /* CONFIG_ACX517AKN */
drivers/video/pxa_lcd.c:297:#endif /* CONFIG_ACX517AKN */
scripts/config_whitelist.txt:15:CONFIG_ACX517AKN
>>>>> ACX544AKN
drivers/video/pxa_lcd.c:233:#ifdef CONFIG_ACX544AKN
drivers/video/pxa_lcd.c:263:#endif /* CONFIG_ACX544AKN */
scripts/config_whitelist.txt:16:CONFIG_ACX544AKN
>>>>> ADNPESC1
drivers/net/smc91111.h:253:#ifdef CONFIG_ADNPESC1
drivers/net/smc91111.h:262:#ifdef CONFIG_ADNPESC1
drivers/net/smc91111.h:444:#elif defined(CONFIG_ADNPESC1)
scripts/config_whitelist.txt:20:CONFIG_ADNPESC1
... snip ...

  as you can see, that shows that there is a CONFIG_ACX517AKN being
tested, while there is no apparent "config" definition for it
anywhere (not sure whether being in the whitelist.txt file means
anything relative to that). and so on, and so on.

  i can see the OP's FPGA_LATTICE in my output:

>>>>> FPGA_LATTICE
drivers/fpga/Makefile:13:obj-$(CONFIG_FPGA_LATTICE) += ivm_core.o lattice.o
drivers/fpga/fpga.c:103:#if defined(CONFIG_FPGA_LATTICE)
drivers/fpga/fpga.c:276:#if defined(CONFIG_FPGA_LATTICE)
drivers/fpga/fpga.c:318:#if defined(CONFIG_FPGA_LATTICE)

which is clearly being tested, while never being defined. so, yes, my
script locates a *ton* of variables like that.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                  http://crashcourse.ca/dokuwiki

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================


More information about the U-Boot mailing list