public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michal Marek <mmarek@suse.cz>
To: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Cc: Joe Perches <joe@perches.com>,
	yann.morin.1998@free.fr, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scripts/checkkconfig.py: find unused Kconfig parameters
Date: Fri, 25 Oct 2013 15:45:11 +0200	[thread overview]
Message-ID: <526A75E7.30109@suse.cz> (raw)
In-Reply-To: <526A746C.3060806@free-electrons.com>

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

  reply	other threads:[~2013-10-25 13:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-24  5:23 [PATCH] scripts/checkkconfig.py: find unused Kconfig parameters Michael Opdenacker
2013-10-24  7:30 ` Joe Perches
2013-10-25 13:38   ` Michael Opdenacker
2013-10-25 13:45     ` Michal Marek [this message]
2013-10-30  3:07       ` Michael Opdenacker
2013-10-24  9:39 ` Michal Marek
2013-10-29 18:06 ` Yann E. MORIN
2013-10-30  3:14   ` Michael Opdenacker

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=526A75E7.30109@suse.cz \
    --to=mmarek@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.opdenacker@free-electrons.com \
    --cc=yann.morin.1998@free.fr \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox