finding "dead" CONFIG variables -- an exercise for the reader

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  FYI, the majority of patches i've submitted lately related to
potentially "dead" CONFIG variables in the source tree were identified
by a short script "dead_config.sh" i wrote you can find here:

http://www.fsdev.dreamhosters.com/wiki/index.php?title=Dead_CONFIG_variables

  that script scans the source tree (or whatever subdirectory you pass
as an argument), collects all of the "CONFIG_" type macros in
conditional preprocessor statements, then spits out any of them that
aren't defined in *any* Kconfig in the entire source tree.

  as a random example, let's check the subdirectory drivers/media/dvb:

$ dead_config.sh drivers/media/dvb
========== DVB_DIBCOM_DEBUG ==========
drivers/media/dvb/frontends/dib3000mb.c:#ifdef CONFIG_DVB_DIBCOM_DEBUG
drivers/media/dvb/frontends/dib3000mb.c:#ifdef CONFIG_DVB_DIBCOM_DEBUG
drivers/media/dvb/frontends/dib3000mb_priv.h:#ifdef CONFIG_DVB_DIBCOM_DEBUG

  so there's a single CONFIG macro somewhere in that tree that is
being tested (three times) for which there is no Kconfig entry.  that
doesn't mean this macro is necessarily wrong -- it might be defined in
a Makefile, perhaps -- but it at least deserves closer examination.

  another random example:

$ dead_config.sh arch/ppc/8xx_io
========== FEC_PACKETHOOK ==========
arch/ppc/8xx_io/fec.c:#ifdef CONFIG_FEC_PACKETHOOK
arch/ppc/8xx_io/fec.c:#ifdef CONFIG_FEC_PACKETHOOK
arch/ppc/8xx_io/fec.c:#ifdef CONFIG_FEC_PACKETHOOK
arch/ppc/8xx_io/fec.c:#ifdef CONFIG_FEC_PACKETHOOK
arch/ppc/8xx_io/fec.c:#endif /* CONFIG_FEC_PACKETHOOK */
arch/ppc/8xx_io/fec.c:#ifdef CONFIG_FEC_PACKETHOOK
arch/ppc/8xx_io/fec.c:#ifdef CONFIG_FEC_PACKETHOOK
arch/ppc/8xx_io/fec.c:#ifdef CONFIG_FEC_PACKETHOOK
arch/ppc/8xx_io/fec.c:#ifdef CONFIG_FEC_PACKETHOOK
arch/ppc/8xx_io/fec.c:#ifdef CONFIG_FEC_PACKETHOOK
arch/ppc/8xx_io/fec.c:#ifdef CONFIG_FEC_PACKETHOOK
arch/ppc/8xx_io/fec.c:#ifdef CONFIG_FEC_PACKETHOOK
arch/ppc/8xx_io/fec.c:#ifdef CONFIG_FEC_PACKETHOOK
arch/ppc/8xx_io/fec.c:#ifdef CONFIG_FEC_PACKETHOOK
arch/ppc/8xx_io/fec.c:#ifdef CONFIG_FEC_PACKETHOOK

  feel free to run the script on the subtree of your choice.  when i
first ran this script against the entire tree, i identified 347 unique
macros like this.

rday

p.s.  in some cases, the macro doesn't appear in any Kconfig file
since it's meant only for internal use by the maintainer, as you can
see by the suffix "_DEBUG".  but if that's the case, it's my feeling
that macros like that should *not* start with the "CONFIG_" prefix,
which should be reserved for user-configurable selections only.

  but that's just my $0.02.

rday

-- 
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://www.fsdev.dreamhosters.com/wiki/index.php?title=Main_Page
========================================================================
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux