LKML Archive on
help / color / mirror / Atom feed
From: "Robert P. J. Day" <>
To: Linux kernel mailing list <>
Subject: identifying CONFIG variable typoes in the source tree
Date: Tue, 23 Jan 2007 16:13:43 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0701231559090.3014@CPE00045a9c397f-CM001225dbafb6> (raw)

  because it's cold outside and i was bored, i put together the
following script, to be run from the top of the source tree:


CV=$(grep -rh "^#.*if.* CONFIG_[A-Za-z0-9]" . | grep -v endif)
CVARS=$(echo "${CV}" | sed "s/.*\(CONFIG_[^	 =\)\*\/]*\).*/\1/" | sort -u | grep "^CONFIG_")

kcfiles=$(find . -name "Kconfig*")

for cv in ${CVARS} ; do
	# echo "cv = ${cv}"
	str=$(echo ${cv} | sed "s/^CONFIG_//")
	# echo "str = ${str}"
	grep -wq ${str} ${kcfiles} || echo ${str}

  what it does is scan the entire tree for lines of the form

...if... CONFIG_whatever...

collects all of those CONFIG variables and, one at a time, checks to
see if that variable even exists in any Kconfig file in the tree so
that it could possibly ever be set.  (i'm not guaranteeing that the
script is perfect, but it does generate some interesting results.)

  the first few lines of output:


  let's check these:

$ grep -r 53C700_BE_BUS .
./drivers/scsi/53c700.h:#ifdef CONFIG_53C700_BE_BUS

  in short, a variable that's being tested with no possibility of ever
being set in a Kconfig file.  moving on,

$ grep -rw CONFIG_64_BIT .
./include/asm-um/elf-ppc.h:#ifdef CONFIG_64_BIT
$ grep -rw 64_BIT .

  so CONFIG_64_BIT is similarly being tested, but it's not being set
anywhere.  i'm guessing this is a misspelling of "CONFIG_64BIT", which
*does* exist in the tree and is quite common.  next:

$ grep -r 68328_SERIAL_UART2 .
./drivers/serial/68328serial.h:#ifndef CONFIG_68328_SERIAL_UART2
./arch/m68knommu/platform/68VZ328/config.c:#ifdef CONFIG_68328_SERIAL_UART2

  again, something being tested with no possibility of it being set

  the script turns up 284 examples of this.


             reply	other threads:[~2007-01-23 21:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-23 21:13 Robert P. J. Day [this message]
2007-01-23 23:35 ` Oleg Verych
2007-01-24  2:02   ` Robert P. J. Day
2007-01-24  8:21 ` Geert Uytterhoeven
2007-01-24 10:33   ` Robert P. J. Day

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:

* 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.0701231559090.3014@CPE00045a9c397f-CM001225dbafb6 \ \ \
    --subject='Re: identifying CONFIG variable typoes in the source tree' \

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