* [Kernel-janitors] [rfc] a lot of unused CONFIG_*
@ 2004-01-17 16:04 Domen Puncer
2004-01-18 12:53 ` Adrian Bunk
2004-01-19 18:22 ` Randy.Dunlap
0 siblings, 2 replies; 3+ messages in thread
From: Domen Puncer @ 2004-01-17 16:04 UTC (permalink / raw)
To: kernel-janitors
Hi.
# wc -l CONFIG_defined_but_not_used CONFIG_not_defined_but_used
116 CONFIG_defined_but_not_used
635 CONFIG_not_defined_but_used
This is a lot!
I didn't strip out "*_MODULE" (don't know if they're automagicaly
generated and it doesn't make much difference).
So... am I wrong about my script, or do we have A LOT of work to do?
Any suggestions, how to fix this? (grepping for every symbol, and
replacing it takes too much time).
Upper 2 files were generated from following commands in bash.
Sorry, not very readable, i know.
# these executed on kernel source
# find files that use *CONFIG_*
find | egrep '\.[chS]$' | xargs egrep 'CONFIG_[A-Z0-9a-z]*' | sed 's/.*CONFIG_/CONFIG_/g' | sed 's/[^A-Z0-9a-z_].*//' | sort | uniq | tee ../CONFIGs_in_source
# find CONFIG_* that are defined in Kconfig files
find | grep Kconfig | xargs egrep '^config.*[A-Z0-9a-z_]+$' | sed 's/.*config[^A-Z0-9a-z_]*/CONFIG_/g' | sort | uniq | tee ../config
# find *CONFIG_* defined in sources
find | egrep '\.[chS]$' | xargs egrep '#define.*CONFIG' | sed 's/.*CONFIG_/CONFIG_/g' | sed 's/[^A-Z0-9a-z_].*//' | sort | uniq | tee ../CONFIGs_defined
# these on ".." relative to kernel source
# used (or defined) in sources, but not defined in Kconfig
diff CONFIGs_in_source config | egrep '^<' | cut -f2 -d\ > CONFIGs_not_in_config
# filename says it all
diff CONFIGs_not_in_config CONFIGs_defined | grep '<' | cut -f2 -d\ > CONFIG_not_defined_but_used
# see filename
diff CONFIGs_not_in_config CONFIGs_defined | grep '>' | cut -f2 -d\ > CONFIG_defined_but_not_used
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [Kernel-janitors] [rfc] a lot of unused CONFIG_*
2004-01-17 16:04 [Kernel-janitors] [rfc] a lot of unused CONFIG_* Domen Puncer
@ 2004-01-18 12:53 ` Adrian Bunk
2004-01-19 18:22 ` Randy.Dunlap
1 sibling, 0 replies; 3+ messages in thread
From: Adrian Bunk @ 2004-01-18 12:53 UTC (permalink / raw)
To: kernel-janitors
On Sat, Jan 17, 2004 at 05:04:40PM +0100, Domen Puncer wrote:
> Hi.
>
> # wc -l CONFIG_defined_but_not_used CONFIG_not_defined_but_used
> 116 CONFIG_defined_but_not_used
> 635 CONFIG_not_defined_but_used
>
> This is a lot!
>
> I didn't strip out "*_MODULE" (don't know if they're automagicaly
> generated and it doesn't make much difference).
These symbols are automatically generated when configuring a variable to
be modular.
> So... am I wrong about my script, or do we have A LOT of work to do?
>...
It's sometimes used and 100% correct to define options that are only
used in the Kconfig file they are defined in.
Examples are some cpu variables in from arch/i386/Kconfig .
It often occurs that a variable is only used in a Makefile to select a
subdirectory (e.g. CONFIG_E1000), but your scripts didn't count this
use.
Not all Kconfig files are named Kconfig, Kconfig\* is a better
expression.
Not all things your script output are really bugs, e.g. there might be
an #ifdef CONFIG_FOO in the code without CONFIG_FOO being defined
anywhere, but it's defined in another tree (e.g. an architecture tree)
that will be resynced with the kernel soon.
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [Kernel-janitors] [rfc] a lot of unused CONFIG_*
2004-01-17 16:04 [Kernel-janitors] [rfc] a lot of unused CONFIG_* Domen Puncer
2004-01-18 12:53 ` Adrian Bunk
@ 2004-01-19 18:22 ` Randy.Dunlap
1 sibling, 0 replies; 3+ messages in thread
From: Randy.Dunlap @ 2004-01-19 18:22 UTC (permalink / raw)
To: kernel-janitors
On Sun, 18 Jan 2004 13:53:22 +0100 Adrian Bunk <bunk@fs.tum.de> wrote:
| On Sat, Jan 17, 2004 at 05:04:40PM +0100, Domen Puncer wrote:
| > Hi.
| >
| > # wc -l CONFIG_defined_but_not_used CONFIG_not_defined_but_used
| > 116 CONFIG_defined_but_not_used
| > 635 CONFIG_not_defined_but_used
| >
| > This is a lot!
| >
| > I didn't strip out "*_MODULE" (don't know if they're automagicaly
| > generated and it doesn't make much difference).
|
| These symbols are automatically generated when configuring a variable to
| be modular.
|
| > So... am I wrong about my script, or do we have A LOT of work to do?
| >...
|
| It's sometimes used and 100% correct to define options that are only
| used in the Kconfig file they are defined in.
| Examples are some cpu variables in from arch/i386/Kconfig .
|
| It often occurs that a variable is only used in a Makefile to select a
| subdirectory (e.g. CONFIG_E1000), but your scripts didn't count this
| use.
|
| Not all Kconfig files are named Kconfig, Kconfig\* is a better
| expression.
|
| Not all things your script output are really bugs, e.g. there might be
| an #ifdef CONFIG_FOO in the code without CONFIG_FOO being defined
| anywhere, but it's defined in another tree (e.g. an architecture tree)
| that will be resynced with the kernel soon.
Summary: the script is too (mechanical|simple).
It may be used for hints/help.
Take them on a case-by-case basis.
--
~Randy
Everything is relative.
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-01-19 18:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-17 16:04 [Kernel-janitors] [rfc] a lot of unused CONFIG_* Domen Puncer
2004-01-18 12:53 ` Adrian Bunk
2004-01-19 18:22 ` Randy.Dunlap
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.