LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Robert P. J. Day" <rpjday@mindspring.com>
To: Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: finding "dead" CONFIG variables -- an exercise for the reader
Date: Mon, 29 Jan 2007 03:59:29 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0701290328001.12980@CPE00045a9c397f-CM001225dbafb6> (raw)


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

                 reply	other threads:[~2007-01-29  9:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0701290328001.12980@CPE00045a9c397f-CM001225dbafb6 \
    --to=rpjday@mindspring.com \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: finding "dead" CONFIG variables -- an exercise for the reader' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).