[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <526A75E7.30109@suse.cz>
Date: Fri, 25 Oct 2013 15:45:11 +0200
From: Michal Marek <mmarek@...e.cz>
To: Michael Opdenacker <michael.opdenacker@...e-electrons.com>
Cc: Joe Perches <joe@...ches.com>, yann.morin.1998@...e.fr,
akpm@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] scripts/checkkconfig.py: find unused Kconfig parameters
On 25.10.2013 15:38, Michael Opdenacker wrote:
> Hi Joe,
>
> Thank you very much for your review!
>
> On 10/24/2013 09:30 AM, Joe Perches wrote:
>> On Thu, 2013-10-24 at 07:23 +0200, Michael Opdenacker wrote:
>>
>>> +def count_param(param):
>>> +
>>> + global source_file, bad_params_in_file
>>> +
>>> + if os.path.isdir('.git'):
>>> + # Use git grep when available
>>> + count = subprocess.check_output('git grep ' + param + '| grep -v defconfig | wc -l', shell=True)
>>> + else:
>>> + # Fallback to regular grep
>>> + count = subprocess.check_output('grep -R ' + param + ' . | grep -v defconfig | wc -l', shell=True)
>> Doesn't the grep need -w?
> Using "-w" is a good idea, and this way I can eliminate false negatives
> (for example finding matches for "PRINTK_TIME" when I'm looking for
> plain "PRINTK"). The only this is that I then need to look for both
> "PARAM" (in Kconfig files, in case the parameter is just used for
> dependency management), and for "CONFIG_PARAM" (in source files).
You can process Kconfig files and source files separately. And you can
speed up the script a lot, if you simply record all CONFIG_* strings
found in the sources, and then compare this to the set of config options
defined in Kconfig. Then you can also easily implement the opposite
check, which is currently done by scripts/checkkconfigsymbols.sh.
Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists