LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* finding "dead" CONFIG variables -- an exercise for the reader
@ 2007-01-29  8:59 Robert P. J. Day
  0 siblings, 0 replies; only message in thread
From: Robert P. J. Day @ 2007-01-29  8:59 UTC (permalink / raw)
  To: Linux kernel mailing list


  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
========================================================================

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-01-29  9:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-29  8:59 finding "dead" CONFIG variables -- an exercise for the reader Robert P. J. Day

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).